130 lines
5.3 KiB
XML
130 lines
5.3 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.bsd.pjcloud.admin.mapper.SysUserTransactionMapper">
|
|
<resultMap id="sysUserTransactionMap" type="com.bsd.pjcloud.admin.api.entity.SysUserTransactionEntity">
|
|
<id property="id" column="id"/>
|
|
<result property="userId" column="user_id"/>
|
|
<result property="bizId" column="biz_id"/>
|
|
<result property="bizType" column="biz_type"/>
|
|
<result property="sourceDeptId" column="source_dept_id"/>
|
|
<result property="targetDeptId" column="target_dept_id"/>
|
|
<result property="isWalletTransaction" column="is_wallet_transaction"/>
|
|
<result property="walletTransactionTime" column="wallet_transaction_time"/>
|
|
<result property="processId" column="process_id"/>
|
|
<result property="processStatus" column="process_status"/>
|
|
<result property="processTime" column="process_time"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="delFlag" column="del_flag"/>
|
|
<result property="tenantId" column="tenant_id"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectA">
|
|
select a.id,
|
|
a.apply_user_id,
|
|
a.user_id,
|
|
a.biz_id,
|
|
a.biz_type,
|
|
a.source_dept_id,
|
|
a.target_dept_id,
|
|
a.is_wallet_transaction,
|
|
a.wallet_transaction_time,
|
|
a.process_id,
|
|
a.process_status,
|
|
a.process_time,
|
|
a.create_by,
|
|
a.create_time,
|
|
a.update_by,
|
|
a.update_time,
|
|
a.del_flag,
|
|
a.tenant_id,
|
|
</sql>
|
|
|
|
<sql id="whereA">
|
|
a.del_flag = '0'
|
|
<if test="dto.userId != null">
|
|
AND a.user_id = #{dto.userId}
|
|
</if>
|
|
<if test="dto.bizId != null">
|
|
AND a.biz_id = #{dto.bizId}
|
|
</if>
|
|
<if test="dto.bizId != null">
|
|
AND a.biz_id = #{dto.bizId}
|
|
</if>
|
|
<if test="dto.bizType != null">
|
|
AND a.biz_type = #{dto.bizType}
|
|
</if>
|
|
<if test="dto.sourceDeptId != null">
|
|
AND a.source_dept_id = #{dto.sourceDeptId}
|
|
</if>
|
|
<if test="dto.targetDeptId != null">
|
|
AND a.target_dept_id = #{dto.targetDeptId}
|
|
</if>
|
|
<if test="dto.isWalletTransaction != null">
|
|
AND a.is_wallet_transaction = #{dto.isWalletTransaction}
|
|
</if>
|
|
<if test="dto.processStatus != null">
|
|
AND a.process_status = #{dto.processStatus}
|
|
</if>
|
|
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
|
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
|
</if>
|
|
<if test="dto.walletTransactionTimeList != null and dto.walletTransactionTimeList.length == 2">
|
|
and a.wallet_transaction_time between #{dto.walletTransactionTimeList[0]} and
|
|
#{dto.walletTransactionTimeList[1]}
|
|
</if>
|
|
<if test="dto.processTimeList != null and dto.processTimeList.length == 2">
|
|
and a.create_time between #{dto.processTimeList[0]} and #{dto.processTimeList[1]}
|
|
</if>
|
|
</sql>
|
|
|
|
<sql id="selectJoin">
|
|
<include refid="selectA"/>
|
|
soureD.name as sourceDeptName,
|
|
targetD.name as targetDeptName,
|
|
u.name as username,
|
|
u.phone as userMobile,
|
|
u.avatar as userAvatar,
|
|
applyU.name as applyUsername,
|
|
applyU.dept_id as applyUserDeptId
|
|
from sys_user_transaction a
|
|
left join sys_dept soureD on soureD.dept_id = a.source_dept_id
|
|
left join sys_dept targetD on targetD.dept_id = a.target_dept_id
|
|
left join sys_user u on u.user_id = a.user_id
|
|
left join sys_user applyU on applyU.user_id = a.apply_user_id
|
|
</sql>
|
|
|
|
<select id="scopePageJoin" resultType="com.bsd.pjcloud.admin.api.vo.SysUserTransactionVo">
|
|
<include refid="selectJoin"/>
|
|
<where>
|
|
<include refid="whereA"/>
|
|
</where>
|
|
order by a.create_time desc,a.id desc
|
|
</select>
|
|
|
|
<select id="join" resultType="com.bsd.pjcloud.admin.api.vo.SysUserTransactionVo">
|
|
<include refid="selectJoin"/>
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<select id="lastTransationList" resultType="com.bsd.pjcloud.admin.api.entity.SysUserTransactionEntity">
|
|
SELECT *
|
|
FROM sys_user_transaction AS t1
|
|
WHERE t1.del_flag = '0'
|
|
AND t1.wallet_transaction_time is null
|
|
AND t1.is_wallet_transaction = '1'
|
|
AND t1.process_status = '2'
|
|
and t1.id = (SELECT t2.id
|
|
FROM sys_user_transaction AS t2
|
|
WHERE t2.del_flag = '0'
|
|
AND t2.user_id = t1.user_id
|
|
AND t2.is_wallet_transaction = '1'
|
|
AND t2.process_status = '2'
|
|
ORDER BY t2.create_time DESC
|
|
LIMIT 1)
|
|
and DATE_FORMAT(t1.create_time, '%Y-%m-%d') <= #{dateStr}
|
|
</select>
|
|
</mapper> |