|
@@ -0,0 +1,232 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="com.caimei.modules.products.dao.CmMallOrganizeProductsDao">
|
|
|
+ <sql id="cmMallOrganizeProductsColumns">
|
|
|
+ a.id AS "id",
|
|
|
+ a.classifyID AS "classifyID",
|
|
|
+ a.organizeID AS "organizeID",
|
|
|
+ a.productID AS "productID",
|
|
|
+ a.normalPrice AS "normalPrice",
|
|
|
+ a.costPrice AS "costPrice",
|
|
|
+ a.retailPrice AS "retailPrice",
|
|
|
+ a.minBuyNumber AS "minBuyNumber",
|
|
|
+ a.preferredProduct AS "preferredProduct",
|
|
|
+ a.commonlyProduct AS "commonlyProduct",
|
|
|
+ a.preferentialProduct AS "preferentialProduct",
|
|
|
+ a.validFlag AS "validFlag",
|
|
|
+ a.preferredProductSort AS "preferredProductSort",
|
|
|
+ a.commonlyProductSort AS "commonlyProductSort",
|
|
|
+ a.preferentialProductSort AS "preferentialProductSort",
|
|
|
+ a.addTime AS "addTime",
|
|
|
+ a.updateTime AS "updateTime",
|
|
|
+ a.delFlag AS "delFlag",
|
|
|
+ p.mainImage AS "mainImage",
|
|
|
+ p.name AS "productName",
|
|
|
+ s.name AS "shopName",
|
|
|
+ cmpc.classifyName AS "productClassifyName"
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="cmMallOrganizeProductsJoins">
|
|
|
+ LEFT JOIN product p on p.productID = a.productID
|
|
|
+ LEFT JOIN shop s on s.shopID = p.shopID
|
|
|
+ LEFT JOIN cm_mall_products_classify cmpc on cmpc.id = a.classifyID
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="findList" resultType="com.caimei.modules.products.entity.CmMallOrganizeProducts">
|
|
|
+ SELECT
|
|
|
+ <include refid="cmMallOrganizeProductsColumns"/>
|
|
|
+ FROM cm_mall_organize_products a
|
|
|
+ <include refid="cmMallOrganizeProductsJoins"/>
|
|
|
+ <where>
|
|
|
+
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ AND a.id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="productID != null and productID != ''">
|
|
|
+ AND a.productID = #{productID}
|
|
|
+ </if>
|
|
|
+ <if test="organizeID != null and organizeID != ''">
|
|
|
+ AND a.organizeID = #{organizeID}
|
|
|
+ </if>
|
|
|
+ <if test="classifyID != null and classifyID != ''">
|
|
|
+ AND a.classifyID = #{classifyID}
|
|
|
+ </if>
|
|
|
+ <if test="preferredProduct != null and preferredProduct != '' and preferredProduct == 1">
|
|
|
+ AND a.preferredProduct = 1
|
|
|
+ </if>
|
|
|
+ <if test="preferredProduct != null and preferredProduct != '' and preferredProduct == 0">
|
|
|
+ AND (a.preferredProduct = 0 OR a.preferredProduct is NULL)
|
|
|
+ </if>
|
|
|
+ <if test="commonlyProduct != null and commonlyProduct != '' and commonlyProduct == 1 ">
|
|
|
+ AND a.commonlyProduct = 1
|
|
|
+ </if>
|
|
|
+ <if test="commonlyProduct != null and commonlyProduct != '' and commonlyProduct == 0 ">
|
|
|
+ AND (a.commonlyProduct = 0 OR a.commonlyProduct is NULL )
|
|
|
+ </if>
|
|
|
+ <if test="preferentialProduct != null and preferentialProduct != '' and preferentialProduct == 1">
|
|
|
+ AND a.preferentialProduct = 1
|
|
|
+ </if>
|
|
|
+ <if test="preferentialProduct != null and preferentialProduct != '' and preferentialProduct == 0">
|
|
|
+ AND (a.preferentialProduct = 0 or a.preferentialProduct is NULL)
|
|
|
+ </if>
|
|
|
+ <if test="validFlag != null and validFlag != ''">
|
|
|
+ AND a.validFlag = #{validFlag}
|
|
|
+ </if>
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ AND p.name LIKE concat('%',#{productName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="shopName != null and shopName != ''">
|
|
|
+ AND s.name LIKE concat('%',#{shopName},'%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY a.addTime DESC,a.id DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findAllModule" resultType="com.caimei.modules.products.entity.CmMallPageModules" parameterType="int">
|
|
|
+ SELECT
|
|
|
+ *
|
|
|
+ FROM
|
|
|
+ cm_mall_page_modules
|
|
|
+ WHERE
|
|
|
+ organizeID = #{organizeID}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="updateProductInfo">
|
|
|
+ UPDATE cm_mall_organize_products SET
|
|
|
+ classifyID = #{classifyID},
|
|
|
+ normalPrice = #{normalPrice},
|
|
|
+ costPrice = #{costPrice},
|
|
|
+ retailPrice = #{retailPrice},
|
|
|
+ minBuyNumber = #{minBuyNumber},
|
|
|
+ updateTime = #{updateTime}
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="get" resultType="com.caimei.modules.products.entity.CmMallOrganizeProducts">
|
|
|
+ SELECT
|
|
|
+ <include refid="cmMallOrganizeProductsColumns"/>
|
|
|
+ FROM cm_mall_organize_products a
|
|
|
+ <include refid="cmMallOrganizeProductsJoins"/>
|
|
|
+ WHERE a.id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="updateValidFlag">
|
|
|
+ UPDATE cm_mall_organize_products SET
|
|
|
+ <if test="preferredProduct != null and preferredProduct != ''">
|
|
|
+ preferredProduct = #{preferredProduct},
|
|
|
+ </if>
|
|
|
+ <if test="commonlyProduct != null and commonlyProduct != ''">
|
|
|
+ commonlyProduct = #{commonlyProduct},
|
|
|
+ </if>
|
|
|
+ <if test="preferentialProduct != null and preferentialProduct != ''">
|
|
|
+ preferentialProduct = #{preferentialProduct},
|
|
|
+ </if>
|
|
|
+ validFlag = #{validFlag},
|
|
|
+ updateTime = #{updateTime}
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="saveSort">
|
|
|
+ UPDATE cm_mall_organize_products SET
|
|
|
+ <if test="modules == 1">
|
|
|
+ preferredProductSort = #{preferredProductSort}
|
|
|
+ </if>
|
|
|
+ <if test="modules == 2">
|
|
|
+ preferentialProductSort = #{preferentialProductSort}
|
|
|
+ </if>
|
|
|
+ <if test="modules == 3">
|
|
|
+ commonlyProductSort = #{commonlyProductSort}
|
|
|
+ </if>
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="findListBuyMall" resultType="com.caimei.modules.products.entity.CmMallOrganizeProducts">
|
|
|
+ SELECT
|
|
|
+ <include refid="cmMallOrganizeProductsColumns"/>
|
|
|
+ FROM cm_mall_organize_products a
|
|
|
+ <include refid="cmMallOrganizeProductsJoins"/>
|
|
|
+ <where>
|
|
|
+
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ AND a.id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="productID != null and productID != ''">
|
|
|
+ AND a.productID = #{productID}
|
|
|
+ </if>
|
|
|
+ <if test="organizeID != null and organizeID != ''">
|
|
|
+ AND a.organizeID = #{organizeID}
|
|
|
+ </if>
|
|
|
+ <if test="classifyID != null and classifyID != ''">
|
|
|
+ AND a.classifyID = #{classifyID}
|
|
|
+ </if>
|
|
|
+ <if test="preferredProduct != null and preferredProduct != ''">
|
|
|
+ AND a.preferredProduct = #{preferredProduct}
|
|
|
+ </if>
|
|
|
+ <if test="commonlyProduct != null and commonlyProduct != ''">
|
|
|
+ AND a.commonlyProduct = #{commonlyProduct}
|
|
|
+ </if>
|
|
|
+ <if test="preferentialProduct != null and preferentialProduct != ''">
|
|
|
+ AND a.preferentialProduct = #{preferentialProduct}
|
|
|
+ </if>
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ AND p.name LIKE concat('%',#{productName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="shopName != null and shopName != ''">
|
|
|
+ AND s.name LIKE concat('%',#{shopName},'%')
|
|
|
+ </if>
|
|
|
+ AND a.validFlag = 1
|
|
|
+ </where>
|
|
|
+ ORDER BY a.addTime DESC,a.id DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getAllExistsProductList" resultType="Integer">
|
|
|
+ SELECT
|
|
|
+ a.id
|
|
|
+ FROM cm_mall_organize_products a
|
|
|
+ WHERE a.delFlag = 0
|
|
|
+ <if test="modules == 1">
|
|
|
+ and a.preferredProduct = 1
|
|
|
+ </if>
|
|
|
+ <if test="modules == 2">
|
|
|
+ and a.preferentialProduct = 1
|
|
|
+ </if>
|
|
|
+ <if test="modules == 3">
|
|
|
+ and a.commonlyProduct = 1
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="updateProductInfo1">
|
|
|
+ UPDATE cm_mall_organize_products SET
|
|
|
+ <if test="modules == 1">
|
|
|
+ preferredProduct = 1,
|
|
|
+ </if>
|
|
|
+ <if test="modules == 2">
|
|
|
+ preferentialProduct = 1,
|
|
|
+ </if>
|
|
|
+ <if test="modules == 3">
|
|
|
+ commonlyProduct = 1,
|
|
|
+ </if>
|
|
|
+ updateTime = #{updateTime}
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="canncelPreferredProduct">
|
|
|
+ UPDATE cm_mall_organize_products SET
|
|
|
+ <if test="modules == 1">
|
|
|
+ preferredProduct = 0,
|
|
|
+ preferredProductSort = null,
|
|
|
+ </if>
|
|
|
+ <if test="modules == 2">
|
|
|
+ preferentialProduct = 0,
|
|
|
+ preferentialProductSort = null,
|
|
|
+ </if>
|
|
|
+ <if test="modules == 3">
|
|
|
+ commonlyProduct = 0,
|
|
|
+ commonlyProductSort = null,
|
|
|
+ </if>
|
|
|
+ updateTime = #{updateTime}
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+</mapper>
|