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 params); @Update("REPLACE INTO user_credentials (username,type,orgId,userId) VALUES (#{username},#{type},#{orgId},#{userId})") int updateUserInfo(UserCredential userCredential); }