|
@@ -0,0 +1,264 @@
|
|
|
+<?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.caimei365.order.mapper.CmReportingClubMapper">
|
|
|
+
|
|
|
+ <resultMap type="CmReportingClub" id="CmReportingClubResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="clubName" column="clubName" />
|
|
|
+ <result property="linkMan" column="linkMan" />
|
|
|
+ <result property="mobile" column="mobile" />
|
|
|
+ <result property="productId" column="productId" />
|
|
|
+ <result property="orderId" column="orderId" />
|
|
|
+ <result property="orderStatus" column="orderStatus" />
|
|
|
+ <result property="lockStatus" column="lockStatus" />
|
|
|
+ <result property="lockTime" column="lockTime" />
|
|
|
+ <result property="distributionId" column="distributionId" />
|
|
|
+ <result property="delFlag" column="delFlag" />
|
|
|
+ <result property="updateTime" column="updateTime" />
|
|
|
+ <result property="createTime" column="createTime" />
|
|
|
+ <result property="commission" column="commission" />
|
|
|
+ <result property="settleStatus" column="settleStatus" />
|
|
|
+ <result property="settleTime" column="settleTime" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectCmReportingClubVo">
|
|
|
+ select
|
|
|
+ cm_reporting_club.id,
|
|
|
+ cm_reporting_club.clubName,
|
|
|
+ cm_reporting_club.linkMan,
|
|
|
+ cm_reporting_club.mobile,
|
|
|
+ cm_reporting_club.productId,
|
|
|
+ cm_reporting_club.orderId,
|
|
|
+ cm_reporting_club.orderStatus,
|
|
|
+ cm_reporting_club.lockStatus,
|
|
|
+ cm_reporting_club.lockTime,
|
|
|
+ cm_reporting_club.distributionId,
|
|
|
+ cm_reporting_club.delFlag,
|
|
|
+ cm_reporting_club.updateTime,
|
|
|
+ cm_reporting_club.createTime,
|
|
|
+ ifnull(cm_reporting_club.commission,0) AS commission,
|
|
|
+ cm_reporting_club.settleStatus,
|
|
|
+ cm_reporting_club.settleTime
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="getByCmReportingClub" parameterType="CmReportingClub" resultMap="CmReportingClubResult">
|
|
|
+ <include refid="selectCmReportingClubVo"/>
|
|
|
+ from cm_reporting_club AS cm_reporting_club
|
|
|
+ <where> cm_reporting_club.delFlag = 0
|
|
|
+ <if test="id != null "> and cm_reporting_club.id = #{id}</if>
|
|
|
+ <if test="clubName != null and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
|
|
|
+ <if test="linkMan != null and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
|
|
|
+ <if test="mobile != null and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
|
|
|
+ <if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
|
|
|
+ <if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
|
|
|
+ <if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
|
|
|
+ <if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
|
|
|
+ <if test="lockTime != null "> and cm_reporting_club.lockTime = #{lockTime}</if>
|
|
|
+ <if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
|
|
|
+ <if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
|
|
|
+ <if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
|
|
|
+ <if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
|
|
|
+ <if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
|
|
|
+ <if test="settleTime != null "> and cm_reporting_club.settleTime = #{settleTime}</if>
|
|
|
+ </where>
|
|
|
+ group by cm_reporting_club.id
|
|
|
+ order by cm_reporting_club.createTime desc
|
|
|
+ limit 0,1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCmReportingClubList" parameterType="CmReportingClub" resultMap="CmReportingClubResult">
|
|
|
+ <include refid="selectCmReportingClubVo"/>
|
|
|
+ from cm_reporting_club AS cm_reporting_club
|
|
|
+ <where> cm_reporting_club.delFlag = 0
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_reporting_club.id
|
|
|
+ <if test="id.toUpperCase().indexOf('=')==-1">
|
|
|
+ = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="id.toUpperCase().indexOf('=')!=-1">
|
|
|
+ <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
|
|
|
+ <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
|
|
|
+ <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
|
|
|
+ #{idIn}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="clubName != null and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
|
|
|
+ <if test="linkMan != null and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
|
|
|
+ <if test="mobile != null and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
|
|
|
+ <if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
|
|
|
+ <if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
|
|
|
+ <if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
|
|
|
+ <if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
|
|
|
+ <if test="lockTime != null "> and cm_reporting_club.lockTime = #{lockTime}</if>
|
|
|
+ <if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
|
|
|
+ <if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
|
|
|
+ <if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
|
|
|
+ <if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
|
|
|
+ <if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
|
|
|
+ <if test="settleTime != null "> and cm_reporting_club.settleTime = #{settleTime}</if>
|
|
|
+ </where>
|
|
|
+ group by cm_reporting_club.id
|
|
|
+ order by cm_reporting_club.createTime desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCmReportingClubCount" parameterType="CmReportingClub" resultType="Integer">
|
|
|
+ select count(1)
|
|
|
+ from cm_reporting_club AS cm_reporting_club
|
|
|
+ <where> cm_reporting_club.delFlag = 0
|
|
|
+ <if test="id != null "> and cm_reporting_club.id = #{id}</if>
|
|
|
+ <if test="clubName != null and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
|
|
|
+ <if test="linkMan != null and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
|
|
|
+ <if test="mobile != null and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
|
|
|
+ <if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
|
|
|
+ <if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
|
|
|
+ <if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
|
|
|
+ <if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
|
|
|
+ <if test="lockTime != null "> and cm_reporting_club.lockTime = #{lockTime}</if>
|
|
|
+ <if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
|
|
|
+ <if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
|
|
|
+ <if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
|
|
|
+ <if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
|
|
|
+ <if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
|
|
|
+ <if test="settleTime != null "> and cm_reporting_club.settleTime = #{settleTime}</if>
|
|
|
+ </where>
|
|
|
+ group by cm_reporting_club.id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCmReportingClubById" parameterType="String" resultMap="CmReportingClubResult">
|
|
|
+ <include refid="selectCmReportingClubVo"/>
|
|
|
+ from cm_reporting_club AS cm_reporting_club
|
|
|
+ where cm_reporting_club.delFlag = 0 and cm_reporting_club.id = #{id}
|
|
|
+ </select>
|
|
|
+ <select id="getDistributionProductCommission" resultType="BigDecimal">
|
|
|
+ select commission
|
|
|
+ from cm_distribution_product AS cm_distribution_product
|
|
|
+ where cm_distribution_product.productId = #{productId}
|
|
|
+ </select>
|
|
|
+ <select id="getDistributionSplitCode" resultType="String">
|
|
|
+ select if(a.parentId=0,a.splitCode,(select b.splitCode from cm_distribution AS b where b.id = a.parentId))
|
|
|
+ from cm_distribution AS a
|
|
|
+ where a.id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getById" parameterType="CmReportingClub" resultType="String">
|
|
|
+ select id
|
|
|
+ from cm_reporting_club AS cm_reporting_club
|
|
|
+ <where> cm_reporting_club.delFlag = 0
|
|
|
+ <if test="id != null "> and cm_reporting_club.id = #{id}</if>
|
|
|
+ <if test="clubName != null and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
|
|
|
+ <if test="linkMan != null and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
|
|
|
+ <if test="mobile != null and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
|
|
|
+ <if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
|
|
|
+ <if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
|
|
|
+ <if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
|
|
|
+ <if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
|
|
|
+ <if test="lockTime != null "> and cm_reporting_club.lockTime = #{lockTime}</if>
|
|
|
+ <if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
|
|
|
+ <if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
|
|
|
+ <if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
|
|
|
+ <if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
|
|
|
+ <if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
|
|
|
+ <if test="settleTime != null "> and cm_reporting_club.settleTime = #{settleTime}</if>
|
|
|
+ </where>
|
|
|
+ group by cm_reporting_club.id
|
|
|
+ limit 0,1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="addCmReportingClub" parameterType="CmReportingClub" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into cm_reporting_club
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null and id != ''">id,</if>
|
|
|
+ <if test="clubName != null and clubName != ''">clubName,</if>
|
|
|
+ <if test="linkMan != null and linkMan != ''">linkMan,</if>
|
|
|
+ <if test="mobile != null and mobile != ''">mobile,</if>
|
|
|
+ <if test="productId != null">productId,</if>
|
|
|
+ <if test="orderId != null">orderId,</if>
|
|
|
+ <if test="orderStatus != null">orderStatus,</if>
|
|
|
+ <if test="lockStatus != null">lockStatus,</if>
|
|
|
+ <if test="lockTime != null">lockTime,</if>
|
|
|
+ <if test="distributionId != null">distributionId,</if>
|
|
|
+ <if test="delFlag != null">delFlag,</if>
|
|
|
+ <if test="updateTime != null">updateTime,</if>
|
|
|
+ <if test="createTime != null">createTime,</if>
|
|
|
+ <if test="commission != null">commission,</if>
|
|
|
+ <if test="settleStatus != null">settleStatus,</if>
|
|
|
+ <if test="settleTime != null">settleTime,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null and id != ''">#{id},</if>
|
|
|
+ <if test="clubName != null and clubName != ''">#{clubName},</if>
|
|
|
+ <if test="linkMan != null and linkMan != ''">#{linkMan},</if>
|
|
|
+ <if test="mobile != null and mobile != ''">#{mobile},</if>
|
|
|
+ <if test="productId != null">#{productId},</if>
|
|
|
+ <if test="orderId != null">#{orderId},</if>
|
|
|
+ <if test="orderStatus != null">#{orderStatus},</if>
|
|
|
+ <if test="lockStatus != null">#{lockStatus},</if>
|
|
|
+ <if test="lockTime != null">#{lockTime},</if>
|
|
|
+ <if test="distributionId != null">#{distributionId},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="commission != null">#{commission},</if>
|
|
|
+ <if test="settleStatus != null">#{settleStatus},</if>
|
|
|
+ <if test="settleTime != null">#{settleTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateCmReportingClub" parameterType="CmReportingClub">
|
|
|
+ update cm_reporting_club
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="clubName != null and clubName != ''">clubName = #{clubName},</if>
|
|
|
+ <if test="linkMan != null and linkMan != ''">linkMan = #{linkMan},</if>
|
|
|
+ <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
|
|
|
+ <if test="productId != null">productId = #{productId},</if>
|
|
|
+ <if test="orderId != null">orderId = #{orderId},</if>
|
|
|
+ <if test="orderStatus != null">orderStatus = #{orderStatus},</if>
|
|
|
+ <if test="lockStatus != null">lockStatus = #{lockStatus},</if>
|
|
|
+ <if test="lockTime != null">lockTime = #{lockTime},</if>
|
|
|
+ <if test="distributionId != null">distributionId = #{distributionId},</if>
|
|
|
+ <if test="delFlag != null">delFlag = #{delFlag},</if>
|
|
|
+ <if test="updateTime != null">updateTime = #{updateTime},</if>
|
|
|
+ <if test="createTime != null">createTime = #{createTime},</if>
|
|
|
+ <if test="commission != null">commission = #{commission},</if>
|
|
|
+ <if test="settleStatus != null">settleStatus = #{settleStatus},</if>
|
|
|
+ <if test="settleTime != null">settleTime = #{settleTime},</if>
|
|
|
+ <if test="paidCommission != null">paidCommission = #{paidCommission},</if>
|
|
|
+ <if test="splitSettleStatus != null">splitSettleStatus = #{splitSettleStatus},</if>
|
|
|
+ <if test="splitCode != null and splitCode != ''">splitCode = #{splitCode},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+
|
|
|
+ <delete id="delCmReportingClubById" parameterType="String">
|
|
|
+ delete
|
|
|
+ from cm_reporting_club where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="delCmReportingClub" parameterType="CmReportingClub">
|
|
|
+ delete
|
|
|
+ from cm_reporting_club AS cm_reporting_club
|
|
|
+ <where>
|
|
|
+ <if test="id != null "> and cm_reporting_club.id = #{id}</if>
|
|
|
+ <if test="clubName != null and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
|
|
|
+ <if test="linkMan != null and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
|
|
|
+ <if test="mobile != null and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
|
|
|
+ <if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
|
|
|
+ <if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
|
|
|
+ <if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
|
|
|
+ <if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
|
|
|
+ <if test="lockTime != null "> and cm_reporting_club.lockTime = #{lockTime}</if>
|
|
|
+ <if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
|
|
|
+ <if test="delFlag != null "> and cm_reporting_club.delFlag = #{delFlag}</if>
|
|
|
+ <if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
|
|
|
+ <if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
|
|
|
+ <if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
|
|
|
+ <if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
|
|
|
+ <if test="settleTime != null "> and cm_reporting_club.settleTime = #{settleTime}</if>
|
|
|
+ </where>
|
|
|
+ </delete>
|
|
|
+</mapper>
|