Bonus-Cloud-JYY-Smart-Canteen/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/android/UserMapper.xml

48 lines
1.9 KiB
XML
Raw Normal View History

2025-05-29 15:19:00 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
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,
2025-05-30 09:23:29 +08:00
ac.account_id as accId,
'' as cardNum,
2025-05-29 15:19:00 +08:00
ac.serial_num as serialNum,
2025-05-30 09:23:29 +08:00
ai.account_status as accStatus,
2025-05-29 15:19:00 +08:00
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
where ai.del_flag = '0'
<if test="userId != null and userId != '' and userId != 0 and userId != '0'">
AND su.user_id = #{userId}
</if>
2025-05-30 13:30:41 +08:00
<if test="type == 'user'">
<if test="time != null and time != ''">
AND su.update_time >= (#{time} - INTERVAL 5 SECOND)
</if>
</if>
<if test="type == 'card'">
<if test="time != null and time != ''">
AND ac.update_time >= (#{time} - INTERVAL 5 SECOND)
</if>
</if>
2025-05-29 15:19:00 +08:00
</select>
<select id="getMoneyList" resultType="com.bonus.canteen.core.android.vo.UserInfoVo">
SELECT
sum(r.personalWalletBalance) as personalWalletBalance,
sum(r.subsidiesBalance) as subsidiesBalance,
r.user_id as userId
from( select
user_id,
IF(wallet_type = 1,wallet_bal,0) as personalWalletBalance,
IF(wallet_type = 2,wallet_bal,0) as subsidiesBalance,
2025-05-29 15:19:00 +08:00
wallet_bal
from account_wallet_info)r
GROUP BY r.user_id
</select>
</mapper>