|
@@ -0,0 +1,654 @@
|
|
|
+<?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.caimei.modules.product.dao.CmDistributionProductMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.caimei.modules.product.entity.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.caimei.modules.product.entity.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="findList" parameterType="com.caimei.modules.product.entity.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="findTeamProductPage" parameterType="com.caimei.modules.product.entity.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 limit 1) AS skuId,
|
|
|
+ ifnull((select cds.price from cm_distribution_sku cds where cds.productId = p.productID 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>
|
|
|
+ cm_distribution_product.validFlag=1
|
|
|
+ <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="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
|
|
|
+ SELECT
|
|
|
+ a.*,s.name AS "shopName"
|
|
|
+ FROM product a
|
|
|
+ left join cm_organize_product_info copi on copi.productId = a.productID
|
|
|
+ LEFT JOIN shop s on s.shopID = a.shopID
|
|
|
+ <where>
|
|
|
+ copi.validFlag=2
|
|
|
+ <if test="productID != null">
|
|
|
+ AND a.productID = #{productID}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND a.name LIKE concat('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="shopName != null and shopName != ''">
|
|
|
+ AND s.name LIKE concat('%',#{shopName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="ids != null and ids.size() > 0 ">
|
|
|
+ AND a.productID NOT IN
|
|
|
+ <foreach collection="ids" open="(" close=")" item="id" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by a.productID
|
|
|
+ <choose>
|
|
|
+ <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
+ ORDER BY ${page.orderBy}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ order by a.productID
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findCmDistributionAllProduct" resultType="com.caimei.modules.product.entity.Product">
|
|
|
+ SELECT
|
|
|
+ p.*,s.name AS "shopName"
|
|
|
+ from cm_distribution_product AS cm_distribution_product
|
|
|
+ LEFT JOIN product p ON cm_distribution_product.productId = p.productID
|
|
|
+ LEFT JOIN shop s on s.shopID = p.shopID
|
|
|
+ <where>
|
|
|
+ cm_distribution_product.validFlag=1
|
|
|
+ <if test="productID != null">
|
|
|
+ AND p.productID = #{productID}
|
|
|
+ </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="ids != null and ids.size() > 0 ">
|
|
|
+ AND p.productID NOT IN
|
|
|
+ <foreach collection="ids" open="(" close=")" item="id" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by p.productID
|
|
|
+ <choose>
|
|
|
+ <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
+ ORDER BY ${page.orderBy}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ order by p.productID
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCmDistributionProductList" parameterType="com.caimei.modules.product.entity.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="getCmDistributionProductCount" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" resultType="String">
|
|
|
+ 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="get" 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="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.caimei.modules.product.entity.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.caimei.modules.product.entity.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.caimei.modules.product.entity.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.caimei.modules.product.entity.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.caimei.modules.product.entity.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.caimei.modules.product.entity.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.caimei.modules.product.entity.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.caimei.modules.product.entity.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.caimei.modules.product.entity.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.caimei.modules.product.entity.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>
|