|
@@ -0,0 +1,148 @@
|
|
|
+<?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>
|
|
|
+
|
|
|
+</mapper>
|