|
@@ -0,0 +1,250 @@
|
|
|
+<?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.ruixuan.isc.mapper.KuaishouRuleSettlementCheckMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.ruixuan.isc.entity.KuaishouRuleSettlementCheck" id="KuaishouRuleSettlementCheckResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="relateId" column="relate_id"/>
|
|
|
+ <result property="itemIds" column="item_ids"/>
|
|
|
+ <result property="itemTitle" column="item_title"/>
|
|
|
+ <result property="promoterId" column="promoter_id"/>
|
|
|
+ <result property="promoterName" column="promoter_name"/>
|
|
|
+ <result property="itemCreateId" column="item_create_id"/>
|
|
|
+ <result property="itemCreateName" column="item_create_name"/>
|
|
|
+ <result property="promoterCreateId" column="promoter_create_id"/>
|
|
|
+ <result property="promoterCreateName" column="promoter_create_name"/>
|
|
|
+ <result property="statDate" column="stat_date"/>
|
|
|
+ <result property="anchorAmount" column="anchor_amount"/>
|
|
|
+ <result property="shouldAnchorAmount" column="should_anchor_amount"/>
|
|
|
+ <result property="referenceAmount" column="reference_amount"/>
|
|
|
+ <result property="shouldReferenceAmount" column="should_reference_amount"/>
|
|
|
+ <result property="settlementStatus" column="settlement_status"/>
|
|
|
+ <result property="remarks" column="remarks"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectKuaishouRuleSettlementCheckVo">
|
|
|
+ select id, relate_id, item_ids,item_title, promoter_id, promoter_name, item_create_id, item_create_name, promoter_create_id, promoter_create_name, stat_date, anchor_amount, should_anchor_amount,reference_amount,should_reference_amount, settlement_status, remarks, create_time, update_time from kuaishou_rule_settlement_check
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectKuaishouRuleSettlementCheckList"
|
|
|
+ parameterType="com.ruixuan.isc.entity.KuaishouRuleSettlementCheck"
|
|
|
+ resultMap="KuaishouRuleSettlementCheckResult">
|
|
|
+ <include refid="selectKuaishouRuleSettlementCheckVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="relateId != null ">and relate_id = #{relateId}</if>
|
|
|
+ <if test="itemIds != null and itemIds != ''">and item_ids = #{itemIds}</if>
|
|
|
+ <if test="itemTitle != null and itemTitle != ''">and item_title = #{itemTitle}</if>
|
|
|
+ <if test="promoterId != null ">and promoter_id = #{promoterId}</if>
|
|
|
+ <if test="promoterName != null and promoterName != ''">and promoter_name like concat('%', #{promoterName},
|
|
|
+ '%')
|
|
|
+ </if>
|
|
|
+ <if test="itemCreateId != null ">and item_create_id = #{itemCreateId}</if>
|
|
|
+ <if test="itemCreateName != null and itemCreateName != ''">and item_create_name like concat('%',
|
|
|
+ #{itemCreateName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="promoterCreateId != null ">and promoter_create_id = #{promoterCreateId}</if>
|
|
|
+ <if test="promoterCreateName != null and promoterCreateName != ''">and promoter_create_name like
|
|
|
+ concat('%', #{promoterCreateName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="statDate != null ">and stat_date = #{statDate}</if>
|
|
|
+ <if test="anchorAmount != null ">and anchor_amount = #{anchorAmount}</if>
|
|
|
+ <if test="shouldAnchorAmount != null ">and should_anchor_amount = #{shouldAnchorAmount}</if>
|
|
|
+ <if test="referenceAmount != null ">and reference_amount = #{referenceAmount}</if>
|
|
|
+ <if test="shouldReferenceAmount != null ">and shouldReferenceAmount = #{shouldReferenceAmount}</if>
|
|
|
+ <if test="settlementStatus != null ">and settlement_status = #{settlementStatus}</if>
|
|
|
+ <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectKuaishouRuleSettlementCheckById" parameterType="java.lang.Long"
|
|
|
+ resultMap="KuaishouRuleSettlementCheckResult">
|
|
|
+ <include refid="selectKuaishouRuleSettlementCheckVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+ <select id="getTotalList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select *
|
|
|
+ from (select promoter_create_name as 'userName',
|
|
|
+ promoter_id as 'promoterId',
|
|
|
+ promoter_name as 'promoterName',
|
|
|
+ sum(anchor_amount) as 'anchorAmount',
|
|
|
+ sum(reference_amount) as 'referenceAmount',
|
|
|
+ sum((case
|
|
|
+ when settlement_status = 1
|
|
|
+ then anchor_amount
|
|
|
+ else
|
|
|
+ 0 end
|
|
|
+ )) as 'waitAnchorAmount'
|
|
|
+ from kuaishou_rule_settlement_check
|
|
|
+ where stat_date = #{date}
|
|
|
+ <if test="promoterId != null and promoterId != '' ">
|
|
|
+ and promoter_id = #{promoterId}
|
|
|
+ </if>
|
|
|
+ <if test="promoterName != null and promoterName != '' ">
|
|
|
+ AND promoter_name LIKE CONCAT('%', #{promoterName}, '%')
|
|
|
+ </if>
|
|
|
+ group by promoter_id) t
|
|
|
+ order by t.referenceAmount desc, t.promoterId asc
|
|
|
+ </select>
|
|
|
+ <select id="detailList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select id as 'id',
|
|
|
+ item_ids as 'itemIds',
|
|
|
+ item_title as 'itemName',
|
|
|
+ promoter_id as 'promoterId',
|
|
|
+ promoter_create_name as 'promoterCreateName',
|
|
|
+ promoter_name as 'promoterName',
|
|
|
+ item_create_id as 'itemCreateId',
|
|
|
+ item_create_name as 'itemCreateName',
|
|
|
+ anchor_amount as 'anchorAmount',
|
|
|
+ reference_amount as 'referenceAmount',
|
|
|
+ (case
|
|
|
+ when settlement_status = 1 then '待付款'
|
|
|
+ when settlement_status = 2 then '已付款'
|
|
|
+ else ''
|
|
|
+ end
|
|
|
+ ) as 'settlementStatusStr',
|
|
|
+ settlement_status as 'settlementStatus',
|
|
|
+ remarks as 'remarks'
|
|
|
+ from kuaishou_rule_settlement_check
|
|
|
+ where promoter_id = #{promoterId}
|
|
|
+ and stat_date = #{date}
|
|
|
+ <if test="itemId != null ">
|
|
|
+ and item_ids like concat('%',concat(#{itemId},'%'))
|
|
|
+ </if>
|
|
|
+ order by anchorAmount desc, item_ids asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertKuaishouRuleSettlementCheck" parameterType="com.ruixuan.isc.entity.KuaishouRuleSettlementCheck"
|
|
|
+ useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into kuaishou_rule_settlement_check
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="relateId != null">relate_id,</if>
|
|
|
+ <if test="itemIds != null">item_ids,</if>
|
|
|
+ <if test="itemTitle != null">item_title,</if>
|
|
|
+ <if test="promoterId != null">promoter_id,</if>
|
|
|
+ <if test="promoterName != null">promoter_name,</if>
|
|
|
+ <if test="itemCreateId != null">item_create_id,</if>
|
|
|
+ <if test="itemCreateName != null">item_create_name,</if>
|
|
|
+ <if test="promoterCreateId != null">promoter_create_id,</if>
|
|
|
+ <if test="promoterCreateName != null">promoter_create_name,</if>
|
|
|
+ <if test="statDate != null">stat_date,</if>
|
|
|
+ <if test="anchorAmount != null">anchor_amount,</if>
|
|
|
+ <if test="shouldAnchorAmount != null">should_anchor_amount,</if>
|
|
|
+ <if test="referenceAmount != null">reference_amount,</if>
|
|
|
+ <if test="shouldReferenceAmount != null">should_reference_amount,</if>
|
|
|
+ <if test="settlementStatus != null">settlement_status,</if>
|
|
|
+ <if test="remarks != null">remarks,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="relateId != null">#{relateId},</if>
|
|
|
+ <if test="itemIds != null">#{itemIds},</if>
|
|
|
+ <if test="itemTitle != null">#{itemTitle},</if>
|
|
|
+ <if test="promoterId != null">#{promoterId},</if>
|
|
|
+ <if test="promoterName != null">#{promoterName},</if>
|
|
|
+ <if test="itemCreateId != null">#{itemCreateId},</if>
|
|
|
+ <if test="itemCreateName != null">#{itemCreateName},</if>
|
|
|
+ <if test="promoterCreateId != null">#{promoterCreateId},</if>
|
|
|
+ <if test="promoterCreateName != null">#{promoterCreateName},</if>
|
|
|
+ <if test="statDate != null">#{statDate},</if>
|
|
|
+ <if test="anchorAmount != null">#{anchorAmount},</if>
|
|
|
+ <if test="shouldAnchorAmount != null">#{shouldAnchorAmount},</if>
|
|
|
+ <if test="referenceAmount != null">#{referenceAmount},</if>
|
|
|
+ <if test="shouldReferenceAmount != null">#{shouldReferenceAmount},</if>
|
|
|
+ <if test="settlementStatus != null">#{settlementStatus},</if>
|
|
|
+ <if test="remarks != null">#{remarks},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <insert id="adds">
|
|
|
+
|
|
|
+ insert into kuaishou_rule_settlement_check(
|
|
|
+ relate_id,
|
|
|
+ item_ids,
|
|
|
+ item_title,
|
|
|
+ item_create_id,
|
|
|
+ item_create_name,
|
|
|
+ promoter_id,
|
|
|
+ promoter_name,
|
|
|
+ promoter_create_id,
|
|
|
+ promoter_create_name,
|
|
|
+ stat_date,
|
|
|
+ anchor_amount,
|
|
|
+ should_anchor_amount,
|
|
|
+ reference_amount,
|
|
|
+ should_reference_amount,
|
|
|
+ settlement_status,
|
|
|
+ remarks
|
|
|
+ )
|
|
|
+ values
|
|
|
+ <foreach collection="adds" item="add" separator=",">
|
|
|
+ (
|
|
|
+ #{add.relateId},
|
|
|
+ #{add.itemIds},
|
|
|
+ #{add.itemTitle},
|
|
|
+ #{add.itemCreateId},
|
|
|
+ #{add.itemCreateName},
|
|
|
+ #{add.promoterId},
|
|
|
+ #{add.promoterName},
|
|
|
+ #{add.promoterCreateId},
|
|
|
+ #{add.promoterCreateName},
|
|
|
+ #{add.statDate},
|
|
|
+ #{add.anchorAmount},
|
|
|
+ #{add.shouldAnchorAmount},
|
|
|
+ #{add.referenceAmount},
|
|
|
+ #{add.shouldReferenceAmount},
|
|
|
+ #{add.settlementStatus},
|
|
|
+ #{add.remarks}
|
|
|
+
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateKuaishouRuleSettlementCheck" parameterType="com.ruixuan.isc.entity.KuaishouRuleSettlementCheck">
|
|
|
+ update kuaishou_rule_settlement_check
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="relateId != null">relate_id = #{relateId},</if>
|
|
|
+ <if test="itemIds != null">item_ids = #{itemIds},</if>
|
|
|
+ <if test="itemTitle != null">item_title = #{itemTitle},</if>
|
|
|
+ <if test="promoterId != null">promoter_id = #{promoterId},</if>
|
|
|
+ <if test="promoterName != null">promoter_name = #{promoterName},</if>
|
|
|
+ <if test="itemCreateId != null">item_create_id = #{itemCreateId},</if>
|
|
|
+ <if test="itemCreateName != null">item_create_name = #{itemCreateName},</if>
|
|
|
+ <if test="promoterCreateId != null">promoter_create_id = #{promoterCreateId},</if>
|
|
|
+ <if test="promoterCreateName != null">promoter_create_name = #{promoterCreateName},</if>
|
|
|
+ <if test="statDate != null">stat_date = #{statDate},</if>
|
|
|
+ <if test="anchorAmount != null">anchor_amount = #{anchorAmount},</if>
|
|
|
+ <if test="shouldAnchorAmount != null">should_anchor_amount = #{shouldAnchorAmount},</if>
|
|
|
+ <if test="referenceAmount != null">reference_amount = #{referenceAmount},</if>
|
|
|
+ <if test="shouldReferenceAmount != null">should_reference_amount = #{shouldAeferenceAmount},</if>
|
|
|
+ <if test="settlementStatus != null">settlement_status = #{settlementStatus},</if>
|
|
|
+ <if test="remarks != null">remarks = #{remarks},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+ <update id="updateFinancialReviewStatusTotal">
|
|
|
+ update kuaishou_rule_settlement_check set settlement_status = #{status}
|
|
|
+ where promoter_id = #{promoterId}
|
|
|
+ and stat_date = #{statDate}
|
|
|
+ and settlement_status = 1
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteKuaishouRuleSettlementCheckById" parameterType="java.lang.Long">
|
|
|
+ delete from kuaishou_rule_settlement_check where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteKuaishouRuleSettlementCheckByIds" parameterType="java.lang.String">
|
|
|
+ delete from kuaishou_rule_settlement_check where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|