40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
|
package com.xkrs.dao;
|
||
|
|
||
|
import com.xkrs.model.entity.AppletsUser;
|
||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||
|
import org.springframework.data.jpa.repository.Modifying;
|
||
|
import org.springframework.data.jpa.repository.Query;
|
||
|
import org.springframework.stereotype.Component;
|
||
|
|
||
|
/**
|
||
|
* @author XinYi Song
|
||
|
*/
|
||
|
@Component
|
||
|
public interface AppletsUserDao extends JpaRepository<AppletsUser,Long> {
|
||
|
|
||
|
/**
|
||
|
* 根据openid查询用户信息
|
||
|
* @param openId
|
||
|
* @return
|
||
|
*/
|
||
|
AppletsUser findByOpenId(String openId);
|
||
|
|
||
|
/**
|
||
|
* 根据用户id修改SessionKey
|
||
|
* @param userId
|
||
|
* @param SessionKey
|
||
|
*/
|
||
|
@Query(value = "update applets_user set session_key = ?2 where id = ?1",nativeQuery = true)
|
||
|
@Modifying(clearAutomatically=true)
|
||
|
void updateSessionKey(Integer userId,String SessionKey);
|
||
|
|
||
|
/**
|
||
|
* 根据openId修改手机号
|
||
|
* @param openId
|
||
|
* @param phone
|
||
|
*/
|
||
|
@Query(value = "update applets_user set user_phone = ?2 where open_id = ?1",nativeQuery = true)
|
||
|
@Modifying(clearAutomatically=true)
|
||
|
void updatePhone(String openId,String phone);
|
||
|
}
|