双屏机查询人脸、人员信息条件优化

This commit is contained in:
jjLv 2025-06-05 15:01:11 +08:00
parent b3cd13d4a4
commit 11b71392f6
3 changed files with 35 additions and 30 deletions

View File

@ -31,6 +31,7 @@ public class UserServiceImpl implements UserService {
return AjaxResult.success(new ArrayList<>());
}
List<UserInfoVo> moneyList = mapper.getMoneyList();
if (!moneyList.isEmpty()){
// 构建 userId moneyVo 的映射提升查找效率
Map<String, UserInfoVo> moneyMap = moneyList.stream().collect(Collectors.toMap(UserInfoVo::getUserId, vo -> vo, (a, b) -> a));
list.forEach(userInfoVo -> {
@ -42,7 +43,9 @@ public class UserServiceImpl implements UserService {
userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance());
userInfoVo.setSubsidiesBalance(money.getSubsidiesBalance());
}
});
}
return AjaxResult.success(list);
}

View File

@ -11,8 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
face_state
from user_face
<where>
<if test="userId != null and userId != '' and userId != 0 and userId != '0'">
and user_id = #{userId}
</if>
<if test="time != null and time != ''">
and update_time >= #{time} - INTERVAL 5 SECOND;
and update_time >= #{time} - INTERVAL 10 SECOND
</if>
</where>
</select>

View File

@ -4,8 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.android.mapper.UserMapper">
<select id="getUserInfo" resultType="com.bonus.canteen.core.android.vo.UserInfoVo">
select
su.user_id as userId,
select su.user_id as userId,
su.user_name as userName,
su.nick_name as nickName,
ac.account_id as accId,
@ -23,12 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="type == 'user'">
<if test="time != null and time != ''">
AND su.update_time >= (#{time} - INTERVAL 5 SECOND)
AND su.update_time >= (#{time} - INTERVAL 10 SECOND)
</if>
</if>
<if test="type == 'card'">
<if test="time != null and time != ''">
AND ac.update_time >= (#{time} - INTERVAL 5 SECOND)
AND ac.update_time >= (#{time} - INTERVAL 10 SECOND)
</if>
</if>
</select>