瀏覽代碼

退款颜色

Duan_xu 2 年之前
父節點
當前提交
2a84b2e3f1

+ 10 - 0
src/main/java/com/caimei/modules/newhome/web/NewPageFloorController.java

@@ -28,6 +28,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 import java.util.Map;
 
 import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
@@ -156,6 +157,15 @@ public class NewPageFloorController extends BaseController {
         return "modules/newhome/newPageFloorContentForm";
     }
 
+    @RequestMapping(value = "ContentPage")
+    public String ContentPage(NewPageFloor newPageFloor,Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
+         List<Product> list =productService.newfindProductImage(product);
+        Page<NewPageFloor> page = newPageFloorService.floorFindList(new Page<NewPageFloor>(request, response), newPageFloor);
+        model.addAttribute("page", page);
+        model.addAttribute("list", list);
+        return "modules/newhome/newFloorcontentForm";
+    }
+
     /**
      * 批量更新排序值
      */

+ 2 - 0
src/main/java/com/caimei/modules/product/dao/ProductDao.java

@@ -173,6 +173,8 @@ public interface ProductDao extends CrudDao<Product> {
 
     List<Product> findProductImage(Product product);
 
+    List<Product> newfindProductImage(Product product);
+
     void insertProductDetailInfo(ProductDetailInfo productDetailInfo);
 
     String findProductDetail(Integer productID);

+ 31 - 0
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -234,6 +234,37 @@ public class Product extends DataEntity<Product> {
      */
     private Integer newvalidFlag;
 
+    private Integer showFlag;
+
+    private Date showTime;
+
+    //1.重点推荐
+    private Integer recommend;
+
+
+    public Integer getShowFlag() {
+        return showFlag;
+    }
+
+    public void setShowFlag(Integer showFlag) {
+        this.showFlag = showFlag;
+    }
+
+    public Date getShowTime() {
+        return showTime;
+    }
+
+    public void setShowTime(Date showTime) {
+        this.showTime = showTime;
+    }
+
+    public Integer getRecommend() {
+        return recommend;
+    }
+
+    public void setRecommend(Integer recommend) {
+        this.recommend = recommend;
+    }
 
     public Integer getNewvalidFlag() {
         return newvalidFlag;

+ 4 - 0
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -550,6 +550,10 @@ public class ProductService extends CrudService<ProductDao, Product> {
         return productPage;
     }
 
+   public List<Product> newfindProductImage(Product product){
+        return productDao.newfindProductImage(product);
+   }
+
     public String findProductDetail(Integer productID) {
         return productDao.findProductDetail(productID);
     }

+ 21 - 0
src/main/resources/mappings/modules/newhome/NewPageFloorMapper.xml

@@ -94,6 +94,9 @@
 			<if test="sort != null and sort != ''" >
 				sort,
 			</if>
+		<if test="floorType != null and floorType != ''" >
+			floorType,
+		</if>
 			wwwEnabledStatus,
 			crmEnabledStatus,
 			createBy,
@@ -108,6 +111,9 @@
 			<if test="sort != null and sort != ''" >
 				#{sort},
 			</if>
+		<if test="floorType != null and floorType != ''" >
+			#{floorType},
+		</if>
 			#{wwwEnabledStatus},
 			#{crmEnabledStatus},
 			#{createBy.id},
@@ -124,6 +130,7 @@
 			floorDetail = #{floorDetail},
 			type = #{type},
 			sort = #{sort},
+			floorType=#{floorType},
 			wwwEnabledStatus = #{wwwEnabledStatus},
 			crmEnabledStatus = #{crmEnabledStatus},
 			createBy = #{createBy.id},
@@ -171,6 +178,20 @@
 		  npf.id = #{floorId}
 	</select>
 
+<!--	<select id="findFloorContentById" resultType="com.caimei.modules.newhome.entity.NewPageFloorContent">-->
+<!--		SELECT-->
+<!--			npfc.*,-->
+<!--			npf.floorTitle AS floorTitle-->
+<!--		FROM product pro-->
+<!--		    LEFT JOIN new_page_floor_content npfc ON npfc.productId=pro.productID-->
+<!--			LEFT join new_page_floor npf ON npfc.floorId = npf.id-->
+
+<!--		WHERE-->
+<!--			npf.id = #{floorId}-->
+<!--	</select>-->
+
+
+
 	<select id="findFloorImage" resultType="com.caimei.modules.newhome.entity.NewPageFloorImage">
 		SELECT
 		  a.id,

+ 1890 - 1838
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -2,13 +2,13 @@
 <!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.ProductDao">
 
-	<resultMap  id="productModelResultMap" type="com.caimei.modules.product.entity.Product">
-		<id  property="id" column="id"/>
-		<result  property="name" column="name"/>
-	</resultMap>
+    <resultMap id="productModelResultMap" type="com.caimei.modules.product.entity.Product">
+        <id property="id" column="id"/>
+        <result property="name" column="name"/>
+    </resultMap>
 
-	<sql id="productColumns">
-		a.productID AS "id",
+    <sql id="productColumns">
+        a.productID AS "id",
 		a.productID AS "productID",
 		a.brandID AS "brandID",
 		a.bigTypeID AS "bigTypeID",
@@ -87,1838 +87,1890 @@
 		a.commodityType as "commodityType",
 		a.splitCode,
         a.announType,
-        a.newvalidFlag
-	</sql>
-
-	<sql id="productJoins">
-		LEFT JOIN shop s on s.shopID = a.shopID
+        a.newvalidFlag,
+        a.showFlag,
+        a.showTime,
+        a.recommend
+    </sql>
+
+    <sql id="productJoins">
+        LEFT JOIN shop s on s.shopID = a.shopID
 		left join product p on a.productID = p.productId
-	</sql>
-	<sql id="ActivityJoins">
-		LEFT JOIN shop s on s.shopID = a.shopID
-	</sql>
-
-	<update id="saveSort">
-		UPDATE cm_search_recommend_product SET
-			sort = #{sort}
-		WHERE id = #{id}
-	</update>
-
-	<select id="findLadderPriceByNum" resultType="Integer">
-		select IFNULL(buyNum,1)
-		FROM product_ladder_price
-		WHERE  userType = 3 and ladderNum = 1 and delFlag = 0  and productID = #{productID}
-	</select>
-
-	<select id="get" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		WHERE a.productID = #{id}
-	</select>
-
-
-	<select id="getAllExistsProductList" resultType="Integer">
-		SELECT
-			a.productID
-		FROM cm_mall_organize_products a
-		WHERE a.delFlag = 0 and a.organizeID = #{organizeID}
-	</select>
-
-	<select id="findRecommendPage" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="productID !=null and productID !=''">
-				AND a.productID=#{productID}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="speCommisionFlag !=null and speCommisionFlag !=''">
-				AND a.speCommisionFlag=#{speCommisionFlag}
-			</if>
-			<if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
-				AND a.displayOnCRMFlag=#{displayOnCRMFlag}
-			</if>
-			<if test="crmBigTypeId !=null and crmBigTypeId !=''">
-				AND a.crmBigTypeId=#{crmBigTypeId}
-			</if>
-			<if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
-				AND a.crmSmallTypeId=#{crmSmallTypeId}
-			</if>
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			<choose>
-				<when test="actType != null and actType != ''">
-					AND a.actType = #{actType}
-				</when>
-				<otherwise>
-					AND a.actType != 3
-				</otherwise>
-			</choose>
-			AND a.validFlag != 0
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<!--小程序商品获取采美2已上架 3已下架 9已冻结的商品-->
-	<select id="findListBuyMall" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="productID !=null and productID !=''">
-				AND a.productID=#{productID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			AND a.validFlag in (2,3,9)
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findList" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="preferredFlag != null and preferredFlag != ''and preferredFlag != 0">
-				<if test="preferredFlag/100>=1">
-					AND a.preferredFlag in (100,101,110,111)
-				</if>
-				<if test="(preferredFlag%100)/10>=1">
-					AND a.preferredFlag in (10,11,110,111)
-				</if>
-				<if test="preferredFlag%10>=1">
-					AND a.preferredFlag in (1,11,101,111)
-				</if>
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="actType !=null and actType !=''">
-				AND a.actType=#{actType}
-			</if>
-			<if test="speCommisionFlag !=null and speCommisionFlag !=''">
-				AND a.speCommisionFlag=#{speCommisionFlag}
-			</if>
-			<if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
-				AND a.displayOnCRMFlag=#{displayOnCRMFlag}
-			</if>
-			<if test="crmBigTypeId !=null and crmBigTypeId !=''">
-				AND a.crmBigTypeId=#{crmBigTypeId}
-			</if>
-			<if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
-				AND a.crmSmallTypeId=#{crmSmallTypeId}
-			</if>
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			AND a.validFlag != 0
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findAllList" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-
-		</choose>
-	</select>
-
-	<insert id="insert" parameterType="Product"  keyProperty="productID"  keyColumn="productID" useGeneratedKeys="true">
-		INSERT INTO product(
-			brandID,
-			bigTypeID,
-			smallTypeID,
-			tinyTypeID,
-			selfTypeID,
-			shopID,
-			aliasName,
-			name,
-			searchKey,
-			normalPrice,
-			price,
-			priceFlag,
-			beautyActFlag,
-			ladderPriceFlag,
-			stock,
-			hasSkuFlag,
-			mainImage,
-			propertiesInfo,
-			addTime,
-			updateTime,
-			weekSellNumber,
-			beforeValidFlag,
-			validFlag,
-			favoriteTimes,
-			commentScore,
-			commentTimes,
-			selfRecommendFlag,
-			sysRecommendFlag,
-			sortIndex,
-			featuredFlag,
-			featuredSortIndex,
-			productCode,
-			unit,
-			synToERPFlag,
-			allAreaFlag,
-			provinceIDs,
-			serviceNumber,
-			maxBuyNumber,
-			minBuyNumber,
-			packageCount,
-			byFlag,
-			normalProductFlag,
-			wholeSaleProductFlag,
-			promotionProductFlag,
-			groupBuyProductFlag,
-			step,
-			actFlag,
-			actType,
-			actSort,
-			onlineTime,
-			downlineTime,
-			freePostFlag,
-			costPrice,
-			costProportional,
-			costCheckFlag,
-			precisehKey,
-			visibility,
-			productType,
-			qualificationImg,
-			invoiceType,
-			taxPoint,
-			supplierTaxPoint,
-			tags,
-			recommendType,
-			machineType,
-			includedTax,
-			commodityType,
-			trainingMethod,
-			trainingType,
-			trainingFee,
-			productDescribe,
-			splitCode,
-			productDetail,
-			announType,
-			newvalidFlag
-		) VALUES (
-					 #{brandID},
-					 #{bigTypeID},
-					 #{smallTypeID},
-					 #{tinyTypeID},
-					 #{selfTypeID},
-					 #{shopID},
-		          	 #{aliasName},
-					 #{name},
-					 #{searchKey},
-					 #{normalPrice},
-					 #{price},
-					 #{priceFlag},
-					 #{beautyActFlag},
-					 #{ladderPriceFlag},
-					 #{stock},
-					 #{hasSkuFlag},
-					 #{mainImage},
-					 #{propertiesInfo},
-					 #{addTime},
-					 #{updateTime},
-					 #{weekSellNumber},
-					 #{beforeValidFlag},
-					 #{validFlag},
-					 #{favoriteTimes},
-					 #{commentScore},
-					 #{commentTimes},
-					 #{selfRecommendFlag},
-					 #{sysRecommendFlag},
-					 #{sortIndex},
-					 #{featuredFlag},
-					 #{featuredSortIndex},
-					 #{productCode},
-					 #{unit},
-					 #{synToERPFlag},
-					 #{allAreaFlag},
-					 #{provinceIDs},
-					 #{serviceNumber},
-					 #{maxBuyNumber},
-					 #{minBuyNumber},
-					 #{packageCount},
-					 #{byFlag},
-					 #{normalProductFlag},
-					 #{wholeSaleProductFlag},
-					 #{promotionProductFlag},
-					 #{groupBuyProductFlag},
-					 #{step},
-					 #{actFlag},
-					 #{actType},
-		          	 #{actSort},
-					 #{onlineTime},
-					 #{downlineTime},
-					 #{freePostFlag},
-					 #{SqlCostPrice},
-					 #{sqlCostProportional},
-					 #{costCheckFlag},
-					 #{precisehKey},
-		         	 #{visibility},
-		         	 #{productType},
-					 #{qualificationImg},
-					 #{invoiceType},
-					 #{sqlTaxPoint},
-					 #{sqlSupplierTaxPoint},
-					 #{tags},
-					 #{recommendType},
-					 #{machineType},
-					 #{includedTax},
-					 #{commodityType},
-					 #{trainingMethod},
-					 #{trainingType},
-					 #{trainingFee},
-		          	 #{productDescribe},
-					 #{splitCode},
-					 #{productDetail},
-		             #{announType},
-		             #{newvalidFlag}
-						 )
-	</insert>
-
-	<update id="update">
-		UPDATE product SET
-						   productID = #{id},
-						   brandID = #{brandID},
-						   tinyTypeID = #{tinyTypeID},
-						   selfTypeID = #{selfTypeID},
-						   shopID = #{shopID},
-						   name = #{name},
-						   searchKey = #{searchKey},
-						   normalPrice = #{normalPrice},
-						   price = #{price},
-						   priceFlag = #{priceFlag},
-						   beautyActFlag = #{beautyActFlag},
-						   ladderPriceFlag = #{ladderPriceFlag},
-						   stock = #{stock},
-						   hasSkuFlag = #{hasSkuFlag},
-						   mainImage = #{mainImage},
-						   propertiesInfo = #{propertiesInfo},
-						   addTime = #{addTime},
-						   updateTime = #{updateTime},
-						   sellNumber = #{sellNumber},
-						   weekSellNumber = #{weekSellNumber},
-						   beforeValidFlag = #{beforeValidFlag},
-						   validFlag = #{validFlag},
-						   favoriteTimes = #{favoriteTimes},
-						   commentScore = #{commentScore},
-						   commentTimes = #{commentTimes},
-						   selfRecommendFlag = #{selfRecommendFlag},
-						   sysRecommendFlag = #{sysRecommendFlag},
-						   sortIndex = #{sortIndex},
-						   featuredFlag = #{featuredFlag},
-						   featuredSortIndex = #{featuredSortIndex},
-						   productCode = #{productCode},
-						   unit = #{unit},
-						   synToERPFlag = #{synToERPFlag},
-						   allAreaFlag = #{allAreaFlag},
-						   provinceIDs = #{provinceIDs},
-						   serviceNumber = #{serviceNumber},
-						   maxBuyNumber = #{maxBuyNumber},
-						   minBuyNumber = #{minBuyNumber},
-						   packageCount = #{packageCount},
-						   byFlag = #{byFlag},
-						   normalProductFlag = #{normalProductFlag},
-						   wholeSaleProductFlag = #{wholeSaleProductFlag},
-						   promotionProductFlag = #{promotionProductFlag},
-						   groupBuyProductFlag = #{groupBuyProductFlag},
-						   step = #{step},
-						   actFlag = #{actFlag},
-						   actType = #{actType},
-						   onlineTime = #{onlineTime},
-						   downlineTime = #{downlineTime},
-						   freePostFlag = #{freePostFlag},
-						   costPrice = #{costPrice},
-						   costProportional = #{costProportional},
-						   costCheckFlag = #{costCheckFlag},
-						   precisehKey = #{precisehKey},
-						   actSort = #{actSort},
-						   newvalidFlag=#{newvalidFlag}
-
-		WHERE productID = #{id}
-	</update>
-
-	<update id="updateActive">
-		UPDATE product
-		<set>
-			<if test="actFlag != null and actFlag != ''">
-				actFlag = #{actFlag},
-			</if>
-			<if test="actType != null and actType != ''">
-				actType = #{actType},
-			</if>
-			<if test="actSort != null and actSort != ''">
-				actSort = #{actSort},
-			</if>
-			<if test="actCreateTime != null and actCreateTime != ''">
-				actCreateTime = #{actCreateTime},
-			</if>
-		</set>
-		WHERE productID = #{productID}
-	</update>
-
-	<update id="updatePreferred">
-		UPDATE product SET preferredFlag = #{preferredFlag}
-		WHERE productID = #{productID}
-	</update>
-
-	<delete id="delete">
-		DELETE FROM product
-		WHERE id = #{id}
-	</delete>
-
-	<update id="deleteProduct">
-		UPDATE cm_search_recommend_product
-		SET delFlag = #{DateTime}
-		WHERE id = #{id}
-	</update>
-
-
-	<select id="getAllActType" resultType="com.caimei.po.ActType">
-		SELECT
-			*
-		FROM acttype
-		where validFlag = 1
-	</select>
-
-
-
-	<select id="getSupplierProductList" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		*
-		FROM
-		product
-		<where>
-			<if test="name != null and name != ''">
-				AND name LIKE concat('%',#{name},'%')
-			</if>
-			AND shopID = #{shopID}
-			AND (validFlag = 1 or validFlag = 2 or validFlag = 3 or validFlag =  9)
-		</where>
-		ORDER BY addTime desc
-	</select>
-
-	<select id="getGiftProductInfo"  resultType="com.caimei.modules.product.entity.GiftProduct">
-		SELECT
-		g.id as "id",
-		g.fullGiftProductId as "fullGiftProductId",
-		g.giftProductId as "giftProductId",
-		g.actType as "actType",
-		g.giftProductNum as "giftProductNum",
-		p.name as "productName"
-		FROM
-		gift_product g
-		left join  product p on p.productID = g.giftProductId
-		<where>
-			g.fullGiftProductId = #{fullGiftProductId}
-			AND g.actType = #{actType}
-			<if test="giftProductId != null and giftProductId != ''">
-				AND g.giftProductId =  #{giftProductId}
-			</if>
-			<if test="delFlag != null and delFlag != ''">
-				AND g.delFlag =  #{delFlag}
-			</if>
-			and p.productCategory = 1
-		</where>
-	</select>
-
-	<select id="getProductSku" resultType="com.caimei.modules.product.entity.Sku">
-		SELECT
-		*
-		FROM
-		sku
-		<where>
-			productID = #{productId}
-			AND  validFlag = 1
-		</where>
-	</select>
-
-	<select id="findProductBigTypeByProductID"  resultType="java.lang.String">
-		SELECT
-		tb.name
-		FROM
-		bigType AS tb
-		INNER JOIN smallType AS ts
-		ON tb.bigTypeID = ts.bigTypeID
-		INNER JOIN tinyType AS tt
-		ON ts.smallTypeID = tt.smallTypeID
-		INNER JOIN product AS tp
-		ON tt.tinyTypeID = tp.tinyTypeID
-		<where>
-			tp.productID = #{productId}
-			and tp.productCategory = 1
-		</where>
-	</select>
-
-	<update id="updateGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct">
-		update gift_product
-		<set >
-			<if test="fullGiftProductId != null and  !=''" >
-				fullGiftProductId = #{fullGiftProductId},
-			</if>
-			<if test="giftProductId != null and  !=''" >
-				giftProductId = #{giftProductId},
-			</if>
-			<if test="productName != null and  !=''" >
-				productName = #{productName},
-			</if>
-			<if test="actType != null and  !=''" >
-				actType = #{actType},
-			</if>
-			<if test="giftProductNum != null and  !=''" >
-				giftProductNum = #{giftProductNum},
-			</if>
-			<if test="createBy != null and  !=''" >
-				createBy = #{createBy.id},
-			</if>
-			<if test="createDate != null and  !=''" >
-				createDate = #{createDate},
-			</if>
-
-			<if test="updateBy != null and  !=''" >
-				updateBy = #{updateBy.id},
-			</if>
-			<if test="updateDate != null and  !=''" >
-				updateDate = #{updateDate},
-			</if>
-			<if test="delFlag != null and  !=''" >
-				delFlag = #{delFlag},
-			</if>
-		</set>
-		where id = #{id}
-	</update>
-
-	<insert id="insertGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO gift_product(
-			fullGiftProductId,
-			giftProductId,
-			productName,
-			actType,
-			giftProductNum,
-			createBy,
-			createDate,
-			updateBy,
-			updateDate,
-			delFlag
-		) VALUES (
-					 #{fullGiftProductId},
-					 #{giftProductId},
-					 #{productName},
-					 #{actType},
-					 #{giftProductNum},
-					 #{createBy.id},
-					 #{createDate},
-					 #{updateBy.id},
-					 #{updateDate},
-					 #{delFlag}
-				 )
-	</insert>
-
-
-	<insert id="insertProductPriceRecord" parameterType="com.caimei.modules.product.entity.ProductPriceRecord"  keyProperty="productPriceRecordID" useGeneratedKeys="true">
-		INSERT INTO productpricerecord(
-			`productID`,
-			`shopID`,
-			`highestUserLevelPrice`,
-			`lowestUserLevelPrice`,
-			`lowestUserLevelID`,
-			`price0`,
-			`price1`,
-			`updateTime`
-		)
-		VALUES
-			(
-				#{productID},
-				#{shopID},
-				#{highestUserLevelPrice},
-				#{lowestUserLevelPrice},
-				#{lowestUserLevelID},
-				#{price0},
-				#{price1},
-				#{updateTime}
-			)
-	</insert>
-
-	<!--	<update id="updateCRMFlag">-->
-	<!--		UPDATE product a SET a.displayOnCRMFlag = #{param1}-->
-	<!--		WHERE  a.productID IN-->
-	<!--		<foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >-->
-	<!--			#{id}-->
-	<!--		</foreach>-->
-	<!--	</update>-->
-
-	<update id="deleteActive">
-		UPDATE product a SET a.actFlag = 0
-		WHERE  a.productID = #{id}
-	</update>
-
-
-	<update id="updatePostFlag">
-		UPDATE product a SET a.freePostFlag = #{param1}
-		WHERE  a.productID IN
-		<foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
-			#{id}
-		</foreach>
-	</update>
-
-
-	<select id="getBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
-		select * from bigtype
-		<where>
-			validFlag = 1
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND bigTypeID = #{bigTypeID}
-			</if>
-		</where>
-	</select>
-
-	<select id="getSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
-		select * from smalltype
-		<where>
-			validFlag = 1
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND bigTypeID = #{bigTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND smallTypeID = #{smallTypeID}
-			</if>
-		</where>
-	</select>
-
-	<select id="getTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
-		select * from tinytype
-		<where>
-			validFlag = 1
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND smallTypeID = #{smallTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND smallTypeID = #{smallTypeID}
-			</if>
-		</where>
-	</select>
-
-	<select id="getProductTypeNameAndID" resultType="map">
-		select
-			b.name AS bigTypeName,
-			b.bigTypeID AS bigTypeID,
-			s.name AS smallTypeName,
-			s.smallTypeID AS smallTypeID,
-			t.name AS tinyTypeName,
-			t.tinyTypeID AS tinyTypeID
-		from tinytype AS t
-				 join smalltype AS s on t.smallTypeID = s.smallTypeID
-				 JOIN bigtype AS b on b.bigTypeID = s.bigTypeID
-		where t.tinyTypeID = #{tinyTypeID}
-	</select>
-
-	<delete id="deleteCustomClassification">
-		delete from product_custom_classification
-		where productID = #{productID}
-	</delete>
-
-	<insert id="insertCustomClassification" parameterType="com.caimei.modules.product.entity.ProductCustomClassification"  keyProperty="userId" useGeneratedKeys="true">
-		INSERT INTO product_custom_classification(
-			productID,
-			bigTypeID,
-			smallTypeID,
-			tinyTypeID,
-			createDate,
-			updateDate
-		) VALUES (
-					 #{productID},
-					 #{bigTypeID},
-					 #{smallTypeID},
-					 #{tinyTypeID},
-					 #{createDate},
-					 #{updateDate}
-				 )
-	</insert>
-
-	<insert id="insertAddProduct">
-		INSERT INTO cm_search_recommend_product(
-			productID,
-			tinyTypeID,
-			sort,
-			delFlag
-		) VALUES (
-					 #{productID},
-					 #{tinyTypeID},
-					 0,
-					 0
-				 )
-	</insert>
-	<insert id="insertLadderPrice">
-		insert into product_ladder_price (productId, userType, ladderNum,
-										  buyNum, buyPrice, createBy, createDate, delFlag)
-		values (#{productId}, 3, #{ladderNum},
-				#{buyNum}, #{buyPrice}, #{createBy},
-				#{createDate},'0')
-	</insert>
-
-	<insert id="insertProduct" keyColumn="productID" keyProperty="productID"  parameterType="com.caimei.modules.product.entity.Product" useGeneratedKeys="true">
-		INSERT INTO `product` (
-		`brandID`,
-		`tinyTypeID`,
-		<if test="productCategory != null and  productCategory != '' ">
-			`productCategory`,
-		</if>
-		`preferredFlag`,
-		`selfTypeID`,
-		`shopID`,
-		`name`,
-		`aliasName`,
-		`searchKey`,
-		`productRemarks`,
-		`normalPrice`,
-		`price`,
-		`priceFlag`,
-		`beautyActFlag`,
-		`ladderPriceFlag`,
-		<if test="stock != null and  stock != '' ">
-		`stock`,
-		</if>
-		`hasSkuFlag`,
-		`mainImage`,
-		`propertiesInfo`,
-		`addTime`,
-		`updateTime`,
-		`weekSellNumber`,
-		`beforeValidFlag`,
-		`validFlag`,
-		`favoriteTimes`,
-		`commentScore`,
-		`commentTimes`,
-		`selfRecommendFlag`,
-		`sysRecommendFlag`,
-		`sortIndex`,
-		`featuredFlag`,
-		`featuredSortIndex`,
-		`productCode`,
-		`unit`,
-		`synToERPFlag`,
-		`allAreaFlag`,
-		`provinceIDs`,
-		`serviceNumber`,
-		`maxBuyNumber`,
-		`minBuyNumber`,
-		`packageCount`,
-		`byFlag`,
-		`normalProductFlag`,
-		`wholeSaleProductFlag`,
-		`promotionProductFlag`,
-		`groupBuyProductFlag`,
-		`step`,
-		`actFlag`,
-		`actStatus`,
-		`actSort`,
-		`actType`,
-		`visibility`,
-		`onlineTime`,
-		`downlineTime`,
-		`freePostFlag`,
-		`costPrice`,
-		`costProportional`,
-		`costCheckFlag`,
-		`precisehKey`,
-		`tags`,
-		`productType`,
-		`machineType`,
-		`qualificationImg`,
-		`includedTax`,
-		`taxPoint`,
-		`invoiceType`,
-		`recommendType`,
-		`combinationID`,
-		`combinationSort`,
-		announType
-		)
-		VALUES
-		(
-		#{brandID},
-		#{tinyTypeID},
-		<if test="productCategory != null and  productCategory != '' ">
-			#{productCategory},
-		</if>
-		#{preferredFlag},
-		#{selfTypeID},
-		#{shopID},
-		#{name},
-		#{aliasName},
-		#{searchKey},
-		#{productRemarks},
-		#{normalPrice},
-		#{price},
-		#{priceFlag},
-		#{beautyActFlag},
-		#{ladderPriceFlag},
-		<if test="stock != null and  stock != '' ">
-		#{stock},
-		</if>
-		#{hasSkuFlag},
-		#{mainImage},
-		#{propertiesInfo},
-		#{addTime},
-		#{updateTime},
-		#{weekSellNumber},
-		#{beforeValidFlag},
-		#{validFlag},
-		#{favoriteTimes},
-		#{commentScore},
-		#{commentTimes},
-		#{selfRecommendFlag},
-		#{sysRecommendFlag},
-		#{sortIndex},
-		#{featuredFlag},
-		#{featuredSortIndex},
-		#{productCode},
-		#{unit},
-		#{synToERPFlag},
-		#{allAreaFlag},
-		#{provinceIDs},
-		#{serviceNumber},
-		#{maxBuyNumber},
-		#{minBuyNumber},
-		#{packageCount},
-		#{byFlag},
-		#{normalProductFlag},
-		#{wholeSaleProductFlag},
-		#{promotionProductFlag},
-		#{groupBuyProductFlag},
-		#{step},
-		#{actFlag},
-		#{actStatus},
-		#{actSort},
-		#{actType},
-		#{visibility},
-		#{onlineTime},
-		#{downlineTime},
-		#{freePostFlag},
-		#{costPrice},
-		#{costProportional},
-		#{costCheckFlag},
-		#{precisehKey},
-		#{tags},
-		#{productType},
-		#{machineType},
-		#{qualificationImg},
-		#{includedTax},
-		#{taxPoint},
-		#{invoiceType},
-		#{recommendType},
-		#{combinationID},
-		#{combinationSort},
-		 #{announType}
-		)
-	</insert>
-
-	<insert id="insertProductDetailInfo">
-		insert into productdetailinfo
-		<trim prefix="(" suffix=")" suffixOverrides=",">
-			<if test="productID != null">
-				`productID`,
-			</if>
-			<if test="detailInfo != null and detailInfo != ''">
-				`detailInfo`,
-			</if>
-			<if test="serviceInfo != null and serviceInfo != ''">
-				`serviceInfo`,
-			</if>
-			<if test="orderInfo != null and orderInfo != ''">
-				`orderInfo`,
-			</if>
-		</trim>
-		<trim prefix="values (" suffix=")" suffixOverrides=",">
-			<if test="productID != null">
-				#{productID},
-			</if>
-			<if test="detailInfo != null and detailInfo != ''">
-				#{detailInfo},
-			</if>
-			<if test="serviceInfo != null and serviceInfo != ''">
-				#{serviceInfo},
-			</if>
-			<if test="orderInfo != null and orderInfo != ''">
-				#{orderInfo},
-			</if>
-		</trim>
-	</insert>
-
-	<select id="getrecommendProductList" resultType="product">
-		select
-		a.*,
-		csrp.sort AS sort,
-		csrp.id AS recommendProductId,
-		b.name AS brandName,
-		s.name AS shopName
-		FROM
-		cm_search_recommend_product csrp
-		LEFT JOIN  product a on a.productID = csrp.productID
-		LEFT JOIN shop s on s.shopID = a.shopID
-		left join cm_brand b on b.id = a.brandID
-		WHERE
-		csrp.tinyTypeId = #{tinyTypeID}
-		<if test="name != null and name != ''">
-			AND a.name like concat('%', #{name} ,'%')
-		</if>
-		<if test="validFlag !=null and validFlag !=''">
-			AND a.validFlag=#{validFlag}
-		</if>
-		<if test="shopName != null and shopName != ''">
-			AND s.name like concat('%', #{shopName} ,'%')
-		</if>
-		<if test="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-		and a.productCategory = 1
-		AND a.validFlag != 0
-		AND csrp.delFlag =0
-		ORDER BY csrp.sort DESC
-	</select>
-
-
-	<select id="relatedProductList" resultType="product">
-		select
-		<include refid="productColumns"/>,
-		b.name AS brandName,
-		(case when a.tinyTypeID = #{tinyTypeID} then '1' else '0' end) AS defaultType
-		FROM product a
-		<include refid="productJoins"/>
-		left join brand b on b.brandID = a.brandID
-		WHERE (a.productID
-		IN (select productID from product_custom_classification where tinyTypeID = #{tinyTypeID})
-		OR a.tinyTypeID = #{tinyTypeID})
-		<if test="name != null and name != ''">
-			AND a.name like concat('%', #{name} ,'%')
-		</if>
-		<if test="validFlag !=null and validFlag !=''">
-			AND a.validFlag=#{validFlag}
-		</if>
-		<if test="shopName != null and shopName != ''">
-			AND s.name like concat('%', #{shopName} ,'%')
-		</if>
-		<if test="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-		AND a.validFlag != 0
-		and a.productCategory = 1
-	</select>
-
-	<delete id="deleteProductCustomClassification">
-		delete from product_custom_classification
-		where productID = #{productID} and tinyTypeID = #{tinyTypeID}
-	</delete>
-	<delete id="deleteLadderPriceByProductId">
-		DELETE FROM product_ladder_price where productId = #{productID}
-	</delete>
-	<delete id="deleteLadderPriceById">
-		DELETE FROM product_ladder_price where id = #{id}
-	</delete>
-
-	<select id="toAddProductCustomClassificationList" resultType="product">
-		select
-		<include refid="productColumns"/>,
-		b.name AS brandName
-		FROM product a
-		<include refid="productJoins"/>
-		left join cm_brand b on b.id = a.brandID
-		WHERE a.tinyTypeID != #{tinyTypeID}
-		and not exists
-		(select pcc.id from product_custom_classification pcc where pcc.productID = a.productID and pcc.tinyTypeID = #{tinyTypeID})
-		and a.validFlag = '2'
-		and (select count(id) from product_custom_classification pcc where pcc.productID = a.productID) <![CDATA[ < ]]> 5
-		<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="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-	</select>
-
-
-	<select id="toAddProductList" resultType="product">
-		select
-		a.*,
-		b.name AS brandName,
-		s.name AS shopName
-		FROM product a
-		LEFT JOIN shop s on s.shopID = a.shopID
-		left join cm_brand b on b.id = a.brandID
-		WHERE
-		NOT EXISTS (select * from cm_search_recommend_product csrp where  csrp.productID = a.productID  and csrp.tinyTypeID = #{tinyTypeID} AND csrp.delFlag = 0)
-		and a.validFlag = '2'
-		<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="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-		and a.productCategory = 1
-	</select>
-
-	<select id="getProductTypes" resultType="com.caimei.modules.product.entity.ProductCustomClassification">
-		select *
-		from product_custom_classification where productID = #{productID}
-	</select>
-
-
-	<select id="findRecommendActivityListPage" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="ActivityJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-
-
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			AND a.validFlag = 2
-			AND (a.actType != 3 or a.`actType` IS NULL or (a.actType = 3 and STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i')))
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findGroupActivityListPage" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="ActivityJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="actStatus != null and actStatus != '' and actStatus == 1">
-				AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
-			</if>
-			<if test="actStatus != null and actStatus != '' and actStatus == 2">
-				AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  >  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
-				AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
-			</if>
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			AND a.validFlag = 2
-			AND ((a.actType != 1 AND a.actType != 2 OR a.`actType` IS NULL) or a.actFlag = 0)
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
-		SELECT
-		*
-		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
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-
-		</where>
-	</select>
-	<select id="findSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
-		SELECT
-		*
-		FROM smalltype a
-		<where>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-		</where>
-	</select>
-	<select id="findTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
-		SELECT
-		*
-		FROM tinytype a
-		<where>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-		</where>
-	</select>
-
-	<select id="findProductRecommendList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
-		select
-			cpr.id AS id,
-			cpr.productID AS productID,
-			cpr.recommendProductID AS recommendProductID,
-			cpr.sort AS sort,
-			pro.name AS productName,
-			pro.unit AS unit,
-			pro.mainImage AS img,
-			cpr.shopName AS shopName
-		from cm_product_recommend cpr
-				 join product pro on cpr.recommendProductID = pro.productID
-		where cpr.productID = #{productID}
-		order by cpr.sort desc
-	</select>
-
-	<select id="findProductRecommendCount" resultType="int">
-		select
-			count(1)
-		from cm_product_recommend cpr
-		where cpr.productID = #{productID}
-	</select>
-
-	<select id="findProductList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
-		select
-		a.productID AS productID,
-		a.name AS productName,
-		a.unit AS unit,
-		a.mainImage AS img,
-		s.name AS shopName
-		from product a
-		<include refid="ActivityJoins"/>
-		<where>
-			<choose>
-				<when test="commodityType != null and commodityType != ''">
-					AND a.commodityType = #{commodityType}
-				</when>
-				<when test="bigTypeID != null and bigTypeID != ''">
-					AND a.bigTypeID = #{bigTypeID}
-				</when>
-				<when test="smallTypeID != null and smallTypeID != ''">
-					AND a.smallTypeID = #{smallTypeID}
-				</when>
-				<when test="tinyTypeID != null and tinyTypeID != ''">
-					AND a.tinyTypeID = #{tinyTypeID}
-				</when>
-			</choose>
-			<if test="productName != null and productName != ''">
-				and a.name like concat('%', #{productName} ,'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				and s.name like concat('%', #{shopName} ,'%')
-			</if>
-			and a.productCategory = 1
-		</where>
-		<!--		limit 0, 10-->
-	</select>
-
-	<update id="updateRecommendType">
-		UPDATE product SET
-			recommendType = #{recommendType}
-		WHERE productID = #{productID}
-	</update>
-
-	<update id="updateBrnadId">
-		UPDATE product
-		set brandID = #{brandID}
-		WHERE productID = #{productID}
-	</update>
-
-	<update id="updateProductByBrandId">
-		UPDATE product
-		set  brandID = null
-		WHERE brandID = #{brandId}
-	</update>
-	<select id="getProductIdByBrandId" resultType="java.lang.Integer">
-		SELECT productID FROM product WHERE brandID = #{brandId}
-	</select>
-	<update id="updateTinyType">
-		UPDATE product
-		set tinyTypeID = #{tinyTypeID}
-		WHERE productID = #{productID}
-	</update>
-	<update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
-		update product
-		<set>
-			<if test="productDescribe != null and productDescribe != ''">
-				productDescribe = #{productDescribe},
-			</if>
-			<if test="productDetail != null and productDetail != ''">
-				productDetail = #{productDetail},
-			</if>
-			<if test="brandID != null and brandID != ''">
-				brandID = #{brandID},
-			</if>
-			<if test="bigTypeID != null and bigTypeID !=''">
-				bigTypeID = #{bigTypeID},
-				smallTypeID = #{smallTypeID},
-				tinyTypeID = #{tinyTypeID},
-			</if>
-			<if test="preferredFlag != null and preferredFlag !=''">
-				preferredFlag = #{preferredFlag},
-			</if>
-			<if test="shopID != null and shopID !=''">
-				shopID = #{shopID},
-			</if>
-			<if test="name != null and name !=''">
-				`name` = #{name},
-			</if>
-			<if test="aliasName != null and aliasName !=''">
-				aliasName = #{aliasName},
-			</if>
-			<if test="searchKey != null and searchKey !=''">
-				searchKey = #{searchKey},
-			</if>
-			<if test="productRemarks != null and productRemarks !=''">
-				productRemarks = #{productRemarks},
-			</if>
-			<if test="combinationID != null and combinationID !=''">
-				combinationID = #{combinationID},
-			</if>
-			<if test="normalPrice != null and normalPrice !=''">
-				normalPrice = #{normalPrice},
-			</if>
-			<if test="price != null and price !=''">
-				price = #{price},
-			</if>
-			<if test="priceFlag != null and priceFlag !=''">
-				priceFlag = #{priceFlag},
-			</if>
-			<if test="beautyActFlag != null and beautyActFlag !=''">
-				beautyActFlag = #{beautyActFlag},
-			</if>
-			<if test="ladderPriceFlag != null and ladderPriceFlag !=''">
-				ladderPriceFlag = #{ladderPriceFlag},
-			</if>
-			<if test="stock != null and stock !=''">
-				stock = #{stock},
-			</if>
-			<if test="hasSkuFlag != null and hasSkuFlag !=''">
-				hasSkuFlag = #{hasSkuFlag},
-			</if>
-			<if test="mainImage != null and mainImage !=''">
-				mainImage = #{mainImage},
-			</if>
-			<if test="propertiesInfo != null and propertiesInfo !=''">
-				propertiesInfo = #{propertiesInfo},
-			</if>
-			<if test="addTime != null and addTime !=''">
-				addTime = #{addTime},
-			</if>
-			<if test="updateTime != null and updateTime !=''">
-				updateTime = #{updateTime},
-			</if>
-			<if test="weekSellNumber != null and weekSellNumber !=''">
-				weekSellNumber = #{weekSellNumber},
-			</if>
-			<if test="beforeValidFlag != null and beforeValidFlag !=''">
-				beforeValidFlag = #{beforeValidFlag},
-			</if>
-			<if test="validFlag != null and validFlag !=''">
-				validFlag = #{validFlag},
-			</if>
-			<if test="favoriteTimes != null and favoriteTimes !=''">
-				favoriteTimes = #{favoriteTimes},
-			</if>
-			<if test="commentScore != null and commentScore !=''">
-				commentScore = #{commentScore},
-			</if>
-			<if test="commentTimes != null and commentTimes !=''">
-				commentTimes = #{commentTimes},
-			</if>
-			<if test="selfRecommendFlag != null and selfRecommendFlag !=''">
-				selfRecommendFlag = #{selfRecommendFlag},
-			</if>
-			<if test="sysRecommendFlag != null and sysRecommendFlag !=''">
-				sysRecommendFlag = #{sysRecommendFlag},
-			</if>
-			<if test="sortIndex != null and sortIndex != ''">
-				sortIndex = #{sortIndex},
-			</if>
-			<if test="featuredFlag != null and featuredFlag !=''">
-				featuredFlag = #{featuredFlag},
-			</if>
-			<if test="featuredSortIndex != null and featuredSortIndex !=''">
-				featuredSortIndex = #{featuredSortIndex},
-			</if>
-			<if test="productCode != null and productCode !=''">
-				productCode = #{productCode},
-			</if>
-			<if test="unit != null and unit !=''">
-				unit = #{unit},
-			</if>
-			<if test="synToERPFlag != null and synToERPFlag !=''">
-				synToERPFlag = #{synToERPFlag},
-			</if>
-			<if test="allAreaFlag != null and allAreaFlag !=''">
-				allAreaFlag = #{allAreaFlag},
-			</if>
-			<if test="provinceIDs != null and provinceIDs !=''">
-				provinceIDs = #{provinceIDs},
-			</if>
-			<if test="serviceNumber != null and serviceNumber !=''">
-				serviceNumber = #{serviceNumber},
-			</if>
-			<if test="maxBuyNumber != null and maxBuyNumber !=''">
-				maxBuyNumber = #{maxBuyNumber},
-			</if>
-			<if test="minBuyNumber != null and minBuyNumber !=''">
-				minBuyNumber = #{minBuyNumber},
-			</if>
-			<if test="packageCount != null and packageCount !=''">
-				packageCount = #{packageCount},
-			</if>
-			<if test="byFlag != null and byFlag !=''">
-				byFlag = #{byFlag},
-			</if>
-			<if test="normalProductFlag != null and normalProductFlag !=''">
-				normalProductFlag = #{normalProductFlag},
-			</if>
-			<if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">
-				wholeSaleProductFlag = #{wholeSaleProductFlag},
-			</if>
-			<if test="promotionProductFlag != null and promotionProductFlag !=''">
-				promotionProductFlag = #{promotionProductFlag},
-			</if>
-			<if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">
-				groupBuyProductFlag = #{groupBuyProductFlag},
-			</if>
-			<if test="step != null and step !=''">
-				step = #{step},
-			</if>
-			<if test="actFlag != null and actFlag !=''">
-				actFlag = #{actFlag},
-			</if>
-			<if test="actSort != null and actSort !=''">
-				actSort = #{actSort},
-			</if>
-			<if test="actType != null and actType !=''">
-				actType = #{actType},
-			</if>
-			<if test="onlineTime != null and onlineTime !=''">
-				onlineTime = #{onlineTime},
-			</if>
-			<if test="downlineTime != null and downlineTime !=''">
-				downlineTime = #{downlineTime},
-			</if>
-			<if test="freePostFlag != null and freePostFlag !=''">
-				freePostFlag = #{freePostFlag},
-			</if>
-			<if test="costPrice != null and costPrice != ''">
-				costPrice = #{costPrice},
-			</if>
-			<if test="costProportional != null and costProportional !=''">
-				costProportional = #{costProportional},
-			</if>
-			<if test="costCheckFlag != null and costCheckFlag !=''">
-				costCheckFlag = #{costCheckFlag},
-			</if>
-			<if test="precisehKey != null and precisehKey !=''">
-				precisehKey = #{precisehKey},
-			</if>
-			<if test="visibility != null and visibility !=''">
-				visibility = #{visibility},
-			</if>
-			<if test="productType != null and productType !=''">
-				productType = #{productType},
-			</if>
-			<if test="qualificationImg != null and qualificationImg !=''">
-				qualificationImg = #{qualificationImg},
-			</if>
-			<if test="qualificationImg != null and qualificationImg !=''">
-				qualificationImg = #{qualificationImg},
-			</if>
-			<if test="invoiceType != null and invoiceType !=''">
-				invoiceType = #{invoiceType},
-			</if>
-			<if test="taxPoint != null and taxPoint !=''">
-				taxPoint = #{taxPoint},
-			</if>
-			<if test="supplierTaxPoint != null and supplierTaxPoint !=''">
-				supplierTaxPoint = #{supplierTaxPoint},
-			</if>
-			<if test="endTimeStr != null and endTimeStr !=''">
-				endTimeStr = #{endTimeStr},
-			</if>
-			<if test="tags != null and tags !=''">
-				tags = #{tags},
-			</if>
-			<if test="recommendType != null and recommendType !=''">
-				recommendType = #{recommendType},
-			</if>
-			<if test="machineType != null and machineType !=''">
-				machineType = #{machineType},
-			</if>
-			<if test="includedTax != null and includedTax !=''">
-				includedTax = #{includedTax},
-			</if>
-			<if test="invoiceType != null and invoiceType !=''">
-				invoiceType = #{invoiceType},
-			</if>
-			<if test="commodityType != null and commodityType != ''">
-				commodityType = #{commodityType},
-			</if>
-			<if test="trainingMethod != null">
-				trainingMethod = #{trainingMethod},
-			</if>
-			<if test="trainingType != null">
-				trainingType = #{trainingType},
-			</if>
-		    <if test="announType!=null">
-				announType=#{announType},
-			</if>
-			<if test="trainingFee != null">
-				trainingFee = #{trainingFee},
-			</if>
-		    <if test="newvalidFlag !=null">
-				newvalidFlag=#{newvalidFlag},
-			</if>
-				splitCode = #{splitCode}
-		</set>
-		where productID = #{productID}
-	</update>
-	<update id="updateproductDetailInfo" parameterType="com.caimei.modules.product.entity.ProductDetailInfo">
-		update productdetailinfo
-		<set>
-			<if test="propValueAlias != null and propValueAlias != ''">
-				propValueAlias = #{propValueAlias},
-			</if>
-			<if test="propValueImages != null and propValueImages !=''">
-				propValueImages = #{propValueImages},
-			</if>
-			<if test="detailInfo != null">
-				detailInfo = #{detailInfo},
-			</if>
-			<if test="commonDetailInfo != null">
-				commonDetailInfo = #{commonDetailInfo},
-			</if>
-			<if test="detailInfoTxt != null">
-				detailInfoTxt = #{detailInfoTxt},
-			</if>
-			<if test="seoTitle != null and seoTitle !=''">
-				seoTitle = #{seoTitle},
-			</if>
-			<if test="seoKeyword != null and seoKeyword !=''">
-				seoKeyword = #{seoKeyword},
-			</if>
-			<if test="seoDes != null and seoDes !=''">
-				seoDes = #{seoDes},
-			</if>
-			<if test="serviceInfo != null ">
-				serviceInfo = #{serviceInfo},
-			</if>
-			<if test="orderInfo != null ">
-				orderInfo = #{orderInfo},
-			</if>
-		</set>
-		where productID = #{productID}
-	</update>
-	<update id="updateLadderPrice">
-		update product_ladder_price
-		set productId = #{productId},
-			ladderNum = #{ladderNum},
-			buyNum = #{buyNum},
-			buyPrice = #{buyPrice},
-			updateBy = #{updateBy},
-			updateDate = #{updateDate},
-			delFlag = #{delFlag}
-		where id = #{id}
-	</update>
-	<update id="updateMainImage">
-		update product
-		set mainImage =#{mainImage}
-		where productID=#{productID}
-	</update>
-
-	<select id="getProductByTypeName" resultType="com.caimei.modules.brand.entity.BrandAndProductType">
-		select
-			b.name AS "bigTypeName",b.bigTypeID,s.`name` AS "smallTypeName",s.smalltypeID,t.name AS "tinyTypeName" ,t.tinytypeID
-		from tinytype  t LEFT JOIN smalltype  s on  t.smallTypeID = s.smallTypeID  LEFT JOIN bigtype b ON b.bigTypeID = s.bigTypeID
-		where  b.`name` = #{name} AND s.`name` = #{name1} AND t.name = #{name2}
-	</select>
-
-	<select id="findRecommendBySys" resultType="com.caimei.modules.product.entity.CmProductRecommend">
-		select
-			p.productID AS recommendProductID,
-			p.name AS productName,
-			p.unit AS unit,
-			p.mainImage AS img,
-			s.name AS shopName
-		from product p
-				 left join shop s on s.shopID = p.shopID
-		where p.tinyTypeID = #{tinyTypeID} and p.productCategory = 1
-		order by p.sellNumber
-				desc limit 0, 7
-	</select>
-
-	<select id="getSecondHandRecommend" resultType="CmSecondHandRecommendVo">
-		select p.productID AS id,
-			   1 AS type,
-			   p.name AS name,
-			   p.unit AS unit,
-			   p.mainImage AS img,
-			   s.name AS shopName,
-			   p.productCategory as "productCategory"
-		from product p
-				 left join shop s on s.shopID = p.shopID
-		where p.productID = #{productID}
-		  AND p.validFlag = '2'
-	</select>
-
-	<select id="querySecondHandRecommend" resultType="CmSecondHandRecommendVo">
-		select
-		p.productID AS id,
-		1 AS type,
-		p.name AS name,
-		p.unit AS unit,
-		p.mainImage AS img,
-		s.name AS shopName,
-		p.productCategory as "productCategory"
-		from product p
-		left join shop s on s.shopID = p.shopID
-		<where>
-			<if test="productID != null and productID != ''">
-				p.productID = #{productID}
-			</if>
-			<if test="productName != null and productName != ''">
-				and p.name like concat('%', #{productName} ,'%')
-			</if>
-			AND p.validFlag = '2'
-			and p.productCategory = #{queryProductType}
-		</where>
-		limit 0, 10
-	</select>
-	<select id="queryProductDetailInfo" resultType="com.caimei.modules.product.entity.ProductDetailInfo">
-		SELECT * FROM
-			productdetailinfo
-		where productID = #{productID}
-	</select>
-	<select id="findProductLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
-		SELECT *
-		FROM product_ladder_price
-		WHERE
-			productId = #{productId}
-		  AND userType = #{userType}
-		  AND buyNum is NOT null
-		  AND buyPrice is NOT null
-		  AND delFlag = 0
-		ORDER BY ladderNum ASC
-	</select>
-	<select id="findActList" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="actType !=null and actType !=''">
-				AND a.actType=#{actType}
-			</if>
-			AND a.actStatus = 1
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
-		select p.productID,p.mainImage,p.name,s.name as shopName from product p left join shop s on p.shopID = s.shopID
-		<where>
-			(p.actFlag=0 or p.actType is null) and p.validFlag = 2 and p.productCategory = 1
-			<if test="productIds != null and productIds != '' ">
-				and p.productID != #{productIds}
-			</if>
-			<if test="productID != null and productID != ''">
-				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>
-		order by productID asc
-	</select>
-
-	<select id="findProductImage" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="productID !=null">
-				AND a.productID=#{productID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</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="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="productCategory !=null and productCategory !=''">
-				AND a.productCategory=#{productCategory}
-			</if>
-			<if test="ids != null and ids.size() > 0">
-				AND a.productID NOT IN
-				<foreach collection="ids" close=")" separator="," open="(" item="id">
-					#{id}
-				</foreach>
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.productID asc
-			</otherwise>
-		</choose>
-	</select>
-	<select id="findProductDetail" resultType="java.lang.String">
-		select productDetail from product where productID = #{productID}
-	</select>
-	<select id="findProductDescribe" resultType="java.lang.String">
-		select productDescribe from product where productID = #{productID}
-	</select>
-	<select id="findSepcialShopList" resultType="com.caimei.modules.product.entity.CmShop">
-		select name,shopID
-		from shop
-		where shopType=2
-	</select>
+    </sql>
+    <sql id="ActivityJoins">
+        LEFT JOIN shop s on s.shopID = a.shopID
+    </sql>
+
+    <update id="saveSort">
+        UPDATE cm_search_recommend_product
+        SET sort = #{sort}
+        WHERE id = #{id}
+    </update>
+
+    <select id="findLadderPriceByNum" resultType="Integer">
+        select IFNULL(buyNum, 1)
+        FROM product_ladder_price
+        WHERE userType = 3
+          and ladderNum = 1
+          and delFlag = 0
+          and productID = #{productID}
+    </select>
+
+    <select id="get" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        WHERE a.productID = #{id}
+    </select>
+
+
+    <select id="getAllExistsProductList" resultType="Integer">
+        SELECT a.productID
+        FROM cm_mall_organize_products a
+        WHERE a.delFlag = 0
+          and a.organizeID = #{organizeID}
+    </select>
+
+    <select id="findRecommendPage" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="productID !=null and productID !=''">
+                AND a.productID=#{productID}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="speCommisionFlag !=null and speCommisionFlag !=''">
+                AND a.speCommisionFlag=#{speCommisionFlag}
+            </if>
+            <if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
+                AND a.displayOnCRMFlag=#{displayOnCRMFlag}
+            </if>
+            <if test="crmBigTypeId !=null and crmBigTypeId !=''">
+                AND a.crmBigTypeId=#{crmBigTypeId}
+            </if>
+            <if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
+                AND a.crmSmallTypeId=#{crmSmallTypeId}
+            </if>
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            <choose>
+                <when test="actType != null and actType != ''">
+                    AND a.actType = #{actType}
+                </when>
+                <otherwise>
+                    AND a.actType != 3
+                </otherwise>
+            </choose>
+            AND a.validFlag != 0
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <!--小程序商品获取采美2已上架 3已下架 9已冻结的商品-->
+    <select id="findListBuyMall" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="productID !=null and productID !=''">
+                AND a.productID=#{productID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            AND a.validFlag in (2,3,9)
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findList" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="preferredFlag != null and preferredFlag != ''and preferredFlag != 0">
+                <if test="preferredFlag/100>=1">
+                    AND a.preferredFlag in (100,101,110,111)
+                </if>
+                <if test="(preferredFlag%100)/10>=1">
+                    AND a.preferredFlag in (10,11,110,111)
+                </if>
+                <if test="preferredFlag%10>=1">
+                    AND a.preferredFlag in (1,11,101,111)
+                </if>
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="actType !=null and actType !=''">
+                AND a.actType=#{actType}
+            </if>
+            <if test="speCommisionFlag !=null and speCommisionFlag !=''">
+                AND a.speCommisionFlag=#{speCommisionFlag}
+            </if>
+            <if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
+                AND a.displayOnCRMFlag=#{displayOnCRMFlag}
+            </if>
+            <if test="crmBigTypeId !=null and crmBigTypeId !=''">
+                AND a.crmBigTypeId=#{crmBigTypeId}
+            </if>
+            <if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
+                AND a.crmSmallTypeId=#{crmSmallTypeId}
+            </if>
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            AND a.validFlag != 0
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllList" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+
+        </choose>
+    </select>
+
+    <insert id="insert" parameterType="Product" keyProperty="productID" keyColumn="productID" useGeneratedKeys="true">
+        INSERT INTO product(brandID,
+                            bigTypeID,
+                            smallTypeID,
+                            tinyTypeID,
+                            selfTypeID,
+                            shopID,
+                            aliasName,
+                            name,
+                            searchKey,
+                            normalPrice,
+                            price,
+                            priceFlag,
+                            beautyActFlag,
+                            ladderPriceFlag,
+                            stock,
+                            hasSkuFlag,
+                            mainImage,
+                            propertiesInfo,
+                            addTime,
+                            updateTime,
+                            weekSellNumber,
+                            beforeValidFlag,
+                            validFlag,
+                            favoriteTimes,
+                            commentScore,
+                            commentTimes,
+                            selfRecommendFlag,
+                            sysRecommendFlag,
+                            sortIndex,
+                            featuredFlag,
+                            featuredSortIndex,
+                            productCode,
+                            unit,
+                            synToERPFlag,
+                            allAreaFlag,
+                            provinceIDs,
+                            serviceNumber,
+                            maxBuyNumber,
+                            minBuyNumber,
+                            packageCount,
+                            byFlag,
+                            normalProductFlag,
+                            wholeSaleProductFlag,
+                            promotionProductFlag,
+                            groupBuyProductFlag,
+                            step,
+                            actFlag,
+                            actType,
+                            actSort,
+                            onlineTime,
+                            downlineTime,
+                            freePostFlag,
+                            costPrice,
+                            costProportional,
+                            costCheckFlag,
+                            precisehKey,
+                            visibility,
+                            productType,
+                            qualificationImg,
+                            invoiceType,
+                            taxPoint,
+                            supplierTaxPoint,
+                            tags,
+                            recommendType,
+                            machineType,
+                            includedTax,
+                            commodityType,
+                            trainingMethod,
+                            trainingType,
+                            trainingFee,
+                            productDescribe,
+                            splitCode,
+                            productDetail,
+                            announType,
+                            newvalidFlag)
+        VALUES (#{brandID},
+                #{bigTypeID},
+                #{smallTypeID},
+                #{tinyTypeID},
+                #{selfTypeID},
+                #{shopID},
+                #{aliasName},
+                #{name},
+                #{searchKey},
+                #{normalPrice},
+                #{price},
+                #{priceFlag},
+                #{beautyActFlag},
+                #{ladderPriceFlag},
+                #{stock},
+                #{hasSkuFlag},
+                #{mainImage},
+                #{propertiesInfo},
+                #{addTime},
+                #{updateTime},
+                #{weekSellNumber},
+                #{beforeValidFlag},
+                #{validFlag},
+                #{favoriteTimes},
+                #{commentScore},
+                #{commentTimes},
+                #{selfRecommendFlag},
+                #{sysRecommendFlag},
+                #{sortIndex},
+                #{featuredFlag},
+                #{featuredSortIndex},
+                #{productCode},
+                #{unit},
+                #{synToERPFlag},
+                #{allAreaFlag},
+                #{provinceIDs},
+                #{serviceNumber},
+                #{maxBuyNumber},
+                #{minBuyNumber},
+                #{packageCount},
+                #{byFlag},
+                #{normalProductFlag},
+                #{wholeSaleProductFlag},
+                #{promotionProductFlag},
+                #{groupBuyProductFlag},
+                #{step},
+                #{actFlag},
+                #{actType},
+                #{actSort},
+                #{onlineTime},
+                #{downlineTime},
+                #{freePostFlag},
+                #{SqlCostPrice},
+                #{sqlCostProportional},
+                #{costCheckFlag},
+                #{precisehKey},
+                #{visibility},
+                #{productType},
+                #{qualificationImg},
+                #{invoiceType},
+                #{sqlTaxPoint},
+                #{sqlSupplierTaxPoint},
+                #{tags},
+                #{recommendType},
+                #{machineType},
+                #{includedTax},
+                #{commodityType},
+                #{trainingMethod},
+                #{trainingType},
+                #{trainingFee},
+                #{productDescribe},
+                #{splitCode},
+                #{productDetail},
+                #{announType},
+                #{newvalidFlag})
+    </insert>
+
+    <update id="update">
+        UPDATE product
+        SET productID            = #{id},
+            brandID              = #{brandID},
+            tinyTypeID           = #{tinyTypeID},
+            selfTypeID           = #{selfTypeID},
+            shopID               = #{shopID},
+            name                 = #{name},
+            searchKey            = #{searchKey},
+            normalPrice          = #{normalPrice},
+            price                = #{price},
+            priceFlag            = #{priceFlag},
+            beautyActFlag        = #{beautyActFlag},
+            ladderPriceFlag      = #{ladderPriceFlag},
+            stock                = #{stock},
+            hasSkuFlag           = #{hasSkuFlag},
+            mainImage            = #{mainImage},
+            propertiesInfo       = #{propertiesInfo},
+            addTime              = #{addTime},
+            updateTime           = #{updateTime},
+            sellNumber           = #{sellNumber},
+            weekSellNumber       = #{weekSellNumber},
+            beforeValidFlag      = #{beforeValidFlag},
+            validFlag            = #{validFlag},
+            favoriteTimes        = #{favoriteTimes},
+            commentScore         = #{commentScore},
+            commentTimes         = #{commentTimes},
+            selfRecommendFlag    = #{selfRecommendFlag},
+            sysRecommendFlag     = #{sysRecommendFlag},
+            sortIndex            = #{sortIndex},
+            featuredFlag         = #{featuredFlag},
+            featuredSortIndex    = #{featuredSortIndex},
+            productCode          = #{productCode},
+            unit                 = #{unit},
+            synToERPFlag         = #{synToERPFlag},
+            allAreaFlag          = #{allAreaFlag},
+            provinceIDs          = #{provinceIDs},
+            serviceNumber        = #{serviceNumber},
+            maxBuyNumber         = #{maxBuyNumber},
+            minBuyNumber         = #{minBuyNumber},
+            packageCount         = #{packageCount},
+            byFlag               = #{byFlag},
+            normalProductFlag    = #{normalProductFlag},
+            wholeSaleProductFlag = #{wholeSaleProductFlag},
+            promotionProductFlag = #{promotionProductFlag},
+            groupBuyProductFlag  = #{groupBuyProductFlag},
+            step                 = #{step},
+            actFlag              = #{actFlag},
+            actType              = #{actType},
+            onlineTime           = #{onlineTime},
+            downlineTime         = #{downlineTime},
+            freePostFlag         = #{freePostFlag},
+            costPrice            = #{costPrice},
+            costProportional     = #{costProportional},
+            costCheckFlag        = #{costCheckFlag},
+            precisehKey          = #{precisehKey},
+            actSort              = #{actSort},
+            newvalidFlag=#{newvalidFlag}
+
+        WHERE productID = #{id}
+    </update>
+
+    <update id="updateActive">
+        UPDATE product
+        <set>
+            <if test="actFlag != null and actFlag != ''">
+                actFlag = #{actFlag},
+            </if>
+            <if test="actType != null and actType != ''">
+                actType = #{actType},
+            </if>
+            <if test="actSort != null and actSort != ''">
+                actSort = #{actSort},
+            </if>
+            <if test="actCreateTime != null and actCreateTime != ''">
+                actCreateTime = #{actCreateTime},
+            </if>
+        </set>
+        WHERE productID = #{productID}
+    </update>
+
+    <update id="updatePreferred">
+        UPDATE product
+        SET preferredFlag = #{preferredFlag}
+        WHERE productID = #{productID}
+    </update>
+
+    <delete id="delete">
+        DELETE
+        FROM product
+        WHERE id = #{id}
+    </delete>
+
+    <update id="deleteProduct">
+        UPDATE cm_search_recommend_product
+        SET delFlag = #{DateTime}
+        WHERE id = #{id}
+    </update>
+
+
+    <select id="getAllActType" resultType="com.caimei.po.ActType">
+        SELECT *
+        FROM acttype
+        where validFlag = 1
+    </select>
+
+
+    <select id="getSupplierProductList" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        *
+        FROM
+        product
+        <where>
+            <if test="name != null and name != ''">
+                AND name LIKE concat('%',#{name},'%')
+            </if>
+            AND shopID = #{shopID}
+            AND (validFlag = 1 or validFlag = 2 or validFlag = 3 or validFlag = 9)
+        </where>
+        ORDER BY addTime desc
+    </select>
+
+    <select id="getGiftProductInfo" resultType="com.caimei.modules.product.entity.GiftProduct">
+        SELECT
+        g.id as "id",
+        g.fullGiftProductId as "fullGiftProductId",
+        g.giftProductId as "giftProductId",
+        g.actType as "actType",
+        g.giftProductNum as "giftProductNum",
+        p.name as "productName"
+        FROM
+        gift_product g
+        left join product p on p.productID = g.giftProductId
+        <where>
+            g.fullGiftProductId = #{fullGiftProductId}
+            AND g.actType = #{actType}
+            <if test="giftProductId != null and giftProductId != ''">
+                AND g.giftProductId = #{giftProductId}
+            </if>
+            <if test="delFlag != null and delFlag != ''">
+                AND g.delFlag = #{delFlag}
+            </if>
+            and p.productCategory = 1
+        </where>
+    </select>
+
+    <select id="getProductSku" resultType="com.caimei.modules.product.entity.Sku">
+        SELECT
+        *
+        FROM
+        sku
+        <where>
+            productID = #{productId}
+            AND validFlag = 1
+        </where>
+    </select>
+
+    <select id="findProductBigTypeByProductID" resultType="java.lang.String">
+        SELECT
+        tb.name
+        FROM
+        bigType AS tb
+        INNER JOIN smallType AS ts
+        ON tb.bigTypeID = ts.bigTypeID
+        INNER JOIN tinyType AS tt
+        ON ts.smallTypeID = tt.smallTypeID
+        INNER JOIN product AS tp
+        ON tt.tinyTypeID = tp.tinyTypeID
+        <where>
+            tp.productID = #{productId}
+            and tp.productCategory = 1
+        </where>
+    </select>
+
+    <update id="updateGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct">
+        update gift_product
+        <set>
+            <if test="fullGiftProductId != null and  !=''">
+                fullGiftProductId = #{fullGiftProductId},
+            </if>
+            <if test="giftProductId != null and  !=''">
+                giftProductId = #{giftProductId},
+            </if>
+            <if test="productName != null and  !=''">
+                productName = #{productName},
+            </if>
+            <if test="actType != null and  !=''">
+                actType = #{actType},
+            </if>
+            <if test="giftProductNum != null and  !=''">
+                giftProductNum = #{giftProductNum},
+            </if>
+            <if test="createBy != null and  !=''">
+                createBy = #{createBy.id},
+            </if>
+            <if test="createDate != null and  !=''">
+                createDate = #{createDate},
+            </if>
+
+            <if test="updateBy != null and  !=''">
+                updateBy = #{updateBy.id},
+            </if>
+            <if test="updateDate != null and  !=''">
+                updateDate = #{updateDate},
+            </if>
+            <if test="delFlag != null and  !=''">
+                delFlag = #{delFlag},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <insert id="insertGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct" keyProperty="id"
+            useGeneratedKeys="true">
+        INSERT INTO gift_product(fullGiftProductId,
+                                 giftProductId,
+                                 productName,
+                                 actType,
+                                 giftProductNum,
+                                 createBy,
+                                 createDate,
+                                 updateBy,
+                                 updateDate,
+                                 delFlag)
+        VALUES (#{fullGiftProductId},
+                #{giftProductId},
+                #{productName},
+                #{actType},
+                #{giftProductNum},
+                #{createBy.id},
+                #{createDate},
+                #{updateBy.id},
+                #{updateDate},
+                #{delFlag})
+    </insert>
+
+
+    <insert id="insertProductPriceRecord" parameterType="com.caimei.modules.product.entity.ProductPriceRecord"
+            keyProperty="productPriceRecordID" useGeneratedKeys="true">
+        INSERT INTO productpricerecord(`productID`,
+                                       `shopID`,
+                                       `highestUserLevelPrice`,
+                                       `lowestUserLevelPrice`,
+                                       `lowestUserLevelID`,
+                                       `price0`,
+                                       `price1`,
+                                       `updateTime`)
+        VALUES (#{productID},
+                #{shopID},
+                #{highestUserLevelPrice},
+                #{lowestUserLevelPrice},
+                #{lowestUserLevelID},
+                #{price0},
+                #{price1},
+                #{updateTime})
+    </insert>
+
+    <!--	<update id="updateCRMFlag">-->
+    <!--		UPDATE product a SET a.displayOnCRMFlag = #{param1}-->
+    <!--		WHERE  a.productID IN-->
+    <!--		<foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >-->
+    <!--			#{id}-->
+    <!--		</foreach>-->
+    <!--	</update>-->
+
+    <update id="deleteActive">
+        UPDATE product a
+        SET a.actFlag = 0
+        WHERE a.productID = #{id}
+    </update>
+
+
+    <update id="updatePostFlag">
+        UPDATE product a SET a.freePostFlag = #{param1}
+        WHERE a.productID IN
+        <foreach collection="param2" item="id" index="index" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+
+    <select id="getBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
+        select * from bigtype
+        <where>
+            validFlag = 1
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND bigTypeID = #{bigTypeID}
+            </if>
+        </where>
+    </select>
+
+    <select id="getSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
+        select * from smalltype
+        <where>
+            validFlag = 1
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND bigTypeID = #{bigTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND smallTypeID = #{smallTypeID}
+            </if>
+        </where>
+    </select>
+
+    <select id="getTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
+        select * from tinytype
+        <where>
+            validFlag = 1
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND smallTypeID = #{smallTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND smallTypeID = #{smallTypeID}
+            </if>
+        </where>
+    </select>
+
+    <select id="getProductTypeNameAndID" resultType="map">
+        select b.name        AS bigTypeName,
+               b.bigTypeID   AS bigTypeID,
+               s.name        AS smallTypeName,
+               s.smallTypeID AS smallTypeID,
+               t.name        AS tinyTypeName,
+               t.tinyTypeID  AS tinyTypeID
+        from tinytype AS t
+                 join smalltype AS s on t.smallTypeID = s.smallTypeID
+                 JOIN bigtype AS b on b.bigTypeID = s.bigTypeID
+        where t.tinyTypeID = #{tinyTypeID}
+    </select>
+
+    <delete id="deleteCustomClassification">
+        delete
+        from product_custom_classification
+        where productID = #{productID}
+    </delete>
+
+    <insert id="insertCustomClassification"
+            parameterType="com.caimei.modules.product.entity.ProductCustomClassification" keyProperty="userId"
+            useGeneratedKeys="true">
+        INSERT INTO product_custom_classification(productID,
+                                                  bigTypeID,
+                                                  smallTypeID,
+                                                  tinyTypeID,
+                                                  createDate,
+                                                  updateDate)
+        VALUES (#{productID},
+                #{bigTypeID},
+                #{smallTypeID},
+                #{tinyTypeID},
+                #{createDate},
+                #{updateDate})
+    </insert>
+
+    <insert id="insertAddProduct">
+        INSERT INTO cm_search_recommend_product(productID,
+                                                tinyTypeID,
+                                                sort,
+                                                delFlag)
+        VALUES (#{productID},
+                #{tinyTypeID},
+                0,
+                0)
+    </insert>
+    <insert id="insertLadderPrice">
+        insert into product_ladder_price (productId, userType, ladderNum,
+                                          buyNum, buyPrice, createBy, createDate, delFlag)
+        values (#{productId}, 3, #{ladderNum},
+                #{buyNum}, #{buyPrice}, #{createBy},
+                #{createDate}, '0')
+    </insert>
+
+    <insert id="insertProduct" keyColumn="productID" keyProperty="productID"
+            parameterType="com.caimei.modules.product.entity.Product" useGeneratedKeys="true">
+        INSERT INTO `product` (
+        `brandID`,
+        `tinyTypeID`,
+        <if test="productCategory != null and  productCategory != '' ">
+            `productCategory`,
+        </if>
+        `preferredFlag`,
+        `selfTypeID`,
+        `shopID`,
+        `name`,
+        `aliasName`,
+        `searchKey`,
+        `productRemarks`,
+        `normalPrice`,
+        `price`,
+        `priceFlag`,
+        `beautyActFlag`,
+        `ladderPriceFlag`,
+        <if test="stock != null and  stock != '' ">
+            `stock`,
+        </if>
+        `hasSkuFlag`,
+        `mainImage`,
+        `propertiesInfo`,
+        `addTime`,
+        `updateTime`,
+        `weekSellNumber`,
+        `beforeValidFlag`,
+        `validFlag`,
+        `favoriteTimes`,
+        `commentScore`,
+        `commentTimes`,
+        `selfRecommendFlag`,
+        `sysRecommendFlag`,
+        `sortIndex`,
+        `featuredFlag`,
+        `featuredSortIndex`,
+        `productCode`,
+        `unit`,
+        `synToERPFlag`,
+        `allAreaFlag`,
+        `provinceIDs`,
+        `serviceNumber`,
+        `maxBuyNumber`,
+        `minBuyNumber`,
+        `packageCount`,
+        `byFlag`,
+        `normalProductFlag`,
+        `wholeSaleProductFlag`,
+        `promotionProductFlag`,
+        `groupBuyProductFlag`,
+        `step`,
+        `actFlag`,
+        `actStatus`,
+        `actSort`,
+        `actType`,
+        `visibility`,
+        `onlineTime`,
+        `downlineTime`,
+        `freePostFlag`,
+        `costPrice`,
+        `costProportional`,
+        `costCheckFlag`,
+        `precisehKey`,
+        `tags`,
+        `productType`,
+        `machineType`,
+        `qualificationImg`,
+        `includedTax`,
+        `taxPoint`,
+        `invoiceType`,
+        `recommendType`,
+        `combinationID`,
+        `combinationSort`,
+        announType
+        )
+        VALUES
+        (
+        #{brandID},
+        #{tinyTypeID},
+        <if test="productCategory != null and  productCategory != '' ">
+            #{productCategory},
+        </if>
+        #{preferredFlag},
+        #{selfTypeID},
+        #{shopID},
+        #{name},
+        #{aliasName},
+        #{searchKey},
+        #{productRemarks},
+        #{normalPrice},
+        #{price},
+        #{priceFlag},
+        #{beautyActFlag},
+        #{ladderPriceFlag},
+        <if test="stock != null and  stock != '' ">
+            #{stock},
+        </if>
+        #{hasSkuFlag},
+        #{mainImage},
+        #{propertiesInfo},
+        #{addTime},
+        #{updateTime},
+        #{weekSellNumber},
+        #{beforeValidFlag},
+        #{validFlag},
+        #{favoriteTimes},
+        #{commentScore},
+        #{commentTimes},
+        #{selfRecommendFlag},
+        #{sysRecommendFlag},
+        #{sortIndex},
+        #{featuredFlag},
+        #{featuredSortIndex},
+        #{productCode},
+        #{unit},
+        #{synToERPFlag},
+        #{allAreaFlag},
+        #{provinceIDs},
+        #{serviceNumber},
+        #{maxBuyNumber},
+        #{minBuyNumber},
+        #{packageCount},
+        #{byFlag},
+        #{normalProductFlag},
+        #{wholeSaleProductFlag},
+        #{promotionProductFlag},
+        #{groupBuyProductFlag},
+        #{step},
+        #{actFlag},
+        #{actStatus},
+        #{actSort},
+        #{actType},
+        #{visibility},
+        #{onlineTime},
+        #{downlineTime},
+        #{freePostFlag},
+        #{costPrice},
+        #{costProportional},
+        #{costCheckFlag},
+        #{precisehKey},
+        #{tags},
+        #{productType},
+        #{machineType},
+        #{qualificationImg},
+        #{includedTax},
+        #{taxPoint},
+        #{invoiceType},
+        #{recommendType},
+        #{combinationID},
+        #{combinationSort},
+        #{announType}
+        )
+    </insert>
+
+    <insert id="insertProductDetailInfo">
+        insert into productdetailinfo
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="productID != null">
+                `productID`,
+            </if>
+            <if test="detailInfo != null and detailInfo != ''">
+                `detailInfo`,
+            </if>
+            <if test="serviceInfo != null and serviceInfo != ''">
+                `serviceInfo`,
+            </if>
+            <if test="orderInfo != null and orderInfo != ''">
+                `orderInfo`,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="productID != null">
+                #{productID},
+            </if>
+            <if test="detailInfo != null and detailInfo != ''">
+                #{detailInfo},
+            </if>
+            <if test="serviceInfo != null and serviceInfo != ''">
+                #{serviceInfo},
+            </if>
+            <if test="orderInfo != null and orderInfo != ''">
+                #{orderInfo},
+            </if>
+        </trim>
+    </insert>
+
+    <select id="getrecommendProductList" resultType="product">
+        select
+        a.*,
+        csrp.sort AS sort,
+        csrp.id AS recommendProductId,
+        b.name AS brandName,
+        s.name AS shopName
+        FROM
+        cm_search_recommend_product csrp
+        LEFT JOIN product a on a.productID = csrp.productID
+        LEFT JOIN shop s on s.shopID = a.shopID
+        left join cm_brand b on b.id = a.brandID
+        WHERE
+        csrp.tinyTypeId = #{tinyTypeID}
+        <if test="name != null and name != ''">
+            AND a.name like concat('%', #{name} ,'%')
+        </if>
+        <if test="validFlag !=null and validFlag !=''">
+            AND a.validFlag=#{validFlag}
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name like concat('%', #{shopName} ,'%')
+        </if>
+        <if test="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+        and a.productCategory = 1
+        AND a.validFlag != 0
+        AND csrp.delFlag =0
+        ORDER BY csrp.sort DESC
+    </select>
+
+
+    <select id="relatedProductList" resultType="product">
+        select
+        <include refid="productColumns"/>,
+        b.name AS brandName,
+        (case when a.tinyTypeID = #{tinyTypeID} then '1' else '0' end) AS defaultType
+        FROM product a
+        <include refid="productJoins"/>
+        left join brand b on b.brandID = a.brandID
+        WHERE (a.productID
+        IN (select productID from product_custom_classification where tinyTypeID = #{tinyTypeID})
+        OR a.tinyTypeID = #{tinyTypeID})
+        <if test="name != null and name != ''">
+            AND a.name like concat('%', #{name} ,'%')
+        </if>
+        <if test="validFlag !=null and validFlag !=''">
+            AND a.validFlag=#{validFlag}
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name like concat('%', #{shopName} ,'%')
+        </if>
+        <if test="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+        AND a.validFlag != 0
+        and a.productCategory = 1
+    </select>
+
+    <delete id="deleteProductCustomClassification">
+        delete
+        from product_custom_classification
+        where productID = #{productID}
+          and tinyTypeID = #{tinyTypeID}
+    </delete>
+    <delete id="deleteLadderPriceByProductId">
+        DELETE
+        FROM product_ladder_price
+        where productId = #{productID}
+    </delete>
+    <delete id="deleteLadderPriceById">
+        DELETE
+        FROM product_ladder_price
+        where id = #{id}
+    </delete>
+
+    <select id="toAddProductCustomClassificationList" resultType="product">
+        select
+        <include refid="productColumns"/>,
+        b.name AS brandName
+        FROM product a
+        <include refid="productJoins"/>
+        left join cm_brand b on b.id = a.brandID
+        WHERE a.tinyTypeID != #{tinyTypeID}
+        and not exists
+        (select pcc.id from product_custom_classification pcc where pcc.productID = a.productID and pcc.tinyTypeID =
+        #{tinyTypeID})
+        and a.validFlag = '2'
+        and (select count(id) from product_custom_classification pcc where pcc.productID = a.productID) <![CDATA[ < ]]>
+        5
+        <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="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+    </select>
+
+
+    <select id="toAddProductList" resultType="product">
+        select
+        a.*,
+        b.name AS brandName,
+        s.name AS shopName
+        FROM product a
+        LEFT JOIN shop s on s.shopID = a.shopID
+        left join cm_brand b on b.id = a.brandID
+        WHERE
+        NOT EXISTS (select * from cm_search_recommend_product csrp where csrp.productID = a.productID and
+        csrp.tinyTypeID = #{tinyTypeID} AND csrp.delFlag = 0)
+        and a.validFlag = '2'
+        <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="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+        and a.productCategory = 1
+    </select>
+
+    <select id="getProductTypes" resultType="com.caimei.modules.product.entity.ProductCustomClassification">
+        select *
+        from product_custom_classification
+        where productID = #{productID}
+    </select>
+
+
+    <select id="findRecommendActivityListPage" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="ActivityJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+
+
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            AND a.validFlag = 2
+            AND (a.actType != 3 or a.`actType` IS NULL or (a.actType = 3 and STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
+            <![CDATA[  <  ]]> STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i')))
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findGroupActivityListPage" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="ActivityJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="actStatus != null and actStatus != '' and actStatus == 1">
+                AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
+            </if>
+            <if test="actStatus != null and actStatus != '' and actStatus == 2">
+                AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  >  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
+                AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
+            </if>
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            AND a.validFlag = 2
+            AND ((a.actType != 1 AND a.actType != 2 OR a.`actType` IS NULL) or a.actFlag = 0)
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
+        SELECT
+        *
+        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
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+
+        </where>
+    </select>
+    <select id="findSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
+        SELECT
+        *
+        FROM smalltype a
+        <where>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+        </where>
+    </select>
+    <select id="findTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
+        SELECT
+        *
+        FROM tinytype a
+        <where>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+        </where>
+    </select>
+
+    <select id="findProductRecommendList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
+        select cpr.id                 AS id,
+               cpr.productID          AS productID,
+               cpr.recommendProductID AS recommendProductID,
+               cpr.sort               AS sort,
+               pro.name               AS productName,
+               pro.unit               AS unit,
+               pro.mainImage          AS img,
+               cpr.shopName           AS shopName
+        from cm_product_recommend cpr
+                 join product pro on cpr.recommendProductID = pro.productID
+        where cpr.productID = #{productID}
+        order by cpr.sort desc
+    </select>
+
+    <select id="findProductRecommendCount" resultType="int">
+        select count(1)
+        from cm_product_recommend cpr
+        where cpr.productID = #{productID}
+    </select>
+
+    <select id="findProductList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
+        select
+        a.productID AS productID,
+        a.name AS productName,
+        a.unit AS unit,
+        a.mainImage AS img,
+        s.name AS shopName
+        from product a
+        <include refid="ActivityJoins"/>
+        <where>
+            <choose>
+                <when test="commodityType != null and commodityType != ''">
+                    AND a.commodityType = #{commodityType}
+                </when>
+                <when test="bigTypeID != null and bigTypeID != ''">
+                    AND a.bigTypeID = #{bigTypeID}
+                </when>
+                <when test="smallTypeID != null and smallTypeID != ''">
+                    AND a.smallTypeID = #{smallTypeID}
+                </when>
+                <when test="tinyTypeID != null and tinyTypeID != ''">
+                    AND a.tinyTypeID = #{tinyTypeID}
+                </when>
+            </choose>
+            <if test="productName != null and productName != ''">
+                and a.name like concat('%', #{productName} ,'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                and s.name like concat('%', #{shopName} ,'%')
+            </if>
+            and a.productCategory = 1
+        </where>
+        <!--		limit 0, 10-->
+    </select>
+
+    <update id="updateRecommendType">
+        UPDATE product
+        SET recommendType = #{recommendType}
+        WHERE productID = #{productID}
+    </update>
+
+    <update id="updateBrnadId">
+        UPDATE product
+        set brandID = #{brandID}
+        WHERE productID = #{productID}
+    </update>
+
+    <update id="updateProductByBrandId">
+        UPDATE product
+        set brandID = null
+        WHERE brandID = #{brandId}
+    </update>
+    <select id="getProductIdByBrandId" resultType="java.lang.Integer">
+        SELECT productID
+        FROM product
+        WHERE brandID = #{brandId}
+    </select>
+    <update id="updateTinyType">
+        UPDATE product
+        set tinyTypeID = #{tinyTypeID}
+        WHERE productID = #{productID}
+    </update>
+    <update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
+        update product
+        <set>
+            <if test="productDescribe != null and productDescribe != ''">
+                productDescribe = #{productDescribe},
+            </if>
+            <if test="productDetail != null and productDetail != ''">
+                productDetail = #{productDetail},
+            </if>
+            <if test="brandID != null and brandID != ''">
+                brandID = #{brandID},
+            </if>
+            <if test="bigTypeID != null and bigTypeID !=''">
+                bigTypeID = #{bigTypeID},
+                smallTypeID = #{smallTypeID},
+                tinyTypeID = #{tinyTypeID},
+            </if>
+            <if test="preferredFlag != null and preferredFlag !=''">
+                preferredFlag = #{preferredFlag},
+            </if>
+            <if test="shopID != null and shopID !=''">
+                shopID = #{shopID},
+            </if>
+            <if test="name != null and name !=''">
+                `name` = #{name},
+            </if>
+            <if test="aliasName != null and aliasName !=''">
+                aliasName = #{aliasName},
+            </if>
+            <if test="searchKey != null and searchKey !=''">
+                searchKey = #{searchKey},
+            </if>
+            <if test="productRemarks != null and productRemarks !=''">
+                productRemarks = #{productRemarks},
+            </if>
+            <if test="combinationID != null and combinationID !=''">
+                combinationID = #{combinationID},
+            </if>
+            <if test="normalPrice != null and normalPrice !=''">
+                normalPrice = #{normalPrice},
+            </if>
+            <if test="price != null and price !=''">
+                price = #{price},
+            </if>
+            <if test="priceFlag != null and priceFlag !=''">
+                priceFlag = #{priceFlag},
+            </if>
+            <if test="beautyActFlag != null and beautyActFlag !=''">
+                beautyActFlag = #{beautyActFlag},
+            </if>
+            <if test="ladderPriceFlag != null and ladderPriceFlag !=''">
+                ladderPriceFlag = #{ladderPriceFlag},
+            </if>
+            <if test="stock != null and stock !=''">
+                stock = #{stock},
+            </if>
+            <if test="hasSkuFlag != null and hasSkuFlag !=''">
+                hasSkuFlag = #{hasSkuFlag},
+            </if>
+            <if test="mainImage != null and mainImage !=''">
+                mainImage = #{mainImage},
+            </if>
+            <if test="propertiesInfo != null and propertiesInfo !=''">
+                propertiesInfo = #{propertiesInfo},
+            </if>
+            <if test="addTime != null and addTime !=''">
+                addTime = #{addTime},
+            </if>
+            <if test="updateTime != null and updateTime !=''">
+                updateTime = #{updateTime},
+            </if>
+            <if test="weekSellNumber != null and weekSellNumber !=''">
+                weekSellNumber = #{weekSellNumber},
+            </if>
+            <if test="beforeValidFlag != null and beforeValidFlag !=''">
+                beforeValidFlag = #{beforeValidFlag},
+            </if>
+            <if test="validFlag != null and validFlag !=''">
+                validFlag = #{validFlag},
+            </if>
+            <if test="favoriteTimes != null and favoriteTimes !=''">
+                favoriteTimes = #{favoriteTimes},
+            </if>
+            <if test="commentScore != null and commentScore !=''">
+                commentScore = #{commentScore},
+            </if>
+            <if test="commentTimes != null and commentTimes !=''">
+                commentTimes = #{commentTimes},
+            </if>
+            <if test="selfRecommendFlag != null and selfRecommendFlag !=''">
+                selfRecommendFlag = #{selfRecommendFlag},
+            </if>
+            <if test="sysRecommendFlag != null and sysRecommendFlag !=''">
+                sysRecommendFlag = #{sysRecommendFlag},
+            </if>
+            <if test="sortIndex != null and sortIndex != ''">
+                sortIndex = #{sortIndex},
+            </if>
+            <if test="featuredFlag != null and featuredFlag !=''">
+                featuredFlag = #{featuredFlag},
+            </if>
+            <if test="featuredSortIndex != null and featuredSortIndex !=''">
+                featuredSortIndex = #{featuredSortIndex},
+            </if>
+            <if test="productCode != null and productCode !=''">
+                productCode = #{productCode},
+            </if>
+            <if test="unit != null and unit !=''">
+                unit = #{unit},
+            </if>
+            <if test="synToERPFlag != null and synToERPFlag !=''">
+                synToERPFlag = #{synToERPFlag},
+            </if>
+            <if test="allAreaFlag != null and allAreaFlag !=''">
+                allAreaFlag = #{allAreaFlag},
+            </if>
+            <if test="provinceIDs != null and provinceIDs !=''">
+                provinceIDs = #{provinceIDs},
+            </if>
+            <if test="serviceNumber != null and serviceNumber !=''">
+                serviceNumber = #{serviceNumber},
+            </if>
+            <if test="maxBuyNumber != null and maxBuyNumber !=''">
+                maxBuyNumber = #{maxBuyNumber},
+            </if>
+            <if test="minBuyNumber != null and minBuyNumber !=''">
+                minBuyNumber = #{minBuyNumber},
+            </if>
+            <if test="packageCount != null and packageCount !=''">
+                packageCount = #{packageCount},
+            </if>
+            <if test="byFlag != null and byFlag !=''">
+                byFlag = #{byFlag},
+            </if>
+            <if test="normalProductFlag != null and normalProductFlag !=''">
+                normalProductFlag = #{normalProductFlag},
+            </if>
+            <if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">
+                wholeSaleProductFlag = #{wholeSaleProductFlag},
+            </if>
+            <if test="promotionProductFlag != null and promotionProductFlag !=''">
+                promotionProductFlag = #{promotionProductFlag},
+            </if>
+            <if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">
+                groupBuyProductFlag = #{groupBuyProductFlag},
+            </if>
+            <if test="step != null and step !=''">
+                step = #{step},
+            </if>
+            <if test="actFlag != null and actFlag !=''">
+                actFlag = #{actFlag},
+            </if>
+            <if test="actSort != null and actSort !=''">
+                actSort = #{actSort},
+            </if>
+            <if test="actType != null and actType !=''">
+                actType = #{actType},
+            </if>
+            <if test="onlineTime != null and onlineTime !=''">
+                onlineTime = #{onlineTime},
+            </if>
+            <if test="downlineTime != null and downlineTime !=''">
+                downlineTime = #{downlineTime},
+            </if>
+            <if test="freePostFlag != null and freePostFlag !=''">
+                freePostFlag = #{freePostFlag},
+            </if>
+            <if test="costPrice != null and costPrice != ''">
+                costPrice = #{costPrice},
+            </if>
+            <if test="costProportional != null and costProportional !=''">
+                costProportional = #{costProportional},
+            </if>
+            <if test="costCheckFlag != null and costCheckFlag !=''">
+                costCheckFlag = #{costCheckFlag},
+            </if>
+            <if test="precisehKey != null and precisehKey !=''">
+                precisehKey = #{precisehKey},
+            </if>
+            <if test="visibility != null and visibility !=''">
+                visibility = #{visibility},
+            </if>
+            <if test="productType != null and productType !=''">
+                productType = #{productType},
+            </if>
+            <if test="qualificationImg != null and qualificationImg !=''">
+                qualificationImg = #{qualificationImg},
+            </if>
+            <if test="qualificationImg != null and qualificationImg !=''">
+                qualificationImg = #{qualificationImg},
+            </if>
+            <if test="invoiceType != null and invoiceType !=''">
+                invoiceType = #{invoiceType},
+            </if>
+            <if test="taxPoint != null and taxPoint !=''">
+                taxPoint = #{taxPoint},
+            </if>
+            <if test="supplierTaxPoint != null and supplierTaxPoint !=''">
+                supplierTaxPoint = #{supplierTaxPoint},
+            </if>
+            <if test="endTimeStr != null and endTimeStr !=''">
+                endTimeStr = #{endTimeStr},
+            </if>
+            <if test="tags != null and tags !=''">
+                tags = #{tags},
+            </if>
+            <if test="recommendType != null and recommendType !=''">
+                recommendType = #{recommendType},
+            </if>
+            <if test="machineType != null and machineType !=''">
+                machineType = #{machineType},
+            </if>
+            <if test="includedTax != null and includedTax !=''">
+                includedTax = #{includedTax},
+            </if>
+            <if test="invoiceType != null and invoiceType !=''">
+                invoiceType = #{invoiceType},
+            </if>
+            <if test="commodityType != null and commodityType != ''">
+                commodityType = #{commodityType},
+            </if>
+            <if test="trainingMethod != null">
+                trainingMethod = #{trainingMethod},
+            </if>
+            <if test="trainingType != null">
+                trainingType = #{trainingType},
+            </if>
+            <if test="announType!=null">
+                announType=#{announType},
+            </if>
+            <if test="trainingFee != null">
+                trainingFee = #{trainingFee},
+            </if>
+            <if test="newvalidFlag !=null">
+                newvalidFlag=#{newvalidFlag},
+            </if>
+            splitCode = #{splitCode}
+        </set>
+        where productID = #{productID}
+    </update>
+    <update id="updateproductDetailInfo" parameterType="com.caimei.modules.product.entity.ProductDetailInfo">
+        update productdetailinfo
+        <set>
+            <if test="propValueAlias != null and propValueAlias != ''">
+                propValueAlias = #{propValueAlias},
+            </if>
+            <if test="propValueImages != null and propValueImages !=''">
+                propValueImages = #{propValueImages},
+            </if>
+            <if test="detailInfo != null">
+                detailInfo = #{detailInfo},
+            </if>
+            <if test="commonDetailInfo != null">
+                commonDetailInfo = #{commonDetailInfo},
+            </if>
+            <if test="detailInfoTxt != null">
+                detailInfoTxt = #{detailInfoTxt},
+            </if>
+            <if test="seoTitle != null and seoTitle !=''">
+                seoTitle = #{seoTitle},
+            </if>
+            <if test="seoKeyword != null and seoKeyword !=''">
+                seoKeyword = #{seoKeyword},
+            </if>
+            <if test="seoDes != null and seoDes !=''">
+                seoDes = #{seoDes},
+            </if>
+            <if test="serviceInfo != null ">
+                serviceInfo = #{serviceInfo},
+            </if>
+            <if test="orderInfo != null ">
+                orderInfo = #{orderInfo},
+            </if>
+        </set>
+        where productID = #{productID}
+    </update>
+    <update id="updateLadderPrice">
+        update product_ladder_price
+        set productId  = #{productId},
+            ladderNum  = #{ladderNum},
+            buyNum     = #{buyNum},
+            buyPrice   = #{buyPrice},
+            updateBy   = #{updateBy},
+            updateDate = #{updateDate},
+            delFlag    = #{delFlag}
+        where id = #{id}
+    </update>
+    <update id="updateMainImage">
+        update product
+        set mainImage =#{mainImage}
+        where productID = #{productID}
+    </update>
+
+    <select id="getProductByTypeName" resultType="com.caimei.modules.brand.entity.BrandAndProductType">
+        select b.name   AS "bigTypeName",
+               b.bigTypeID,
+               s.`name` AS "smallTypeName",
+               s.smalltypeID,
+               t.name   AS "tinyTypeName",
+               t.tinytypeID
+        from tinytype t
+                 LEFT JOIN smalltype s on t.smallTypeID = s.smallTypeID
+                 LEFT JOIN bigtype b ON b.bigTypeID = s.bigTypeID
+        where b.`name` = #{name}
+          AND s.`name` = #{name1}
+          AND t.name = #{name2}
+    </select>
+
+    <select id="findRecommendBySys" resultType="com.caimei.modules.product.entity.CmProductRecommend">
+        select p.productID AS recommendProductID,
+               p.name      AS productName,
+               p.unit      AS unit,
+               p.mainImage AS img,
+               s.name      AS shopName
+        from product p
+                 left join shop s on s.shopID = p.shopID
+        where p.tinyTypeID = #{tinyTypeID}
+          and p.productCategory = 1
+        order by p.sellNumber
+                desc
+        limit 0, 7
+    </select>
+
+    <select id="getSecondHandRecommend" resultType="CmSecondHandRecommendVo">
+        select p.productID       AS id,
+               1                 AS type,
+               p.name            AS name,
+               p.unit            AS unit,
+               p.mainImage       AS img,
+               s.name            AS shopName,
+               p.productCategory as "productCategory"
+        from product p
+                 left join shop s on s.shopID = p.shopID
+        where p.productID = #{productID}
+          AND p.validFlag = '2'
+    </select>
+
+    <select id="querySecondHandRecommend" resultType="CmSecondHandRecommendVo">
+        select
+        p.productID AS id,
+        1 AS type,
+        p.name AS name,
+        p.unit AS unit,
+        p.mainImage AS img,
+        s.name AS shopName,
+        p.productCategory as "productCategory"
+        from product p
+        left join shop s on s.shopID = p.shopID
+        <where>
+            <if test="productID != null and productID != ''">
+                p.productID = #{productID}
+            </if>
+            <if test="productName != null and productName != ''">
+                and p.name like concat('%', #{productName} ,'%')
+            </if>
+            AND p.validFlag = '2'
+            and p.productCategory = #{queryProductType}
+        </where>
+        limit 0, 10
+    </select>
+    <select id="queryProductDetailInfo" resultType="com.caimei.modules.product.entity.ProductDetailInfo">
+        SELECT *
+        FROM productdetailinfo
+        where productID = #{productID}
+    </select>
+    <select id="findProductLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
+        SELECT *
+        FROM product_ladder_price
+        WHERE productId = #{productId}
+          AND userType = #{userType}
+          AND buyNum is NOT null
+          AND buyPrice is NOT null
+          AND delFlag = 0
+        ORDER BY ladderNum ASC
+    </select>
+    <select id="findActList" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="actType !=null and actType !=''">
+                AND a.actType=#{actType}
+            </if>
+            AND a.actStatus = 1
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
+        select p.productID,p.mainImage,p.name,s.name as shopName from product p left join shop s on p.shopID = s.shopID
+        <where>
+            (p.actFlag=0 or p.actType is null) and p.validFlag = 2 and p.productCategory = 1
+            <if test="productIds != null and productIds != '' ">
+                and p.productID != #{productIds}
+            </if>
+            <if test="productID != null and productID != ''">
+                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>
+        order by productID asc
+    </select>
+
+    <select id="findProductImage" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="productID !=null">
+                AND a.productID=#{productID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </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="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="productCategory !=null and productCategory !=''">
+                AND a.productCategory=#{productCategory}
+            </if>
+            <if test="ids != null and ids.size() > 0">
+                AND a.productID NOT IN
+                <foreach collection="ids" close=")" separator="," open="(" item="id">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID asc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="newfindProductImage" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <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="showFlag != null and showFlag != ''">
+                AND a.showFlag LIKE concat('%',#{shopName},'%')
+            </if>
+            and a.newvalidFlag=1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID asc
+            </otherwise>
+        </choose>
+    </select>
+
+
+    <select id="findProductDetail" resultType="java.lang.String">
+        select productDetail
+        from product
+        where productID = #{productID}
+    </select>
+    <select id="findProductDescribe" resultType="java.lang.String">
+        select productDescribe
+        from product
+        where productID = #{productID}
+    </select>
+    <select id="findSepcialShopList" resultType="com.caimei.modules.product.entity.CmShop">
+        select name, shopID
+        from shop
+        where shopType = 2
+    </select>
     <select id="getSplitCodeByProductId" resultType="java.lang.String">
-		select splitCode from product where productID = #{productID}
-	</select>
-	<select id="findSplitCodesByShopId" resultType="com.caimei.modules.product.entity.CmSplitCode">
-		select shopId,commercialCode as splitCode,codeDetail as codeName,email
-		from cm_shop_splitcode
-		where shopId = #{shopID}
-	</select>
+        select splitCode
+        from product
+        where productID = #{productID}
+    </select>
+    <select id="findSplitCodesByShopId" resultType="com.caimei.modules.product.entity.CmSplitCode">
+        select shopId, commercialCode as splitCode, codeDetail as codeName, email
+        from cm_shop_splitcode
+        where shopId = #{shopID}
+    </select>
 </mapper>

+ 197 - 0
src/main/webapp/WEB-INF/views/modules/newhome/newFloorcontentForm.jsp

@@ -0,0 +1,197 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>固定楼层内容管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+        //PC端状态修改
+        function updateEnabledStatus(status,ids){
+            var msg='确定启用该楼层吗?';
+            if('0'==status){
+                msg='确定停用该楼层吗?';
+            }
+            top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
+                if(v=='ok'){
+                    $.post("${ctx}/newhome/newPageFloor/updateEnabledStatus",{'enabledStatus':status,'ids':ids}, function(data) {
+                        if(true==data.success){
+                            $.jBox.tip(data.msg, 'info');
+                        } else {
+                            $.jBox.tip(data.msg,'error');
+                        }
+                        window.location = "${ctx}/newhome/newPageFloor/";
+                    },"JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            },{buttonsFocus:1,persistent: true});
+        }
+
+
+        //CRM端状态修改
+        function updateCrmEnabledStatusByIds(status,ids){
+            var msg='确定启用该楼层吗?';
+            if('0'==status){
+                msg='确定停用该楼层吗?';
+            }
+            top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
+                if(v=='ok'){
+                    $.post("${ctx}/newhome/newPageFloor/updateCrmEnabledStatusByIds",{'crmEnabledStatus':status,'ids':ids}, function(data) {
+                        if(true==data.success){
+                            $.jBox.tip(data.msg, 'info');
+                        } else {
+                            $.jBox.tip(data.msg,'error');
+                        }
+                        window.location = "${ctx}/newhome/newPageFloor/";
+                    },"JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            },{buttonsFocus:1,persistent: true});
+        }
+
+		/**
+		 * @param obj
+		 * jquery控制input只能输入数字
+		 */
+		function onlynum(obj) {
+			obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+		}
+
+		function offoce(){
+			var html = "<div id='auditBox'>"
+					+ "<div class='bd-row'>"
+					+ "    <span><font color='red'>*</font>展示时间:</span>"
+					+ "   <input type='text' name='showTime' class='input-medium required'/>"
+					+ "<span>天</span>"
+					+ "</div>"
+					+ "</div>";
+			<%--var submit = function (v, h, f) {--%>
+			<%--	if (f.auditStatus == '') {--%>
+			<%--		$.jBox.tip("请选择状态", 'error', {focusId: "validFlag"});--%>
+			<%--		return false;--%>
+			<%--	}--%>
+			<%--	$.post("${ctx}/product/new/auditProductBySencondProduct", {--%>
+			<%--		'productID': id,--%>
+			<%--		'validFlag': f.validFlag--%>
+			<%--	}, function (data) {--%>
+			<%--		if (true == data.success) {--%>
+			<%--			$.jBox.tip(data.msg, 'info');--%>
+			<%--			$("#searchForm").submit();--%>
+			<%--		} else {--%>
+			<%--			$.jBox.tip(data.msg, 'error');--%>
+			<%--		}--%>
+			<%--	}, "JSON");--%>
+			<%--};--%>
+			$.jBox(html, {title: "提示"});
+		}
+
+
+
+		//批量保存排序
+		function batchSaveSort() {
+			var items = new Array();
+			var $items = $('.check-item');
+			$items.each(function(){
+				items.push($(this).val());
+			});
+			//保存批量排序
+			$.post("${ctx}/newhome/newPageFloor/batchSaveSort?sortList="+items, function(data) {
+				if(true==data.success){
+					$.jBox.tip(data.msg, 'info');
+					window.location.href = "${ctx}/newhome/newPageFloor";
+				} else {
+					$.jBox.tip(data.msg,'error');
+				}
+			},"JSON");//这里返回的类型有:json,html,xml,text
+		}
+
+		//修改排序值
+		function changeSort(id,sortThis) {
+			var value = sortThis.value;
+			$("#preferredProductSort"+id).val(id+"-"+value);
+		}
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/newhome/newPageFloor/lists">固定楼层管理列表</a></li>
+		<li class="active"><a href="${ctx}/newhome/newPageFloor/ContentPage">内容</a></li>
+	</ul>
+	<form:form id="searchForm" action="${ctx}/newhome/newPageFloor/ContentPage" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			<label>商品ID:</label>
+			<input name="productID" path="productID" maxlength="50" class="input-medium"/>
+			<label>商品名称:</label>
+			<input name="name" path="name" maxlength="50" class="input-medium"/>
+			<label>供应商:</label>
+			<input name="shopName"  path="shopName" maxlength="50" class="input-medium"/>
+			<label>展示状态:</label>
+			<select name="showFlag" class="input-medium">
+				<option selected value="0">请选择</option>
+				<option value="1">已展示</option>
+				<option value="2">已下线</option>
+				<option value="3">展示过期</option>
+			</select>
+			<input class="btn btn-primary" style="width: 70px" onclick="batchSaveSort()" value="一键排序"/>&nbsp;&nbsp;&nbsp;&nbsp;
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		</div>
+	</form:form>
+
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>商品ID</th>
+				<th>商品名称</th>
+				<th>供应商</th>
+				<th>展示状态</th>
+				<th>展示时间</th>
+				<th>排序</th>
+				<th>重点推荐</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${list}" var="list">
+			<tr>
+				<input class="check-item" type="hidden" id="preferredProductSort${newPageFloor.id}" value='${newPageFloor.id}-${newPageFloor.sort}'/>
+				<td>${list.productID}</td>
+				<td>${list.name}</td>
+				<td>${list.shopName}</td>
+				<td>
+					<c:if test="${list.showFlag eq 1 }">
+						<font color="green">已展示</font>
+					</c:if>
+					<c:if test="${list.showFlag eq 2}">
+						<font color="#ff8c00">展示过期</font>
+					</c:if>
+					<c:if test="${list.showFlag eq 3}">
+						<font color="red">已下线</font>
+					</c:if></td>
+				<td>1</td>
+				<td><input  id="sort" name="sort" style="width:50px;" value="${list.sort}"  onkeyup="onlynum(this)"  onchange="changeSort(${newPageFloor.id},this)"></td><%----%>
+				<td><fmt:formatDate value="${list.showTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+				<td>
+		          <a class="red" href="javascript:void(0);" onclick="offoce()">更改展示时间</a>
+               </td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+</body>
+</html>

+ 5 - 5
src/main/webapp/WEB-INF/views/modules/newhome/newPageFloorForm.jsp

@@ -45,14 +45,14 @@
 				<form:input path="floorDetail" htmlEscape="false" maxlength="30" class="input-xlarge required"/>
 			</div>
 		</div>
-      <c:if test="${not empty newPageFloor.floorType}">
+      <c:if test="${not empty newPageFloor.floorType || newPageFloor.floorType eq 0 }">
 		<div class="control-group crmstatus" style="" >
 			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>楼层类型:</label>
 			<div class="controls">
-				<select name="floorType" class="input-xlarge required">
-					<option selected value="">请选择</option>
-					<option value="1">新品橱窗</option>
-				</select>
+				<form:select path="floorType" class="input-xlarge required">
+					<form:option value="" label="请选择"></form:option>
+					<form:option value="1" label="新品橱窗"></form:option>
+				</form:select>
 			</div>
 		</div>
 	</c:if>

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/newhome/newPageFloorLists.jsp

@@ -101,7 +101,7 @@
 	</ul>
 	<form:form action="" class="breadcrumb form-search">
 		<input class="btn btn-primary" style="width: 70px" onclick="batchSaveSort()" value="一键排序"/>&nbsp;&nbsp;&nbsp;&nbsp;
-		<input class="btn btn-primary" style="width: 70px" onclick="window.location='${ctx}/newhome/newPageFloor/form'" value="添加楼层"/>
+		<input class="btn btn-primary" style="width: 70px" onclick="window.location='${ctx}/newhome/newPageFloor/form?floorType=0'" value="添加楼层"/>
 		<div style="margin-top: 10px">
 			<label><font color="#a9a9a9">注:排序值越小越靠前</font></label>
 		</div>
@@ -161,7 +161,7 @@
 				<td><fmt:formatDate value="${newPageFloor.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
 				<shiro:hasPermission name="newhome:newPageFloor:edit"><td>
     				<a href="${ctx}/newhome/newPageFloor/form?id=${newPageFloor.id}">编辑</a>
-                    <a href="${ctx}/newhome/newPageFloor/goContentPage?floorId=${newPageFloor.id}">内容</a>
+                    <a href="${ctx}/newhome/newPageFloor/ContentPage?floorId=${newPageFloor.id}">内容</a>
     				<shiro:hasPermission name="newhome:newPageFloor:delete">
 					<a href="${ctx}/newhome/newPageFloor/delete?id=${newPageFloor.id}" onclick="return confirmx('确定删除该楼层吗?', this.href)">删除</a>
 					</shiro:hasPermission>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp

@@ -747,7 +747,7 @@
             <th><span class="red">*</span>首页新品展示:</th>
             <td colspan="3">
                 <label><input type="radio" name="newvalidFlag" value="0"
-                              ${product.newvalidFlag == "1" ? "checked" : ""}>参与新品展示<b
+                              ${product.newvalidFlag == "0" ? "checked" : ""}>参与新品展示<b
                         class="line">|</b></label>
                 <label><input type="radio" name="newvalidFlag" value="2"
                              ${product.newvalidFlag == "1" ? "" : "checked"}>不参与新品展示</label>