94 lines
4.0 KiB
XML
94 lines
4.0 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.central.order.mapper.guide.GuideWithdrawalMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="com.central.order.model.guide.GuideWithdrawal">
|
|
<id column="id" property="id"/>
|
|
<result column="withdraw_no" property="withdrawNo"/>
|
|
<result column="guide_id" property="guideId"/>
|
|
<result column="amount" property="amount"/>
|
|
<result column="actual_amount" property="actualAmount"/>
|
|
<result column="fee" property="fee"/>
|
|
<result column="withdraw_type" property="withdrawType"/>
|
|
<result column="account_info" property="accountInfo"/>
|
|
<result column="status" property="status"/>
|
|
<result column="apply_time" property="applyTime"/>
|
|
<result column="audit_user_id" property="auditUserId"/>
|
|
<result column="audit_time" property="auditTime"/>
|
|
<result column="audit_remark" property="auditRemark"/>
|
|
<result column="transfer_time" property="transferTime"/>
|
|
<result column="transfer_no" property="transferNo"/>
|
|
<result column="fail_reason" property="failReason"/>
|
|
<result column="tenant_id" property="tenantId"/>
|
|
<result column="create_time" property="createTime"/>
|
|
<result column="update_time" property="updateTime"/>
|
|
<result column="guide_name" property="guideName"/>
|
|
<result column="guide_no" property="guideNo"/>
|
|
<result column="guide_phone" property="guidePhone"/>
|
|
</resultMap>
|
|
|
|
<select id="selectByWithdrawNo" resultMap="BaseResultMap">
|
|
SELECT gw.*, t.tourism_name as guide_name, t.tourism_phone as guide_phone, gp.guide_no
|
|
FROM guide_withdrawals gw
|
|
LEFT JOIN tourisms t ON gw.guide_id = t.id
|
|
LEFT JOIN guide_profiles gp ON gw.guide_id = gp.tourism_id
|
|
WHERE gw.withdraw_no = #{withdrawNo}
|
|
</select>
|
|
|
|
<select id="findList" resultMap="BaseResultMap">
|
|
SELECT gw.*, t.tourism_name as guide_name, t.tourism_phone as guide_phone, gp.guide_no
|
|
FROM guide_withdrawals gw
|
|
LEFT JOIN tourisms t ON gw.guide_id = t.id
|
|
LEFT JOIN guide_profiles gp ON gw.guide_id = gp.tourism_id
|
|
<where>
|
|
<if test="p.tenantIds != null and p.tenantIds.size > 0">
|
|
AND gw.tenant_id IN
|
|
<foreach collection="p.tenantIds" item="tid" open="(" separator="," close=")">
|
|
#{tid}
|
|
</foreach>
|
|
</if>
|
|
<if test="(p.tenantIds == null or p.tenantIds.size == 0) and p.tenantId != null and p.tenantId != ''">
|
|
AND gw.tenant_id = #{p.tenantId}
|
|
</if>
|
|
<if test="p.guideId != null">
|
|
AND gw.guide_id = #{p.guideId}
|
|
</if>
|
|
<if test="p.status != null">
|
|
AND gw.status = #{p.status}
|
|
</if>
|
|
<if test="p.withdrawNo != null and p.withdrawNo != ''">
|
|
AND gw.withdraw_no = #{p.withdrawNo}
|
|
</if>
|
|
<if test="p.startTime != null">
|
|
AND gw.apply_time >= #{p.startTime}
|
|
</if>
|
|
<if test="p.endTime != null">
|
|
AND gw.apply_time <= #{p.endTime}
|
|
</if>
|
|
</where>
|
|
ORDER BY gw.id DESC
|
|
</select>
|
|
|
|
<select id="selectApprovedList" resultMap="BaseResultMap">
|
|
SELECT gw.*, t.tourism_name as guide_name, t.tourism_phone as guide_phone, gp.guide_no
|
|
FROM guide_withdrawals gw
|
|
LEFT JOIN tourisms t ON gw.guide_id = t.id
|
|
LEFT JOIN guide_profiles gp ON gw.guide_id = gp.tourism_id
|
|
WHERE gw.status = 1
|
|
ORDER BY gw.audit_time ASC
|
|
<if test="limit != null and limit > 0">
|
|
LIMIT #{limit}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="countTodayWithdrawal" resultType="java.lang.Integer">
|
|
SELECT COUNT(*)
|
|
FROM guide_withdrawals
|
|
WHERE guide_id = #{guideId}
|
|
AND DATE(apply_time) = CURDATE()
|
|
AND status NOT IN (2, 5)
|
|
</select>
|
|
|
|
</mapper>
|