liuxiaolong
2019-05-06 f99bc8c6a1d10610373738edd7d0aa0181c81d99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.cloud.user.dao;
 
import org.apache.ibatis.annotations.*;
 
import com.cloud.model.sys.AppUser;
import com.cloud.model.sys.UserCredential;
 
import java.util.Map;
 
@Mapper
public interface UserCredentialsDao {
 
    @Insert("insert into user_credentials(username, type, userId,orgId) values(#{username}, #{type}, #{userId},#{orgId})")
    int save(UserCredential userCredential);
 
    @Select("select * from user_credentials t where t.username = #{username} and t.userId != #{userId}")
    UserCredential findByUsername(@Param("username") String username,@Param("userId")Long userId);
 
    @Select("select u.* from app_user u inner join user_credentials c on c.userId = u.id where c.username = #{username}")
    AppUser findUserByUsername(String username);
 
    @Select("select u.* from app_user u inner join user_credentials c on c.userId = u.id where c.username = #{username}  and u.delFlag=0 and u.enabled ='1' ")
    AppUser findLoginUser(String username);
 
    @Delete("delete from user_credentials where userId = #{id}")
    Integer deleteAppUser(Map<String, Object> params);
 
    @Update("REPLACE INTO user_credentials (username,type,orgId,userId) VALUES (#{username},#{type},#{orgId},#{userId})")
    int updateUserInfo(UserCredential userCredential);
}