123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <?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.manager.dao.hehe.HeHeProductDao">
- <select id="findProductList" resultType="com.caimei365.manager.entity.hehe.product.HeHeProduct">
- SELECT a.id AS "id",
- a.productId AS "productId",
- ifnull(a.bigTypeId,0) AS "bigTypeId",
- ifnull(a.smallTypeId,0) AS "smallTypeId",
- a.validFlag AS "validFlag",
- a.includedTax AS "includedTax",
- a.invoiceType AS "invoiceType",
- a.clubTaxPoint AS "clubTaxPoint",
- a.shopTaxPoint AS "shopTaxPoint",
- a.oldProductId,
- a.addTime AS "addTime",
- p.name AS "name",
- p.mainImage AS "mainImage",
- s.name AS "shopName",
- chap.activityId,
- group_concat(chfp.floorId) as floorIds
- FROM cm_hehe_product a
- LEFT JOIN product p ON a.productId = p.productID
- LEFT JOIN shop s ON s.shopID = p.shopID
- left join cm_hehe_activity_product chap on a.productId = chap.productId
- left join cm_hehe_floor_product chfp on a.productId = chfp.productId
- <where>
- <if test="productId != null and productId != ''">
- AND a.productId = #{productId}
- </if>
- <if test="validFlag != null and validFlag != ''">
- AND a.validFlag = #{validFlag}
- </if>
- <if test="includedTax != null and includedTax != ''">
- AND a.includedTax = #{includedTax}
- </if>
- <if test="invoiceType != null and invoiceType != ''">
- AND a.invoiceType = #{invoiceType}
- </if>
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </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 a.id
- ORDER BY addTime DESC
- </select>
- <select id="findProductElement" resultType="com.caimei365.manager.entity.hehe.product.HeHeProduct">
- select ifnull(chs.price, 0) as price,
- ifnull(cs.shopPercent, 0) as shopPercent,
- ifnull(cs.organizePercent, 0) as organizePercent,
- ifnull(cs.cmPercent, 0) as cmPercent,
- ifnull((SELECT costCheckFlag
- FROM cm_organize_product_info
- WHERE productId = cs.productId
- AND organizeId = cs.organizeId), 0) as costType,
- ifnull(cs.costPrice, 0) as costPrice,
- cs.organizeId
- from cm_sku cs
- left join cm_hehe_sku chs on cs.skuId = chs.skuId
- where cs.productId = #{productId}
- and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
- order by chs.price asc
- limit 1
- </select>
- <select id="findBigTypeList" resultType="com.caimei365.manager.entity.hehe.product.HeHeBigType">
- SELECT a.bigTypeID AS "bigTypeID",
- a.name AS "name",
- a.bigTypeCode AS "bigTypeCode",
- a.wwwValidFlag AS "wwwValidFlag",
- a.crmValidFlag AS "crmValidFlag",
- a.sortIndex AS "sortIndex",
- a.wwwIcon AS "wwwIcon",
- a.crmIcon AS "crmIcon",
- a.addTime AS "addTime",
- ifnull(a.typeSort,'0') AS "typeSort",
- a.mallType
- FROM bigtype a
- <where>
- <if test="bigTypeID != null and bigTypeID != ''">
- AND a.bigTypeID = #{bigTypeID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="bigTypeCode != null and bigTypeCode != ''">
- AND a.bigTypeCode = #{bigTypeCode}
- </if>
- <if test="wwwValidFlag != null and wwwValidFlag != ''">
- AND a.wwwValidFlag = #{wwwValidFlag}
- </if>
- <if test="crmValidFlag != null and crmValidFlag != ''">
- AND a.crmValidFlag = #{crmValidFlag}
- </if>
- <if test="sortIndex != null and sortIndex != ''">
- AND a.sortIndex = #{sortIndex}
- </if>
- <if test="typeSort != null and typeSort != '' and typeSort != 'null'">
- AND a.typeSort = #{typeSort}
- </if>
- <if test="null != mallType">
- and mallType = #{mallType}
- </if>
- </where>
- ORDER BY ifnull(sortIndex,10000) ASC,addTime DESC
- </select>
- <select id="findActivityList" resultType="com.caimei365.manager.entity.hehe.product.HeHeActivity">
- SELECT a.id AS "id",
- a.name AS "name",
- a.status AS "status",
- a.listImage AS "listImage",
- a.detailsImage AS "detailsImage",
- a.beginTime AS "beginTime",
- a.endTime AS "endTime",
- a.addTime AS "addTime",
- a.delFlag AS "delFlag"
- FROM cm_hehe_activity a
- <where>
- a.delFlag = 0
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <if test="activityStatus == 1">
- AND a.beginTime <![CDATA[ > ]]> NOW()
- </if>
- <if test="activityStatus == 2">
- AND NOW() BETWEEN a.beginTime AND a.endTime
- </if>
- <if test="activityStatus == 3">
- AND a.endTime <![CDATA[ < ]]> NOW()
- </if>
- </where>
- ORDER BY addTime DESC
- </select>
- <select id="findDiscountActivityList" resultType="com.caimei365.manager.entity.hehe.product.DiscountActivity">
- SELECT a.id AS "id",
- a.name AS "name",
- a.onlineTime AS "onlineTime",
- a.offlineTime AS "offlineTime",
- a.addTime AS "addTime"
- FROM cm_hehe_discount_activity a
- <where>
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="status != null">
- <if test="status == 1">
- and NOW() <![CDATA[ < ]]> a.onlineTime
- </if>
- <if test="status == 2">
- and NOW() <![CDATA[ >= ]]> a.onlineTime and NOW() <![CDATA[ <= ]]> a.offlineTime
- </if>
- <if test="status == 3">
- and NOW() <![CDATA[ > ]]> a.offlineTime
- </if>
- </if>
- </where>
- order by a.addTime desc
- </select>
- <select id="findShareReductionList" resultType="com.caimei365.manager.entity.hehe.product.ShareReduction">
- SELECT
- a.id AS "id",
- a.name AS "name",
- a.reducedAmount AS "reducedAmount",
- a.touchPrice AS "touchPrice",
- a.shareNum AS "shareNum",
- a.startTime AS "startTime",
- a.endTime AS "endTime",
- a.addTime AS "addTime"
- FROM cm_hehe_reduction a
- <where>
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- <if test="status != null">
- <if test="status == 1">
- and NOW() <![CDATA[ < ]]> a.startTime
- </if>
- <if test="status == 2">
- and NOW() <![CDATA[ >= ]]> a.startTime and NOW() <![CDATA[ <= ]]> a.endTime
- </if>
- <if test="status == 3">
- and NOW() <![CDATA[ > ]]> a.endTime
- </if>
- </if>
- </where>
- order by a.addTime desc
- </select>
- <select id="findInsideDiscountList" resultType="com.caimei365.manager.entity.hehe.product.InsideDiscount">
- SELECT
- a.id AS "id",
- a.title AS "title",
- a.discount AS "discount",
- a.status AS "status",
- a.productType AS "productType",
- a.addTime AS "addTime"
- FROM cm_hehe_discount a
- <where>
- <if test="title != null and title != ''">
- AND a.title LIKE concat('%',#{title},'%')
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- </where>
- order by addTime desc
- </select>
- </mapper>
|