首页>代码>maven管理的spring-data-jpa的demo>/spring-data-jpa/src/main/java/com/foreveross/springdata/jpa/dao/UserRepository.java
package com.foreveross.springdata.jpa.dao;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;

import com.foreveross.springdata.jpa.enums.AccountStatus;
import com.foreveross.springdata.jpa.model.Account;

/**
 * 												 
 * 功能描述:个人账户dao接口 									                                                                          *
 * 作者:    fly                                                           
 * 时间:    上午10:04:46													         
 * 修改记录:																     
 * 日期				作者			内容											 
 * ==========================================================================
 * ==========================================================================
 */
public interface UserRepository extends Repository<Account, Long> {
	/**
	 * 保存个人账户信息
	 * @param account
	 * @return
	 */
	public Account save(Account account);
	
	/**
	 * 根据账户id查询账户信息
	 * @param accountId
	 * @return
	 */
	public Account findByacctId(Long acctId);
	
	/**
	 * 根据用户名查询账户信息
	 * @return
	 */
	@Query("from Account a where a.userName=:userName")
	public List<Account> findAccountByName(@Param("userName") String userName);
	
	/**
	 * 根据用户名和用户状态查询用户信息
	 * @param userName
	 * @param status
	 * @return
	 */
	public List<Account> findByUserNameAndStatus(String userName, AccountStatus status);
	
	/**
	 * 查询所有分页信息
	 * @param userName
	 * @param pageable
	 * @return
	 */
	public Page<Account> findAll(Pageable pageable);
	
	/**
	 * 修改个人年龄
	 * @param afterAge
	 * @param beforeAge
	 */
	@Modifying
	@Query("update Account a set a.age = ?1 where a.age > ?2")
	public void updateAge(Integer afterAge, Integer beforeAge);
	
	/**
	 * 根据账户id删除账户
	 * @param acctId
	 */
	public void delete(Long acctId);
}
最近下载更多
madeinheaven  LV1 2020年7月19日
gzcopy  LV2 2020年4月9日
shijchen  LV2 2019年12月19日
gardenia111  LV16 2019年7月30日
gaodaming123  LV3 2019年5月24日
ly3812  LV17 2019年5月12日
hwqhwq  LV20 2019年4月8日
888888789  LV9 2019年3月14日
756398953  LV12 2019年3月5日
呦张三在哪啊  LV1 2019年2月28日
最近浏览更多
werqjkl  LV5 2022年9月30日
fengshengtian  LV8 2022年2月25日
好的好的  LV8 2021年6月18日
徐万强  LV9 2021年6月2日
860595563  LV15 2021年5月18日
vae222  LV2 2021年5月5日
wh7019230  LV1 2021年1月28日
250979238  LV2 2021年1月24日
madeinheaven  LV1 2020年7月19日
lafxxy  LV6 2020年6月20日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友