|
@@ -0,0 +1,206 @@
|
|
|
+<?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.KuaishouRewardBaseInfoMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.ruixuan.isc.entity.KuaishouRewardBaseInfo" id="KuaishouRewardBaseInfoResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="itemId" column="item_id"/>
|
|
|
+ <result property="itemTitle" column="item_title"/>
|
|
|
+ <result property="promoterId" column="promoter_id"/>
|
|
|
+ <result property="promoterName" column="promoter_name"/>
|
|
|
+ <result property="statDate" column="stat_date"/>
|
|
|
+ <result property="currentSettlementNum" column="current_settlement_num"/>
|
|
|
+ <result property="totalSettlementNum" column="total_settlement_num"/>
|
|
|
+ <result property="settlementPrice" column="settlement_price"/>
|
|
|
+ <result property="anchorAmount" column="anchor_amount"/>
|
|
|
+ <result property="referenceAmount" column="reference_amount"/>
|
|
|
+ <result property="totalAmount" column="total_amount"/>
|
|
|
+ <result property="remarks" column="remarks"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectKuaishouRewardBaseInfoVo">
|
|
|
+ SELECT id,
|
|
|
+ item_id,
|
|
|
+ item_title,
|
|
|
+ promoter_id,
|
|
|
+ promoter_name,
|
|
|
+ stat_date,
|
|
|
+ current_settlement_num,
|
|
|
+ total_settlement_num,
|
|
|
+ settlement_price,
|
|
|
+ anchor_amount,
|
|
|
+ reference_amount,
|
|
|
+ total_amount,
|
|
|
+ remarks,
|
|
|
+ create_time,
|
|
|
+ update_time
|
|
|
+ FROM kuaishou_reward_base_info
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectKuaishouRewardBaseInfoList" parameterType="com.ruixuan.isc.entity.KuaishouRewardBaseInfo"
|
|
|
+ resultMap="KuaishouRewardBaseInfoResult">
|
|
|
+ SELECT t1.id,
|
|
|
+ t1.item_id,
|
|
|
+ t1.item_title,
|
|
|
+ t1.promoter_id,
|
|
|
+ t1.promoter_name,
|
|
|
+ t1.stat_date,
|
|
|
+ t1.current_settlement_num,
|
|
|
+ t1.total_settlement_num,
|
|
|
+ t1.settlement_price,
|
|
|
+ t1.anchor_amount,
|
|
|
+ t1.reference_amount,
|
|
|
+ t1.total_amount,
|
|
|
+ t1.remarks,
|
|
|
+ t2.user_name as 'itemCreateName',
|
|
|
+ t3.user_name as 'promoterCreateName',
|
|
|
+ t1.create_time,
|
|
|
+ t1.update_time
|
|
|
+ FROM kuaishou_reward_base_info t1 LEFT JOIN kuaishou_item_list t2
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT promoter_id as 'promoter_id',
|
|
|
+ group_concat(user_name) as 'user_name'
|
|
|
+ from kuaishou_promoter WHERE media_id = '2'
|
|
|
+ GROUP BY promoter_id
|
|
|
+ ) t3 on t1.promoter_id = t3.promoter_id
|
|
|
+ <where>
|
|
|
+ <if test="itemId != null ">and t1.item_id = #{itemId}</if>
|
|
|
+ <if test="itemTitle != null and itemTitle != ''">and t1.item_title = #{itemTitle}</if>
|
|
|
+ <if test="promoterId != null ">and t1.promoter_id = #{promoterId}</if>
|
|
|
+ <if test="promoterName != null and promoterName != ''">and t1.promoter_name like concat('%',
|
|
|
+ #{promoterName},
|
|
|
+ '%')
|
|
|
+ </if>
|
|
|
+ <if test="statDate != null ">and t1.stat_date = #{statDate}</if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ order by t1.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectKuaishouRewardBaseInfoById" parameterType="java.lang.Long"
|
|
|
+ resultMap="KuaishouRewardBaseInfoResult">
|
|
|
+ <include refid="selectKuaishouRewardBaseInfoVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+ <select id="checkData" resultType="java.lang.Integer">
|
|
|
+ SELECT COUNT(1)
|
|
|
+ FROM kuaishou_reward_base_info
|
|
|
+ WHERE item_id = #{itemId}
|
|
|
+ AND promoter_id = #{promoterId}
|
|
|
+ AND stat_date = #{statDate}
|
|
|
+ </select>
|
|
|
+ <select id="getItemName" resultType="java.lang.String" parameterType="java.lang.Long">
|
|
|
+ SELECT item_title
|
|
|
+ FROM kuaishou_supply_chain
|
|
|
+ WHERE item_id = #{itemId} limit 1
|
|
|
+ </select>
|
|
|
+ <select id="getPromoterName" resultType="java.lang.String" parameterType="java.lang.String">
|
|
|
+ SELECT promoter_nick_name
|
|
|
+ FROM kuaishou_supply_chain
|
|
|
+ WHERE promoter_id = #{promoterId} limit 1
|
|
|
+ </select>
|
|
|
+ <select id="getTotal" resultType="com.alibaba.fastjson.JSONObject"
|
|
|
+ parameterType="com.ruixuan.isc.entity.KuaishouRewardBaseInfo">
|
|
|
+ SELECT
|
|
|
+ '-' as 'itemCreateName',
|
|
|
+ '-' as 'statDate',
|
|
|
+ '-' as 'settlementPrice',
|
|
|
+ '-' as 'totalSettlementNum',
|
|
|
+ '-' as 'itemId',
|
|
|
+ sum(current_settlement_num) as 'currentSettlementNum',
|
|
|
+ sum(anchor_amount) as 'anchorAmount',
|
|
|
+ sum(reference_amount) as 'referenceAmount',
|
|
|
+ sum(total_amount) as 'totalAmount'
|
|
|
+ FROM kuaishou_reward_base_info
|
|
|
+ <where>
|
|
|
+ <if test="itemId != null ">and item_id = #{itemId}</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="statDate != null ">and stat_date = #{statDate}</if>
|
|
|
+ </where>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <insert id="insertKuaishouRewardBaseInfo" parameterType="com.ruixuan.isc.entity.KuaishouRewardBaseInfo"
|
|
|
+ useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into kuaishou_reward_base_info
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="itemId != null">item_id,</if>
|
|
|
+ <if test="itemTitle != null">item_title,</if>
|
|
|
+ <if test="promoterId != null">promoter_id,</if>
|
|
|
+ <if test="promoterName != null">promoter_name,</if>
|
|
|
+
|
|
|
+ <if test="statDate != null">stat_date,</if>
|
|
|
+ <if test="currentSettlementNum != null">current_settlement_num,</if>
|
|
|
+ <if test="totalSettlementNum != null">total_settlement_num,</if>
|
|
|
+ <if test="settlementPrice != null">settlement_price,</if>
|
|
|
+ <if test="anchorAmount != null">anchor_amount,</if>
|
|
|
+ <if test="referenceAmount != null">reference_amount,</if>
|
|
|
+ <if test="totalAmount != null">total_amount,</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="itemId != null">#{itemId},</if>
|
|
|
+ <if test="itemTitle != null">#{itemTitle},</if>
|
|
|
+ <if test="promoterId != null">#{promoterId},</if>
|
|
|
+ <if test="promoterName != null">#{promoterName},</if>
|
|
|
+
|
|
|
+ <if test="statDate != null">#{statDate},</if>
|
|
|
+ <if test="currentSettlementNum != null">#{currentSettlementNum},</if>
|
|
|
+ <if test="totalSettlementNum != null">#{totalSettlementNum},</if>
|
|
|
+ <if test="settlementPrice != null">#{settlementPrice},</if>
|
|
|
+ <if test="anchorAmount != null">#{anchorAmount},</if>
|
|
|
+ <if test="referenceAmount != null">#{referenceAmount},</if>
|
|
|
+ <if test="totalAmount != null">#{totalAmount},</if>
|
|
|
+ <if test="remarks != null">#{remarks},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateKuaishouRewardBaseInfo" parameterType="com.ruixuan.isc.entity.KuaishouRewardBaseInfo">
|
|
|
+ update kuaishou_reward_base_info
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="itemId != null">item_id = #{itemId},</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="statDate != null">stat_date = #{statDate},</if>
|
|
|
+ <if test="currentSettlementNum != null">current_settlement_num = #{currentSettlementNum},</if>
|
|
|
+ <if test="totalSettlementNum != null">total_settlement_num = #{totalSettlementNum},</if>
|
|
|
+ <if test="settlementPrice != null">settlement_price = #{settlementPrice},</if>
|
|
|
+ <if test="anchorAmount != null">anchor_amount = #{anchorAmount},</if>
|
|
|
+ <if test="referenceAmount != null">reference_amount = #{referenceAmount},</if>
|
|
|
+ <if test="totalAmount != null">total_amount = #{totalAmount},</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>
|
|
|
+
|
|
|
+ <delete id="deleteKuaishouRewardBaseInfoById" parameterType="java.lang.Long">
|
|
|
+ DELETE
|
|
|
+ FROM kuaishou_reward_base_info
|
|
|
+ WHERE id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteKuaishouRewardBaseInfoByIds" parameterType="java.lang.String">
|
|
|
+ delete from kuaishou_reward_base_info where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|