双屏机查询人脸、人员信息条件优化
This commit is contained in:
parent
b3cd13d4a4
commit
11b71392f6
|
|
@ -31,18 +31,21 @@ public class UserServiceImpl implements UserService {
|
|||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
List<UserInfoVo> moneyList = mapper.getMoneyList();
|
||||
// 构建 userId 到 moneyVo 的映射,提升查找效率
|
||||
Map<String, UserInfoVo> moneyMap = moneyList.stream().collect(Collectors.toMap(UserInfoVo::getUserId, vo -> vo, (a, b) -> a));
|
||||
list.forEach(userInfoVo -> {
|
||||
if (userInfoVo.getPhone().length() > PHONE_LENGTH) {
|
||||
userInfoVo.setPhone(SM4EncryptUtils.sm4Decrypt(userInfoVo.getPhone()));
|
||||
}
|
||||
UserInfoVo money = moneyMap.get(userInfoVo.getUserId());
|
||||
if (money != null) {
|
||||
userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance());
|
||||
userInfoVo.setSubsidiesBalance(money.getSubsidiesBalance());
|
||||
}
|
||||
});
|
||||
if (!moneyList.isEmpty()){
|
||||
// 构建 userId 到 moneyVo 的映射,提升查找效率
|
||||
Map<String, UserInfoVo> moneyMap = moneyList.stream().collect(Collectors.toMap(UserInfoVo::getUserId, vo -> vo, (a, b) -> a));
|
||||
list.forEach(userInfoVo -> {
|
||||
if (userInfoVo.getPhone().length() > PHONE_LENGTH) {
|
||||
userInfoVo.setPhone(SM4EncryptUtils.sm4Decrypt(userInfoVo.getPhone()));
|
||||
}
|
||||
UserInfoVo money = moneyMap.get(userInfoVo.getUserId());
|
||||
if (money != null) {
|
||||
userInfoVo.setPersonalWalletBalance(money.getPersonalWalletBalance());
|
||||
userInfoVo.setSubsidiesBalance(money.getSubsidiesBalance());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -4,31 +4,30 @@ 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,
|
||||
su.user_name as userName,
|
||||
su.nick_name as nickName,
|
||||
ac.account_id as accId,
|
||||
'' as cardNum,
|
||||
ac.serial_num as serialNum,
|
||||
ai.account_status as accStatus,
|
||||
su.phonenumber as phone,
|
||||
su.login_type as loginType
|
||||
select su.user_id as userId,
|
||||
su.user_name as userName,
|
||||
su.nick_name as nickName,
|
||||
ac.account_id as accId,
|
||||
'' as cardNum,
|
||||
ac.serial_num as serialNum,
|
||||
ai.account_status as accStatus,
|
||||
su.phonenumber as phone,
|
||||
su.login_type as loginType
|
||||
from sys_user su
|
||||
left join account_card ac on ac.user_id = su.user_id
|
||||
left join account_info ai on ai.user_id = su.user_id
|
||||
left join account_card ac on ac.user_id = su.user_id
|
||||
left join account_info ai on ai.user_id = su.user_id
|
||||
where ai.del_flag = '0'
|
||||
<if test="userId != null and userId != '' and userId != 0 and userId != '0'">
|
||||
AND su.user_id = #{userId}
|
||||
</if>
|
||||
<if test="userId != null and userId != '' and userId != 0 and userId != '0'">
|
||||
AND su.user_id = #{userId}
|
||||
</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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue