<?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.sinata.modular.mall.dao.CommissionSettlementMonthMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.sinata.modular.mall.model.CommissionSettlementMonth">
|
<id column="id" property="id"/>
|
<result column="userId" property="userId"/>
|
<result column="showId" property="showId"/>
|
<result column="orderNo" property="orderNo"/>
|
<result column="provinceCode" property="provinceCode"/>
|
<result column="cityCode" property="cityCode"/>
|
<result column="countyCode" property="countyCode"/>
|
<result column="salesCommissionGoods" property="salesCommissionGoods"/>
|
<result column="salesCommissionGroup" property="salesCommissionGroup"/>
|
<result column="manageProfitGoods" property="manageProfitGoods"/>
|
<result column="manageProfitGroup" property="manageProfitGroup"/>
|
<result column="breedAward" property="breedAward"/>
|
<result column="commissionPayable" property="commissionPayable"/>
|
<result column="addBeforeTax" property="addBeforeTax"/>
|
<result column="subBeforeTax" property="subBeforeTax"/>
|
<result column="commissionBeforeTax" property="commissionBeforeTax"/>
|
<result column="paymentAmount" property="paymentAmount"/>
|
<result column="createTime" property="createTime"/>
|
<result column="month" property="month"/>
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, userId, showId, orderNo, provinceCode, cityCode, countyCode, salesCommissionGoods, salesCommissionGroup, manageProfitGoods, manageProfitGroup, breedAward, commissionPayable, addBeforeTax, subBeforeTax, commissionBeforeTax, paymentAmount, createTime, month
|
</sql>
|
|
<sql id="fromTabWhereSql">
|
FROM
|
`mall_commission_settlement_month` cm
|
LEFT JOIN t_city_region province on province.`code` = cm.provinceCode
|
LEFT JOIN t_city_region city on city.`code` = cm.cityCode
|
LEFT JOIN t_city_region county on county.`code` = cm.countyCode
|
LEFT JOIN mem_user mu on mu.id = cm.userId
|
<where>
|
<if test="month != null and month !=''">
|
and cm.month = #{month}
|
</if>
|
<if test="name != null and name !=''">
|
and mu.nick_name like CONCAT("%",#{name},"%")
|
</if>
|
<if test="showId != null and showId !=''">
|
and mu.show_id like CONCAT("%",#{showId},"%")
|
</if>
|
<if test="area != null and area !=''">
|
and (
|
province.`name` like CONCAT("%",#{area},"%") or
|
city.`name` like CONCAT("%",#{area},"%") or
|
county.`name` like CONCAT("%",#{area},"%")
|
)
|
</if>
|
<if test="cityCode != null and cityCode !=''">
|
and (
|
cm.cityCode like CONCAT(#{cityCode},"%")
|
OR cm.countyCode like CONCAT(#{cityCode},"%")
|
)
|
</if>
|
<if test="gradeId != null">
|
and mu.member_grade_id = #{gradeId}
|
</if>
|
<if test="beginTime != null and beginTime !=''">
|
and cm.month <![CDATA[ >= ]]> #{beginTime}
|
</if>
|
<if test="endTime != null and endTime !=''">
|
and cm.month <![CDATA[ <= ]]> #{endTime}
|
</if>
|
</where>
|
</sql>
|
|
<select id="queryList" resultType="com.sinata.modular.mall.model.CommissionSettlementMonth">
|
SELECT
|
province.`name` provinceCodeName,city.`name` cityCodeName,county.`name` countyCodeName,
|
mu.show_id showId, mu.nick_name userName,mu.member_grade_id,
|
cm.*
|
<include refid="fromTabWhereSql"/>
|
<if test="offset != null and size != null">
|
limit #{offset}, #{size}
|
</if>
|
</select>
|
|
<select id="queryListCount" resultType="java.lang.Integer">
|
SELECT COUNT(*) <include refid="fromTabWhereSql"/>
|
</select>
|
|
<insert id="addList">
|
REPLACE INTO `mall_commission_settlement_month`
|
(`userId`, `showId`,`provinceCode`, `cityCode`, `countyCode`, `salesCommissionGoods`,
|
`salesCommissionGroup`, `manageProfitGoods`, `manageProfitGroup`, `breedAward`, `commissionPayable`,
|
`addBeforeTax`, `subBeforeTax`, `commissionBeforeTax`, `paymentAmount`, `month`) VALUES
|
<foreach collection="addMonthList" item="month"
|
separator=",">
|
(#{month.userId}, #{month.showId}, #{month.provinceCode}, #{month.cityCode}, #{month.countyCode}, #{month.salesCommissionGoods},
|
#{month.salesCommissionGroup}, #{month.manageProfitGoods}, #{month.manageProfitGroup}, #{month.breedAward}, #{month.commissionPayable},
|
#{month.addBeforeTax}, #{month.subBeforeTax}, #{month.commissionBeforeTax}, #{month.paymentAmount}, #{month.month})
|
</foreach>
|
|
|
</insert>
|
</mapper>
|