63 lines
2.6 KiB
XML
63 lines
2.6 KiB
XML
<?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,
|
|
ac.account_id as accId,
|
|
'' as cardNum,
|
|
if(ac.card_status != '1',null,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
|
|
where su.status = '0' and ai.del_flag = '0'
|
|
<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 10 SECOND)
|
|
</if>
|
|
</if>
|
|
<if test="type == 'card'">
|
|
<if test="time != null and time != ''">
|
|
AND ac.update_time >= (#{time} - INTERVAL 10 SECOND)
|
|
</if>
|
|
</if>
|
|
</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,
|
|
wallet_bal
|
|
from account_wallet_info)r
|
|
GROUP BY r.user_id
|
|
</select>
|
|
|
|
<select id="getKitchenUserInfo" resultType="com.bonus.canteen.core.android.vo.UserInfoVo">
|
|
SELECT su.staff_id AS userId,
|
|
su.staff_no AS accId,
|
|
su.staff_name AS userName,
|
|
su.mobile AS phone,
|
|
su.post_name as nickName,
|
|
su.sex as loginType
|
|
FROM kitchen_staff_info su
|
|
<where>
|
|
<if test="userId != null and userId != '' and userId != 0 and userId != '0'">
|
|
AND su.staff_id = #{userId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
</mapper>
|