update
This commit is contained in:
@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@Mapper
|
||||
public interface SyncUserInfoLogMapper extends MyBatisBaseMapper<SyncUserInfoLog, Long> {
|
||||
|
||||
@@ -22,4 +23,6 @@ public interface SyncUserInfoLogMapper extends MyBatisBaseMapper<SyncUserInfoLog
|
||||
|
||||
void updateLastSyncTime(Date date);
|
||||
SyncUserInfoLog findUserInfoByStuUserId(@Param("stuUserId") String stuUserId);
|
||||
|
||||
List<SyncUserInfoLog> batchFindUserInfoByStuUserIds(@Param("stuUserIds") List<String> stuUserIds);
|
||||
}
|
||||
|
||||
@@ -150,4 +150,11 @@
|
||||
<select id="findUserInfoByStuUserId" resultMap="UserResultMap">
|
||||
SELECT user_id, username FROM sync_user_info_log WHERE user_id = #{stuUserId}
|
||||
</select>
|
||||
|
||||
<select id="batchFindUserInfoByStuUserIds" resultMap="UserResultMap">
|
||||
SELECT user_id, username FROM sync_user_info_log WHERE user_id IN
|
||||
<foreach collection="stuUserIds" item="stuUserId" open="(" separator="," close=")">
|
||||
#{stuUserId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -22,4 +22,11 @@ public interface TUserMapper extends MyBatisBaseMapper<TUser, Long> {
|
||||
*/
|
||||
|
||||
Long findUserIdByUsername(@Param("username") String username);
|
||||
|
||||
/**
|
||||
* 批量查询用户ID(替代 N+1 循环查询)
|
||||
* @param usernames 用户名列表
|
||||
* @return username -> userId 映射列表
|
||||
*/
|
||||
List<TUser> batchFindUserIdByUsernames(@Param("usernames") List<String> usernames);
|
||||
}
|
||||
|
||||
@@ -189,5 +189,12 @@
|
||||
|
||||
<select id="findUserIdByUsername" resultType="java.lang.Long">
|
||||
SELECT id FROM t_user WHERE user_no = #{username}
|
||||
</select>
|
||||
</select>
|
||||
|
||||
<select id="batchFindUserIdByUsernames" resultType="cn.wepact.dfm.training.dto.entity.TUser">
|
||||
SELECT id, user_no AS userNo FROM t_user WHERE user_no IN
|
||||
<foreach collection="usernames" item="username" open="(" separator="," close=")">
|
||||
#{username}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user