|
@@ -0,0 +1,613 @@
|
|
|
+<?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.commodity.mapper.CmDistributionProductMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.caimei365.commodity.model.po.CmDistributionProduct" id="CmDistributionProductResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="productId" column="productId" />
|
|
|
+ <result property="validFlag" column="validFlag" />
|
|
|
+ <result property="includedTax" column="includedTax" />
|
|
|
+ <result property="invoiceType" column="invoiceType" />
|
|
|
+ <result property="clubTaxPoint" column="clubTaxPoint" />
|
|
|
+ <result property="shopTaxPoint" column="shopTaxPoint" />
|
|
|
+ <result property="commission" column="commission" />
|
|
|
+ <result property="addTime" column="addTime" />
|
|
|
+ <result property="name" column="name" />
|
|
|
+ <result property="mainImage" column="mainImage" />
|
|
|
+ <result property="shopID" column="shopID" />
|
|
|
+ <result property="shopName" column="shopName" />
|
|
|
+ <result property="skuId" column="skuId" />
|
|
|
+ <result property="price" column="price" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectCmDistributionProductVo">
|
|
|
+ select
|
|
|
+ cm_distribution_product.id,
|
|
|
+ cm_distribution_product.productId,
|
|
|
+ cm_distribution_product.validFlag,
|
|
|
+ cm_distribution_product.includedTax,
|
|
|
+ cm_distribution_product.invoiceType,
|
|
|
+ ifnull(cm_distribution_product.clubTaxPoint,0) AS clubTaxPoint,
|
|
|
+ ifnull(cm_distribution_product.shopTaxPoint,0) AS shopTaxPoint,
|
|
|
+ ifnull(cm_distribution_product.commission,0) AS commission,
|
|
|
+ p.name,
|
|
|
+ p.mainImage,
|
|
|
+ p.shopID,
|
|
|
+ s.name AS shopName,
|
|
|
+ cm_distribution_product.addTime,
|
|
|
+ (select cds.skuId from cm_distribution_sku cds where cds.productId = p.productID order by cds.price asc limit 1) AS skuId,
|
|
|
+ ifnull((select cds.price from cm_distribution_sku cds where cds.productId = p.productID order by cds.price asc limit 1),0) AS price
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="getByCmDistributionProduct" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct" resultMap="CmDistributionProductResult">
|
|
|
+ <include refid="selectCmDistributionProductVo"/>
|
|
|
+ from cm_distribution_product AS cm_distribution_product
|
|
|
+ LEFT JOIN product p ON cm_distribution_product.productId = p.productID
|
|
|
+ LEFT JOIN shop s on p.shopID = s.shopID
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_product.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="productId != null "> and cm_distribution_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">
|
|
|
+ and cm_distribution_product.invoiceType
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')==-1">
|
|
|
+ = #{invoiceType}
|
|
|
+ </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
|
|
|
+ <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
|
|
|
+ #{typeIn}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
|
|
|
+ <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
|
|
|
+ <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
|
|
|
+ <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
|
|
|
+ <if test="name != null and name != ''"> and p.name LIKE concat('%',#{name},'%')</if>
|
|
|
+ <if test="shopName != null and shopName != ''"> and s.name LIKE concat('%',#{shopName},'%')</if>
|
|
|
+ </where>
|
|
|
+ group by cm_distribution_product.id
|
|
|
+ order by cm_distribution_product.addTime desc
|
|
|
+ limit 0,1
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="findTeamProductPage" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct" resultMap="CmDistributionProductResult">
|
|
|
+ select
|
|
|
+ cm_distribution_product.id,
|
|
|
+ cm_distribution_product.productId,
|
|
|
+ cdtp.validFlag,
|
|
|
+ cm_distribution_product.includedTax,
|
|
|
+ cm_distribution_product.invoiceType,
|
|
|
+ ifnull(cm_distribution_product.clubTaxPoint,0) AS clubTaxPoint,
|
|
|
+ ifnull(cm_distribution_product.shopTaxPoint,0) AS shopTaxPoint,
|
|
|
+ ifnull(cm_distribution_product.commission,0) AS commission,
|
|
|
+ p.name,
|
|
|
+ p.mainImage,
|
|
|
+ p.shopID,
|
|
|
+ s.name AS shopName,
|
|
|
+ cm_distribution_product.addTime,
|
|
|
+ (select cds.skuId from cm_distribution_sku cds where cds.productId = p.productID order by cds.price asc limit 1) AS skuId,
|
|
|
+ ifnull((select cds.price from cm_distribution_sku cds where cds.productId = p.productID order by cds.price asc limit 1),0) AS price,
|
|
|
+ cdtp.distributionId
|
|
|
+ from cm_distribution_team_product AS cdtp
|
|
|
+ LEFT JOIN cm_distribution AS cm_distribution on cdtp.distributionId=cm_distribution.id
|
|
|
+ LEFT JOIN cm_distribution_product AS cm_distribution_product on cdtp.productId=cm_distribution_product.productId
|
|
|
+ LEFT JOIN product p ON cm_distribution_product.productId = p.productID
|
|
|
+ LEFT JOIN shop s on p.shopID = s.shopID
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_product.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="productId != null "> and cm_distribution_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cdtp.validFlag = #{validFlag}</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">
|
|
|
+ and cm_distribution_product.invoiceType
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')==-1">
|
|
|
+ = #{invoiceType}
|
|
|
+ </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
|
|
|
+ <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
|
|
|
+ #{typeIn}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
|
|
|
+ <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
|
|
|
+ <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
|
|
|
+ <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
|
|
|
+ <if test="name != null and name != ''"> and p.name LIKE concat('%',#{name},'%')</if>
|
|
|
+ <if test="shopName != null and shopName != ''"> and s.name LIKE concat('%',#{shopName},'%')</if>
|
|
|
+ <if test="distributionId != null "> and cdtp.distributionId = #{distributionId}</if>
|
|
|
+ </where>
|
|
|
+ group by cm_distribution_product.id
|
|
|
+ order by cm_distribution_product.addTime desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getCmDistributionProductList" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct" resultMap="CmDistributionProductResult">
|
|
|
+ <include refid="selectCmDistributionProductVo"/>
|
|
|
+ from cm_distribution_product AS cm_distribution_product
|
|
|
+ LEFT JOIN product p ON cm_distribution_product.productId = p.productID
|
|
|
+ LEFT JOIN shop s on p.shopID = s.shopID
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_product.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="productId != null "> and cm_distribution_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">
|
|
|
+ and cm_distribution_product.invoiceType
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')==-1">
|
|
|
+ = #{invoiceType}
|
|
|
+ </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
|
|
|
+ <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
|
|
|
+ #{typeIn}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
|
|
|
+ <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
|
|
|
+ <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
|
|
|
+ <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
|
|
|
+ <if test="name != null and name != ''"> and p.name LIKE concat('%',#{name},'%')</if>
|
|
|
+ <if test="shopName != null and shopName != ''"> and s.name LIKE concat('%',#{shopName},'%')</if>
|
|
|
+ </where>
|
|
|
+ group by cm_distribution_product.id
|
|
|
+ order by cm_distribution_product.addTime desc
|
|
|
+ </select>
|
|
|
+ <select id="getCmDistributionTeamProductList" parameterType="com.caimei365.commodity.model.po.CmDistributionTeamProduct" resultType="com.caimei365.commodity.model.po.CmDistributionTeamProduct">
|
|
|
+ SELECT
|
|
|
+ cm_distribution_team_product.id,
|
|
|
+ cm_distribution_team_product.distributionId,
|
|
|
+ cm_distribution_team_product.productId,
|
|
|
+ cm_distribution_team_product.validFlag,
|
|
|
+ p.name,
|
|
|
+ p.mainImage,
|
|
|
+ (select price from cm_distribution_sku cs where cs.productId = p.productId order by price asc limit 1) as price,
|
|
|
+ p.shopID,
|
|
|
+ s.name AS shopName
|
|
|
+ from cm_distribution_team_product AS cm_distribution_team_product
|
|
|
+ left join cm_distribution_product AS cm_distribution_product on cm_distribution_product.productId=cm_distribution_team_product.productId
|
|
|
+ LEFT JOIN product p ON cm_distribution_product.productId = p.productID
|
|
|
+ LEFT JOIN shop s on p.shopID = s.shopID
|
|
|
+ <where> cm_distribution_team_product.validFlag = 1 and cm_distribution_product.validFlag = 1
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_team_product.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="distributionId != null "> and cm_distribution_team_product.distributionId = #{distributionId}</if>
|
|
|
+ <if test="productId != null "> and cm_distribution_team_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cm_distribution_team_product.validFlag = #{validFlag}</if>
|
|
|
+ <if test="name != null and name != ''"> and p.name like concat('%', #{name}, '%')</if>
|
|
|
+ </where>
|
|
|
+ group by cm_distribution_team_product.id
|
|
|
+ </select>
|
|
|
+ <select id="getProductArchiveList" resultType="com.caimei365.commodity.model.vo.ArchiveVo">
|
|
|
+ select cpa.id AS "archiveId",
|
|
|
+ cpa.productId AS "productId",
|
|
|
+ if(cpa.productId is not null, p.name, cpa.productName) AS "productName",
|
|
|
+ if(cpa.productId is not null, s.name, cpa.shopName) AS "shopName",
|
|
|
+ if(cpa.productId is not null, p.mainImage, cpa.productImage) AS "productImage",
|
|
|
+ if(cpa.productId is not null, ifnull(p.commodityType, cpa.productType),cpa.productType) AS "productType",
|
|
|
+ if(cpa.productId is not null,1,2) AS "redirectType"
|
|
|
+ from cm_distribution_team_product AS cm_distribution_team_product
|
|
|
+ left join cm_product_archive cpa on cpa.productId = cm_distribution_team_product.productID
|
|
|
+ left join product p on cm_distribution_team_product.productId = p.productID
|
|
|
+ left join shop s on p.shopID = s.shopID
|
|
|
+ <where>
|
|
|
+ cpa.productId = cm_distribution_team_product.productID
|
|
|
+ and cm_distribution_team_product.distributionId=#{id}
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ and cpa.productName LIKE concat('%', #{productName}, '%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by cpa.addTime desc
|
|
|
+ </select>
|
|
|
+ <select id="getCmDistributionProductCount" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct" resultType="int">
|
|
|
+ select count(1)
|
|
|
+ from cm_distribution_product AS cm_distribution_product
|
|
|
+ LEFT JOIN product p ON cm_distribution_product.productId = p.productID
|
|
|
+ LEFT JOIN shop s on p.shopID = s.shopID
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_product.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="productId != null "> and cm_distribution_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">
|
|
|
+ and cm_distribution_product.invoiceType
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')==-1">
|
|
|
+ = #{invoiceType}
|
|
|
+ </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
|
|
|
+ <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
|
|
|
+ #{typeIn}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
|
|
|
+ <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
|
|
|
+ <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
|
|
|
+ <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
|
|
|
+ </where>
|
|
|
+ group by cm_distribution_product.id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCmDistributionTeamProductCount" parameterType="CmDistributionTeamProduct" resultType="int">
|
|
|
+ select count(1)
|
|
|
+ from cm_distribution_team_product AS cm_distribution_team_product
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_team_product.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="distributionId != null "> and cm_distribution_team_product.distributionId = #{distributionId}</if>
|
|
|
+ <if test="productId != null "> and cm_distribution_team_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cm_distribution_team_product.validFlag = #{validFlag}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getCmDistributionProductById" parameterType="String" resultMap="CmDistributionProductResult">
|
|
|
+ <include refid="selectCmDistributionProductVo"/>
|
|
|
+ from cm_distribution_product AS cm_distribution_product
|
|
|
+ LEFT JOIN product p ON cm_distribution_product.productId = p.productID
|
|
|
+ LEFT JOIN shop s on p.shopID = s.shopID
|
|
|
+ where cm_distribution_product.id = #{id} group by cm_distribution_product.id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getByIds" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct" resultType="Int">
|
|
|
+ select cm_distribution_product.id
|
|
|
+ from cm_distribution_product AS cm_distribution_product
|
|
|
+ LEFT JOIN product p ON cm_distribution_product.productId = p.productID
|
|
|
+ LEFT JOIN shop s on p.shopID = s.shopID
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_product.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="productId != null "> and cm_distribution_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">
|
|
|
+ and cm_distribution_product.invoiceType
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')==-1">
|
|
|
+ = #{invoiceType}
|
|
|
+ </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
|
|
|
+ <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
|
|
|
+ #{typeIn}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
|
|
|
+ <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
|
|
|
+ <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
|
|
|
+ <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
|
|
|
+ </where>
|
|
|
+ group by cm_distribution_product.id
|
|
|
+ </select>
|
|
|
+ <select id="getByProductIds" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct" resultType="Int">
|
|
|
+ select cm_distribution_product.productId
|
|
|
+ from cm_distribution_product AS cm_distribution_product
|
|
|
+ LEFT JOIN product p ON cm_distribution_product.productId = p.productID
|
|
|
+ LEFT JOIN shop s on p.shopID = s.shopID
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_product.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="productId != null "> and cm_distribution_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">
|
|
|
+ and cm_distribution_product.invoiceType
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')==-1">
|
|
|
+ = #{invoiceType}
|
|
|
+ </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
|
|
|
+ <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
|
|
|
+ #{typeIn}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
|
|
|
+ <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
|
|
|
+ <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
|
|
|
+ <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
|
|
|
+ </where>
|
|
|
+ group by cm_distribution_product.id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getByTeamProductIds" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct" resultType="Int">
|
|
|
+ select cm_distribution_team_product.productId
|
|
|
+ from cm_distribution_team_product AS cm_distribution_team_product
|
|
|
+ <where>
|
|
|
+ <if test="distributionId != null "> and cm_distribution_team_product.distributionId = #{distributionId}</if>
|
|
|
+ </where>
|
|
|
+ group by cm_distribution_team_product.id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getById" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct" resultType="String">
|
|
|
+ select id
|
|
|
+ from cm_distribution_product AS cm_distribution_product
|
|
|
+ LEFT JOIN product p ON cm_distribution_product.productId = p.productID
|
|
|
+ LEFT JOIN shop s on p.shopID = s.shopID
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_product.id
|
|
|
+ <if test="id.toString().toUpperCase().indexOf('=')==-1">
|
|
|
+ = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="id.toString().toUpperCase().indexOf('=')!=-1">
|
|
|
+ <if test="id.toString().toUpperCase().indexOf('NOT')!=-1"> not </if>
|
|
|
+ <if test="id.toString().toUpperCase().indexOf('IN')!=-1"> in </if>
|
|
|
+ <foreach item="idIn" collection="id.toString().substring(id.toString().toUpperCase().indexOf('=')+1,id.toString().length()).trim().split(',')" open="(" separator="," close=")">
|
|
|
+ #{idIn}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="productId != null "> and cm_distribution_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">
|
|
|
+ and cm_distribution_product.invoiceType
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')==-1">
|
|
|
+ = #{invoiceType}
|
|
|
+ </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
|
|
|
+ <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
|
|
|
+ #{typeIn}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
|
|
|
+ <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
|
|
|
+ <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
|
|
|
+ <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
|
|
|
+ </where>
|
|
|
+ group by cm_distribution_product.id
|
|
|
+ limit 0,1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="addCmDistributionProduct" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into cm_distribution_product
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null and id != ''">id,</if>
|
|
|
+ <if test="productId != null">productId,</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''">validFlag,</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''">includedTax,</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">invoiceType,</if>
|
|
|
+ <if test="clubTaxPoint != null">clubTaxPoint,</if>
|
|
|
+ <if test="shopTaxPoint != null">shopTaxPoint,</if>
|
|
|
+ <if test="commission != null">commission,</if>
|
|
|
+ <if test="addTime != null">addTime,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null and id != ''">#{id},</if>
|
|
|
+ <if test="productId != null">#{productId},</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''">#{validFlag},</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''">#{includedTax},</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">#{invoiceType},</if>
|
|
|
+ <if test="clubTaxPoint != null">#{clubTaxPoint},</if>
|
|
|
+ <if test="shopTaxPoint != null">#{shopTaxPoint},</if>
|
|
|
+ <if test="commission != null">#{commission},</if>
|
|
|
+ <if test="addTime != null">#{addTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="addCmDistributionTeamProduct" parameterType="com.caimei365.commodity.model.po.CmDistributionTeamProduct" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into cm_distribution_team_product
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null and id != ''">id,</if>
|
|
|
+ <if test="distributionId != null">distributionId,</if>
|
|
|
+ <if test="productId != null">productId,</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''">validFlag,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null and id != ''">#{id},</if>
|
|
|
+ <if test="distributionId != null">#{distributionId},</if>
|
|
|
+ <if test="productId != null">#{productId},</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''">#{validFlag},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateCmDistributionProduct" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct">
|
|
|
+ update cm_distribution_product
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="productId != null">productId = #{productId},</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''">validFlag = #{validFlag},</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''">includedTax = #{includedTax},</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">invoiceType = #{invoiceType},</if>
|
|
|
+ <if test="clubTaxPoint != null">clubTaxPoint = #{clubTaxPoint},</if>
|
|
|
+ <if test="shopTaxPoint != null">shopTaxPoint = #{shopTaxPoint},</if>
|
|
|
+ <if test="commission != null">commission = #{commission},</if>
|
|
|
+ <if test="addTime != null">addTime = #{addTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <delete id="delCmDistributionProductById" parameterType="String">
|
|
|
+ delete
|
|
|
+ from cm_distribution_product where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="delCmDistributionProduct" parameterType="com.caimei365.commodity.model.po.CmDistributionProduct">
|
|
|
+ delete
|
|
|
+ from cm_distribution_product AS cm_distribution_product
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_product.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="productId != null "> and cm_distribution_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
|
|
|
+ <if test="includedTax != null and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">
|
|
|
+ and cm_distribution_product.invoiceType
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')==-1">
|
|
|
+ = #{invoiceType}
|
|
|
+ </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
|
|
|
+ <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
|
|
|
+ <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
|
|
|
+ #{typeIn}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
|
|
|
+ <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
|
|
|
+ <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
|
|
|
+ <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
|
|
|
+ </where>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="delCmDistributionProductByIds" parameterType="String">
|
|
|
+ delete from cm_distribution_product where id in
|
|
|
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="delCmDistributionTeamProduct" parameterType="com.caimei365.commodity.model.po.CmDistributionTeamProduct">
|
|
|
+ delete
|
|
|
+ from cm_distribution_team_product AS cm_distribution_team_product
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and cm_distribution_team_product.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="distributionId != null "> and cm_distribution_team_product.distributionId = #{distributionId}</if>
|
|
|
+ <if test="productId != null "> and cm_distribution_team_product.productId = #{productId}</if>
|
|
|
+ <if test="validFlag != null and validFlag != ''"> and cm_distribution_team_product.validFlag = #{validFlag}</if>
|
|
|
+ </where>
|
|
|
+ </delete>
|
|
|
+ <update id="updateCmDistributionTeamProduct" parameterType="com.caimei365.commodity.model.po.CmDistributionTeamProduct">
|
|
|
+ update cm_distribution_team_product
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="validFlag != null and validFlag != ''">validFlag = #{validFlag},</if>
|
|
|
+ </trim>
|
|
|
+ where distributionId = #{distributionId} and productId = #{productId}
|
|
|
+ </update>
|
|
|
+</mapper>
|