|
@@ -2,8 +2,8 @@
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.caimei.modules.weisha.dao.CmOrganizeProductDao">
|
|
<mapper namespace="com.caimei.modules.weisha.dao.CmOrganizeProductDao">
|
|
|
|
|
|
- <sql id="cmOrganizeProductColumns">
|
|
|
|
- a.id AS "id",
|
|
|
|
|
|
+ <sql id="cmOrganizeProductColumns">
|
|
|
|
+ a.id AS "id",
|
|
a.organizeId AS "organizeId",
|
|
a.organizeId AS "organizeId",
|
|
a.productId AS "productId",
|
|
a.productId AS "productId",
|
|
a.ladderPriceFlag AS "ladderPriceFlag",
|
|
a.ladderPriceFlag AS "ladderPriceFlag",
|
|
@@ -21,375 +21,261 @@
|
|
a.delFlag AS "delFlag",
|
|
a.delFlag AS "delFlag",
|
|
p.name AS "productName",
|
|
p.name AS "productName",
|
|
p.mainImage AS "productImage",
|
|
p.mainImage AS "productImage",
|
|
-# p.unit,
|
|
|
|
s.name AS "shopName"
|
|
s.name AS "shopName"
|
|
- </sql>
|
|
|
|
|
|
+ </sql>
|
|
|
|
|
|
- <sql id="cmOrganizeProductJoins">
|
|
|
|
- left join product p on a.productId = p.productID
|
|
|
|
|
|
+ <sql id="cmOrganizeProductJoins">
|
|
|
|
+ left join product p on a.productId = p.productID
|
|
left join shop s on p.shopID = s.shopID
|
|
left join shop s on p.shopID = s.shopID
|
|
- </sql>
|
|
|
|
|
|
+ </sql>
|
|
|
|
|
|
- <select id="get" resultType="CmOrganizeProduct">
|
|
|
|
- SELECT
|
|
|
|
- <include refid="cmOrganizeProductColumns"/>
|
|
|
|
- FROM cm_organize_product a
|
|
|
|
- <include refid="cmOrganizeProductJoins"/>
|
|
|
|
- WHERE a.id = #{id}
|
|
|
|
- </select>
|
|
|
|
|
|
+ <select id="getOrganizeProductList" resultType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
|
|
|
|
+ SELECT
|
|
|
|
+ cmop.id,
|
|
|
|
+ cmop.productID,
|
|
|
|
+ p.name as productName,
|
|
|
|
+ p.mainImage as productImage,
|
|
|
|
+ s.name as shopName,
|
|
|
|
+ cmop.validFlag as status,
|
|
|
|
+ p.includedTax,
|
|
|
|
+ p.invoiceType,
|
|
|
|
+ cmop.addTime,
|
|
|
|
+ cmps.minBuyNumber
|
|
|
|
+ FROM cm_mall_organize_products cmop
|
|
|
|
+ LEFT JOIN product p ON p.productId = cmop.productId
|
|
|
|
+ LEFT JOIN shop s ON s.shopID = p.shopID
|
|
|
|
+ LEFT JOIN cm_mall_product_sku cmps ON cmop.productID=cmps.productId
|
|
|
|
+ <where>
|
|
|
|
+ cmop.delFlag = 0
|
|
|
|
+ <if test="productId != null and productId != ''">
|
|
|
|
+ AND cmop.productId = #{productId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
|
+ and p.name like concat('%',#{productName},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="shopName != null and shopName != ''">
|
|
|
|
+ and s.name like concat('%',#{shopName},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="includedTax != null">
|
|
|
|
+ AND p.includedTax = #{includedTax}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null and status != ''">
|
|
|
|
+ AND cmop.validFlag = #{status}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="invoiceType != null">
|
|
|
|
+ AND p.invoiceType = #{invoiceType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="organizeId != null">
|
|
|
|
+ AND cmop.organizeID = #{organizeId}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY cmop.id
|
|
|
|
+ order by cmop.addTime desc
|
|
|
|
+ </select>
|
|
|
|
|
|
- <select id="findList" resultType="CmOrganizeProduct">
|
|
|
|
- SELECT
|
|
|
|
- <include refid="cmOrganizeProductColumns"/>
|
|
|
|
- FROM cm_organize_product a
|
|
|
|
- <include refid="cmOrganizeProductJoins"/>
|
|
|
|
- <where>
|
|
|
|
- a.delFlag = 0
|
|
|
|
- and p.productCategory = 1
|
|
|
|
- <if test="id != null and id != ''">
|
|
|
|
- AND a.id = #{id}
|
|
|
|
- </if>
|
|
|
|
- <if test="productName != null and productName != ''">
|
|
|
|
- and p.name like concat('%',#{productName},'%')
|
|
|
|
- </if>
|
|
|
|
- <if test="shopName != null and shopName != ''">
|
|
|
|
- and s.name like concat('%',#{shopName},'%')
|
|
|
|
- </if>
|
|
|
|
- <if test="includedTax != null">
|
|
|
|
- AND a.includedTax = #{includedTax}
|
|
|
|
- </if>
|
|
|
|
- <if test="invoiceType != null">
|
|
|
|
- AND a.invoiceType = #{invoiceType}
|
|
|
|
- </if>
|
|
|
|
- <if test="status != null">
|
|
|
|
- AND a.status = #{status}
|
|
|
|
- </if>
|
|
|
|
- <if test="organizeId != null">
|
|
|
|
- AND a.organizeId = #{organizeId}
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
- order by a.addTime desc
|
|
|
|
- </select>
|
|
|
|
|
|
+ <select id="getOrganizeSku" resultType="com.caimei.modules.weisha.entity.CmOrganizeSku">
|
|
|
|
+ SELECT
|
|
|
|
+ cmps.id,
|
|
|
|
+ cmps.productId,
|
|
|
|
+ cmps.id,
|
|
|
|
+ cmps.skuId,
|
|
|
|
+ cmps.minBuyNumber,
|
|
|
|
+ cmps.price,
|
|
|
|
+ cs.unit,
|
|
|
|
+ cs.price as clubPrice,
|
|
|
|
+ cs.costCheckFlag as costCheckFlag,
|
|
|
|
+ cs.costPrice as costPrice,
|
|
|
|
+ cs.costProportional as costProportional,
|
|
|
|
+ cs.minBuyNumber AS cmMinBuyNumber,
|
|
|
|
+ cmps.organizePercent,
|
|
|
|
+ cmps.shopPercent,
|
|
|
|
+ cmps.cmPercent
|
|
|
|
+ FROM cm_mall_product_sku cmps
|
|
|
|
+ LEFT JOIN cm_sku cs ON cmps.skuId = cs.skuId
|
|
|
|
+ <where>
|
|
|
|
+ <if test="productIds.size() > 0">
|
|
|
|
+ cmps.productId in
|
|
|
|
+ <foreach collection="productIds" item="productId" open="(" separator="," close=")">
|
|
|
|
+ #{productId}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
|
|
- <select id="findAllList" resultType="CmOrganizeProduct">
|
|
|
|
- SELECT
|
|
|
|
- <include refid="cmOrganizeProductColumns"/>
|
|
|
|
- FROM cm_organize_product a
|
|
|
|
- <include refid="cmOrganizeProductJoins"/>
|
|
|
|
- <where>
|
|
|
|
|
|
+ <update id="updateproduct">
|
|
|
|
+ update cm_mall_organize_products
|
|
|
|
+ set validFlag = #{validFlag}
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </update>
|
|
|
|
|
|
- </where>
|
|
|
|
- <choose>
|
|
|
|
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
|
- ORDER BY ${page.orderBy}
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- </select>
|
|
|
|
- <select id="getOrganizeProductList" resultType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
|
|
|
|
- SELECT
|
|
|
|
- cmop.id,
|
|
|
|
- cmop.productID,
|
|
|
|
- p.name as productName,
|
|
|
|
- p.mainImage as productImage,
|
|
|
|
- s.name as shopName,
|
|
|
|
- cmop.validFlag as status,
|
|
|
|
- p.includedTax,
|
|
|
|
- p.invoiceType,
|
|
|
|
- cmop.addTime,
|
|
|
|
- cmps.minBuyNumber
|
|
|
|
- FROM cm_mall_organize_products cmop
|
|
|
|
- LEFT JOIN product p ON p.productId = cmop.productId
|
|
|
|
- LEFT JOIN shop s ON s.shopID = p.shopID
|
|
|
|
- LEFT JOIN cm_mall_product_sku cmps ON cmop.productID=cmps.productId
|
|
|
|
- <where>
|
|
|
|
- cmop.delFlag = 0
|
|
|
|
- <if test="productId != null and productId != ''">
|
|
|
|
- AND cmop.productId = #{productId}
|
|
|
|
- </if>
|
|
|
|
- <if test="productName != null and productName != ''">
|
|
|
|
- and p.name like concat('%',#{productName},'%')
|
|
|
|
- </if>
|
|
|
|
- <if test="shopName != null and shopName != ''">
|
|
|
|
- and s.name like concat('%',#{shopName},'%')
|
|
|
|
- </if>
|
|
|
|
- <if test="includedTax != null">
|
|
|
|
- AND p.includedTax = #{includedTax}
|
|
|
|
- </if>
|
|
|
|
- <if test="status != null and status != ''">
|
|
|
|
- AND cmop.validFlag = #{status}
|
|
|
|
- </if>
|
|
|
|
- <if test="invoiceType != null">
|
|
|
|
- AND p.invoiceType = #{invoiceType}
|
|
|
|
- </if>
|
|
|
|
- <if test="organizeId != null">
|
|
|
|
- AND cmop.organizeID = #{organizeId}
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
- GROUP BY cmop.id
|
|
|
|
- order by cmop.addTime desc
|
|
|
|
- </select>
|
|
|
|
- <select id="getOrganizeSku" resultType="com.caimei.modules.weisha.entity.CmOrganizeSku">
|
|
|
|
- SELECT
|
|
|
|
- cmps.id,
|
|
|
|
- cmps.productId,
|
|
|
|
- cmps.id,
|
|
|
|
- cmps.skuId,
|
|
|
|
- cmps.minBuyNumber,
|
|
|
|
- cmps.price,
|
|
|
|
- cs.unit,
|
|
|
|
- cs.price as clubPrice,
|
|
|
|
- cs.costCheckFlag as costCheckFlag,
|
|
|
|
- cs.costPrice as costPrice,
|
|
|
|
- cs.costProportional as costProportional,
|
|
|
|
- cs.minBuyNumber AS cmMinBuyNumber,
|
|
|
|
- cmps.organizePercent,
|
|
|
|
- cmps.shopPercent,
|
|
|
|
- cmps.cmPercent
|
|
|
|
- FROM cm_mall_product_sku cmps
|
|
|
|
- LEFT JOIN cm_sku cs ON cmps.skuId = cs.skuId
|
|
|
|
- <where>
|
|
|
|
- <if test="productIds.size() > 0">
|
|
|
|
- cmps.productId in
|
|
|
|
- <foreach collection="productIds" item="productId" open="(" separator="," close=")">
|
|
|
|
- #{productId}
|
|
|
|
- </foreach>
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
- </select>
|
|
|
|
- <update id="updateproduct">
|
|
|
|
- update cm_mall_organize_products
|
|
|
|
- set validFlag = #{validFlag}
|
|
|
|
- where id = #{id}
|
|
|
|
- </update>
|
|
|
|
- <select id="findProductList" resultType="com.caimei.modules.product.entity.Product">
|
|
|
|
- select p.productID, p.mainImage, p.name,
|
|
|
|
- s.name as shopName, IF(cmop.productId is not null, 0, 1) as validFlag,k.price
|
|
|
|
- from product p
|
|
|
|
- left join cm_mall_organize_products cmop on p.productID = cmop.productId and cmop.organizeId = #{organizeId} and cmop.delFlag = 0
|
|
|
|
- left join shop s on p.shopID = s.shopID
|
|
|
|
- left join cm_sku k on p.productID = k.productId
|
|
|
|
- <where>
|
|
|
|
- p.productCategory = 1 AND p.validFlag not in ( 0,1,8 ) and s.shopType != 2 and cmop.productId is null
|
|
|
|
- AND p.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
|
|
|
|
- AND p.productID NOT IN (6060, 6061, 6062, 6063, 6064,6065, 6066, 6067, 6068, 6069)
|
|
|
|
- <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>
|
|
|
|
- </where>
|
|
|
|
- GROUP BY p.productID
|
|
|
|
- order by price asc
|
|
|
|
- </select>
|
|
|
|
- <select id="findProductByProductId" resultType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
|
|
|
|
- select productID as productId, # ladderPriceFlag, price as price,
|
|
|
|
- ifnull(includedTax,2) as includedTax,invoiceType,taxPoint as clubTaxPoint,supplierTaxPoint as shopTaxPoint # minBuyNumber,
|
|
|
|
- # costCheckFlag as costType,
|
|
|
|
- # costPrice,costProportional
|
|
|
|
- from product
|
|
|
|
- where productID = #{productId}
|
|
|
|
- </select>
|
|
|
|
- <select id="findLadderPrice" resultType="com.caimei.modules.weisha.entity.OrganizeProductLadderPrice">
|
|
|
|
- select * from organize_product_ladder_price where productId = #{productId}
|
|
|
|
- </select>
|
|
|
|
- <select id="findFormerLadderPriceList"
|
|
|
|
- resultType="com.caimei.modules.weisha.entity.OrganizeProductLadderPrice">
|
|
|
|
- select ladderNum,buyNum,buyPrice from product_ladder_price where productId = #{productId}
|
|
|
|
- </select>
|
|
|
|
- <select id="getOrganizeInfo" resultType="com.caimei.modules.weisha.entity.CmMallOrganize">
|
|
|
|
- select a.id AS "id",
|
|
|
|
- a.organizeName AS "organizeName",
|
|
|
|
- a.organizeLinkName AS "organizeLinkName",
|
|
|
|
- a.mobile AS "mobile",
|
|
|
|
- a.status AS "status",
|
|
|
|
- a.contactNumber AS "contactNumber",
|
|
|
|
- a.systemName AS "systemName",
|
|
|
|
- a.systemImage AS "systemImage",
|
|
|
|
- a.introduction AS "introduction",
|
|
|
|
- a.afterSale AS "afterSale",
|
|
|
|
- a.shoppingNotes AS "shoppingNotes",
|
|
|
|
- a.updateTime AS "updateTime",
|
|
|
|
- a.addTime AS "addTime",
|
|
|
|
- a.delFlag AS "delFlag"
|
|
|
|
- from cm_mall_organize a
|
|
|
|
- where a.id = #{id}
|
|
|
|
- </select>
|
|
|
|
- <select id="getShopInfo" resultType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
|
|
|
|
- SELECT
|
|
|
|
- p.productId,
|
|
|
|
- p.name AS productName,
|
|
|
|
- s.name AS shopName
|
|
|
|
- FROM product p
|
|
|
|
- LEFT JOIN shop s ON p.shopId = s.shopId
|
|
|
|
- <where>
|
|
|
|
- <if test="productIds.size()>0">
|
|
|
|
- productId in
|
|
|
|
- <foreach collection="productIds" item="productId" open="(" separator="," close=")">
|
|
|
|
- #{productId}
|
|
|
|
- </foreach>
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
- </select>
|
|
|
|
- <select id="getSkuInfo" resultType="com.caimei.modules.product.entity.CmSku">
|
|
|
|
- SELECT
|
|
|
|
- skuId,
|
|
|
|
- productId,
|
|
|
|
- normalPrice,
|
|
|
|
- price,
|
|
|
|
- costPrice,
|
|
|
|
- ladderPriceFlag,
|
|
|
|
- minBuyNumber
|
|
|
|
- FROM cm_sku
|
|
|
|
- where productId = #{productId}
|
|
|
|
- order by normalPrice
|
|
|
|
- </select>
|
|
|
|
- <insert id="insertMallProduct" parameterType="CmOrganizeProduct" keyProperty="id" useGeneratedKeys="true">
|
|
|
|
- INSERT INTO cm_mall_organize_products (organizeID, productID, normalPrice, costPrice, ladderPriceFlag, retailPrice, minBuyNumber, validFlag, ADDTIME, updateTime, delFlag)
|
|
|
|
- VALUES(#{organizeId}, #{productId}, #{normalPrice}, #{costPrice}, #{ladderPriceFlag}, #{retailPrice}, #{minBuyNumber}, #{status},#{addTime}, #{updateTime}, #{delFlag})
|
|
|
|
- </insert>
|
|
|
|
- <insert id="insertMallSku">
|
|
|
|
- INSERT INTO cm_mall_product_sku(skuId, productId, mallProductId, minBuyNumber, price)
|
|
|
|
- VALUES (#{skuId}, #{productId}, #{mallProductId}, #{minBuyNumber}, #{price})
|
|
|
|
- </insert>
|
|
|
|
- <update id="updateMallProduct">
|
|
|
|
- update cm_mall_organize_products
|
|
|
|
- <set>
|
|
|
|
- <if test="retailPrice != null and retailPrice != ''">
|
|
|
|
- retailPrice = #{retailPrice},
|
|
|
|
- </if>
|
|
|
|
- <if test="minBuyNumber != null and minBuyNumber != ''">
|
|
|
|
- minBuyNumber = #{minBuyNumber}
|
|
|
|
- </if>
|
|
|
|
- </set>
|
|
|
|
- where id =#{id}
|
|
|
|
- </update>
|
|
|
|
- <update id="updateMallProductSku">
|
|
|
|
- update cm_mall_product_sku
|
|
|
|
- <set>
|
|
|
|
- <if test="price != null and price != ''">
|
|
|
|
- price = #{price},
|
|
|
|
- </if>
|
|
|
|
- <if test="minBuyNumber != null and minBuyNumber != ''">
|
|
|
|
- minBuyNumber = #{minBuyNumber},
|
|
|
|
- </if>
|
|
|
|
- <if test="organizePercent != null and organizePercent != ''">
|
|
|
|
- organizePercent = #{organizePercent},
|
|
|
|
- </if>
|
|
|
|
- <if test="shopPercent != null and shopPercent != ''">
|
|
|
|
- shopPercent = #{shopPercent},
|
|
|
|
- </if>
|
|
|
|
- <if test="cmPercent != null and cmPercent != ''">
|
|
|
|
- cmPercent = #{cmPercent}
|
|
|
|
- </if>
|
|
|
|
- </set>
|
|
|
|
- where id =#{id}
|
|
|
|
- </update>
|
|
|
|
- <select id="getProductInfo" resultType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
|
|
|
|
- SELECT cmop.id,
|
|
|
|
- cmop.organizeID AS organizeId,
|
|
|
|
- p.productID AS productId,
|
|
|
|
- p.mainImage AS productImage,
|
|
|
|
- p.name AS productName,
|
|
|
|
- s.name AS shopName,
|
|
|
|
- IF(cmop.productId IS NOT NULL, 0, 1) AS validFlag,
|
|
|
|
- p.includedTax,
|
|
|
|
- p.invoiceType,
|
|
|
|
- p.taxPoint,
|
|
|
|
- p.supplierTaxPoint
|
|
|
|
- FROM product p
|
|
|
|
- LEFT JOIN cm_mall_organize_products cmop ON p.productID = cmop.productId
|
|
|
|
- LEFT JOIN shop s ON p.shopID = s.shopID
|
|
|
|
- WHERE p.productCategory = 1 AND cmop.id = #{id}
|
|
|
|
- </select>
|
|
|
|
- <update id="deleteProduct">
|
|
|
|
- update cm_mall_organize_products
|
|
|
|
- set delFlag = 1
|
|
|
|
- where id = #{id}
|
|
|
|
- </update>
|
|
|
|
- <insert id="insert" parameterType="CmOrganizeProduct" keyProperty="id" useGeneratedKeys="true">
|
|
|
|
- INSERT INTO cm_organize_product(
|
|
|
|
- organizeId,
|
|
|
|
- productId,
|
|
|
|
- ladderPriceFlag,
|
|
|
|
- price,
|
|
|
|
- includedTax,
|
|
|
|
- invoiceType,
|
|
|
|
- clubTaxPoint,
|
|
|
|
- shopTaxPoint,
|
|
|
|
- minBuyNumber,
|
|
|
|
- costType,
|
|
|
|
- costPrice,
|
|
|
|
- costProportional,
|
|
|
|
- addTime
|
|
|
|
- ) VALUES (
|
|
|
|
- #{organizeId},
|
|
|
|
- #{productId},
|
|
|
|
- #{ladderPriceFlag},
|
|
|
|
- #{price},
|
|
|
|
- #{includedTax},
|
|
|
|
- #{invoiceType},
|
|
|
|
- #{clubTaxPoint},
|
|
|
|
- #{shopTaxPoint},
|
|
|
|
- #{minBuyNumber},
|
|
|
|
- #{costType},
|
|
|
|
- #{costPrice},
|
|
|
|
- #{costProportional},
|
|
|
|
- #{addTime}
|
|
|
|
- )
|
|
|
|
- </insert>
|
|
|
|
- <insert id="insertLadderPrice">
|
|
|
|
- insert into organize_product_ladder_price(
|
|
|
|
- productId, ladderNum, buyNum, buyPrice
|
|
|
|
- ) values (#{productId},#{ladderNum},#{buyNum},#{buyPrice})
|
|
|
|
|
|
+ <select id="findProductList" resultType="com.caimei.modules.product.entity.Product">
|
|
|
|
+ select p.productID, p.mainImage, p.name,
|
|
|
|
+ s.name as shopName, IF(cmop.productId is not null, 0, 1) as validFlag,k.price
|
|
|
|
+ from product p
|
|
|
|
+ left join cm_mall_organize_products cmop on p.productID = cmop.productId and cmop.organizeId = #{organizeId} and cmop.delFlag = 0
|
|
|
|
+ left join shop s on p.shopID = s.shopID
|
|
|
|
+ left join cm_sku k on p.productID = k.productId
|
|
|
|
+ <where>
|
|
|
|
+ p.productCategory = 1 AND p.validFlag not in ( 0,1,8 ) and s.shopType != 2 and cmop.productId is null
|
|
|
|
+ AND p.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
|
|
|
|
+ AND p.productID NOT IN (6060, 6061, 6062, 6063, 6064,6065, 6066, 6067, 6068, 6069)
|
|
|
|
+ <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>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY p.productID
|
|
|
|
+ order by price asc
|
|
|
|
+ </select>
|
|
|
|
|
|
- </insert>
|
|
|
|
|
|
+ <select id="findProductByProductId" resultType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
|
|
|
|
+ select productID as productId,
|
|
|
|
+ ifnull(includedTax, 2) as includedTax,
|
|
|
|
+ invoiceType,
|
|
|
|
+ taxPoint as clubTaxPoint,
|
|
|
|
+ supplierTaxPoint as shopTaxPoint
|
|
|
|
+ from product
|
|
|
|
+ where productID = #{productId}
|
|
|
|
+ </select>
|
|
|
|
|
|
- <update id="update">
|
|
|
|
- UPDATE cm_organize_product SET
|
|
|
|
- ladderPriceFlag = #{ladderPriceFlag},
|
|
|
|
- price = #{price},
|
|
|
|
- includedTax = #{includedTax},
|
|
|
|
- invoiceType = #{invoiceType},
|
|
|
|
- clubTaxPoint = #{clubTaxPoint},
|
|
|
|
- shopTaxPoint = #{shopTaxPoint},
|
|
|
|
- minBuyNumber = #{minBuyNumber},
|
|
|
|
- costType = #{costType},
|
|
|
|
- costPrice = #{costPrice},
|
|
|
|
- costProportional = #{costProportional},
|
|
|
|
- status = #{status},
|
|
|
|
- addTime = #{addTime},
|
|
|
|
- delFlag = #{delFlag}
|
|
|
|
- WHERE id = #{id}
|
|
|
|
- </update>
|
|
|
|
|
|
+ <select id="findFormerLadderPriceList"
|
|
|
|
+ resultType="com.caimei.modules.weisha.entity.OrganizeProductLadderPrice">
|
|
|
|
+ select ladderNum, buyNum, buyPrice
|
|
|
|
+ from product_ladder_price
|
|
|
|
+ where productId = #{productId}
|
|
|
|
+ </select>
|
|
|
|
|
|
- <update id="updateStatus">
|
|
|
|
- UPDATE cm_organize_product SET
|
|
|
|
- status = #{status}
|
|
|
|
- WHERE id = #{id}
|
|
|
|
- </update>
|
|
|
|
- <update id="updateLadderPrice">
|
|
|
|
- update organize_product_ladder_price
|
|
|
|
- set productId = #{productId},ladderNum = #{ladderNum},buyNum=#{buyNum},buyPrice=#{buyPrice}
|
|
|
|
- where id = #{id}
|
|
|
|
- </update>
|
|
|
|
- <update id="updateLadderPriceFlag">
|
|
|
|
- update cm_organize_product set ladderPriceFlag = #{ladderPriceFlag} where id = #{productId}
|
|
|
|
- </update>
|
|
|
|
|
|
+ <select id="getOrganizeInfo" resultType="com.caimei.modules.weisha.entity.CmMallOrganize">
|
|
|
|
+ select a.id AS "id",
|
|
|
|
+ a.organizeName AS "organizeName",
|
|
|
|
+ a.organizeLinkName AS "organizeLinkName",
|
|
|
|
+ a.mobile AS "mobile",
|
|
|
|
+ a.status AS "status",
|
|
|
|
+ a.contactNumber AS "contactNumber",
|
|
|
|
+ a.systemName AS "systemName",
|
|
|
|
+ a.systemImage AS "systemImage",
|
|
|
|
+ a.introduction AS "introduction",
|
|
|
|
+ a.afterSale AS "afterSale",
|
|
|
|
+ a.shoppingNotes AS "shoppingNotes",
|
|
|
|
+ a.updateTime AS "updateTime",
|
|
|
|
+ a.addTime AS "addTime",
|
|
|
|
+ a.delFlag AS "delFlag"
|
|
|
|
+ from cm_mall_organize a
|
|
|
|
+ where a.id = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getShopInfo" resultType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
|
|
|
|
+ SELECT
|
|
|
|
+ p.productId,
|
|
|
|
+ p.name AS productName,
|
|
|
|
+ s.name AS shopName
|
|
|
|
+ FROM product p
|
|
|
|
+ LEFT JOIN shop s ON p.shopId = s.shopId
|
|
|
|
+ <where>
|
|
|
|
+ <if test="productIds.size()>0">
|
|
|
|
+ productId in
|
|
|
|
+ <foreach collection="productIds" item="productId" open="(" separator="," close=")">
|
|
|
|
+ #{productId}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getSkuInfo" resultType="com.caimei.modules.product.entity.CmSku">
|
|
|
|
+ SELECT skuId,
|
|
|
|
+ productId,
|
|
|
|
+ normalPrice,
|
|
|
|
+ price,
|
|
|
|
+ costPrice,
|
|
|
|
+ ladderPriceFlag,
|
|
|
|
+ minBuyNumber
|
|
|
|
+ FROM cm_sku
|
|
|
|
+ where productId = #{productId}
|
|
|
|
+ order by normalPrice
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <insert id="insertMallProduct" parameterType="CmOrganizeProduct" keyProperty="id" useGeneratedKeys="true">
|
|
|
|
+ INSERT INTO cm_mall_organize_products (organizeID, productID, normalPrice, costPrice, ladderPriceFlag,
|
|
|
|
+ retailPrice, minBuyNumber, validFlag, ADDTIME, updateTime, delFlag)
|
|
|
|
+ VALUES (#{organizeId}, #{productId}, #{normalPrice}, #{costPrice}, #{ladderPriceFlag}, #{retailPrice},
|
|
|
|
+ #{minBuyNumber}, #{status}, #{addTime}, #{updateTime}, #{delFlag})
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <insert id="insertMallSku">
|
|
|
|
+ INSERT INTO cm_mall_product_sku(skuId, productId, mallProductId, minBuyNumber, price)
|
|
|
|
+ VALUES (#{skuId}, #{productId}, #{mallProductId}, #{minBuyNumber}, #{price})
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <update id="updateMallProduct">
|
|
|
|
+ update cm_mall_organize_products
|
|
|
|
+ <set>
|
|
|
|
+ <if test="retailPrice != null and retailPrice != ''">
|
|
|
|
+ retailPrice = #{retailPrice},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="minBuyNumber != null and minBuyNumber != ''">
|
|
|
|
+ minBuyNumber = #{minBuyNumber}
|
|
|
|
+ </if>
|
|
|
|
+ </set>
|
|
|
|
+ where id =#{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <update id="updateMallProductSku">
|
|
|
|
+ update cm_mall_product_sku
|
|
|
|
+ <set>
|
|
|
|
+ <if test="price != null and price != ''">
|
|
|
|
+ price = #{price},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="minBuyNumber != null and minBuyNumber != ''">
|
|
|
|
+ minBuyNumber = #{minBuyNumber},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="organizePercent != null and organizePercent != ''">
|
|
|
|
+ organizePercent = #{organizePercent},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="shopPercent != null and shopPercent != ''">
|
|
|
|
+ shopPercent = #{shopPercent},
|
|
|
|
+ </if>
|
|
|
|
+ <if test="cmPercent != null and cmPercent != ''">
|
|
|
|
+ cmPercent = #{cmPercent}
|
|
|
|
+ </if>
|
|
|
|
+ </set>
|
|
|
|
+ where id =#{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <select id="getProductInfo" resultType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
|
|
|
|
+ SELECT cmop.id,
|
|
|
|
+ cmop.organizeID AS organizeId,
|
|
|
|
+ p.productID AS productId,
|
|
|
|
+ p.mainImage AS productImage,
|
|
|
|
+ p.name AS productName,
|
|
|
|
+ s.name AS shopName,
|
|
|
|
+ IF(cmop.productId IS NOT NULL, 0, 1) AS validFlag,
|
|
|
|
+ p.includedTax,
|
|
|
|
+ p.invoiceType,
|
|
|
|
+ p.taxPoint,
|
|
|
|
+ p.supplierTaxPoint
|
|
|
|
+ FROM product p
|
|
|
|
+ LEFT JOIN cm_mall_organize_products cmop ON p.productID = cmop.productId
|
|
|
|
+ LEFT JOIN shop s ON p.shopID = s.shopID
|
|
|
|
+ WHERE p.productCategory = 1
|
|
|
|
+ AND cmop.id = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <update id="deleteProduct">
|
|
|
|
+ update cm_mall_organize_products
|
|
|
|
+ set delFlag = 1
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <delete id="deleteMallProductSku">
|
|
|
|
+ delete
|
|
|
|
+ from cm_mall_product_sku
|
|
|
|
+ where mallProductId = #{id}
|
|
|
|
+ </delete>
|
|
|
|
|
|
- <delete id="delete">
|
|
|
|
- UPDATE cm_organize_product set delFlag = 1 where id = #{id}
|
|
|
|
- </delete>
|
|
|
|
- <delete id="deleteMallProductSku">
|
|
|
|
- delete from cm_mall_product_sku where mallProductId = #{id}
|
|
|
|
- </delete>
|
|
|
|
- <delete id="deleteLadderPriceById">
|
|
|
|
- delete from organize_product_ladder_price where id = #{ladderId}
|
|
|
|
- </delete>
|
|
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|