Duan_xu 2 лет назад
Родитель
Сommit
6e35350c46

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

@@ -396,6 +396,9 @@ public class ProductService extends CrudService<ProductDao, Product> {
         }else if(product.getNewProductType()==2){
             product.setShowFlag(3);
         }
+        if(product.getVisibility()==null){
+            product.setVisibility("3");
+        }
 //        if(StringUtils.isNotBlank(product.getSplitCode())&&"0".equals(product.getSplitCode())){
 //            product.setSplitCode(null);
 //        }

+ 166 - 153
src/main/resources/mappings/modules/product/ProductNewMapper.xml

@@ -7,8 +7,8 @@
     </resultMap>
     <sql id="productColumns">
         a.newvalidFlag,
-       ifnull(a.newProductType,2),
-        ifnull(a.announType,1),
+      ifnull(a.newProductType,2) as newProductType,
+        ifnull(a.announType,1) as announType,
         a.productID AS "id",
         a.productID AS "productID",
         a.brandID AS "brandID",
@@ -121,7 +121,7 @@
         INNER JOIN smalltype AS c ON b.`smallTypeID` = c.`smallTypeID`
         INNER JOIN bigtype AS d ON c.`bigTypeID` = d.`bigTypeID`
     </sql>
-	<select id="get" resultType="Product">
+    <select id="get" resultType="Product">
         SELECT
         <include refid="productColumns"/>
         FROM product a
@@ -130,7 +130,11 @@
     </select>
 
     <select id="getProductParams" resultType="com.caimei.modules.product.entity.ProductParameters">
-        select * from cm_product_related_parameters where productId =  #{productId}  and delFlag = 0 LIMIT 50
+        select *
+        from cm_product_related_parameters
+        where productId = #{productId}
+          and delFlag = 0
+        LIMIT 50
     </select>
 
     <select id="findList" resultType="Product">
@@ -140,8 +144,7 @@
         <include refid="productJoins"/>
         LEFT JOIN cm_product_activity cp on cp.productId = a.productID
         <where>
-            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-            AND a.productID NOT IN (6060, 6061, 6062, 6063, 6064,6065, 6066, 6067, 6068, 6069)
+
             <if test="id !=null and id !=''">
                 AND a.productID=#{id}
             </if>
@@ -157,6 +160,9 @@
             <if test="tinyTypeID != null and tinyTypeID != 0">
                 AND a.tinyTypeID = #{tinyTypeID}
             </if>
+            <if test="newProductType !=null">
+                AND a.newProductType=#{newProductType}
+            </if>
             <if test="productCategory != null and productCategory != ''">
                 AND a.productCategory = #{productCategory}
                 <if test="productCategory == 2">
@@ -222,26 +228,22 @@
             <if test="publishIdentity != null and publishIdentity !=''">
                 AND cshd.publishIdentity = #{publishIdentity}
             </if>
-                <if test="announType !=null and announType!= ''">
-                    AND a.announType=#{announType}
-                </if>
+            <if test="announType !=null and announType!= ''">
+                AND a.announType=#{announType}
+            </if>
             <if test="newvalidFlag !=null and newvalidFlag!= ''">
                 AND a.newvalidFlag=#{newvalidFlag}
             </if>
-                <if test="newProductType !=null">
-            AND a.newProductType=#{newProductType}
-        </if>
-            <if test="newProductType ==2">
-                AND a.newProductType=2
-                or a.newProductType is null
-            </if>
+
             <if test="contactName !=null and contactName !=''">
-                AND (cshd.contactName LIKE concat('%',#{contactName},'%') or cshd.companyName LIKE concat('%',#{contactName},'%'))
+                AND (cshd.contactName LIKE concat('%',#{contactName},'%') or cshd.companyName LIKE
+                concat('%',#{contactName},'%'))
             </if>
             <if test="sqlMap !=null and sqlMap !=''">
                 ${sqlMap.dsf}
             </if>
-
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            AND a.productID NOT IN (6060, 6061, 6062, 6063, 6064,6065, 6066, 6067, 6068, 6069)
         </where>
         <choose>
             <when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -276,7 +278,7 @@
         select *
         from productimage
         where productID = #{productId}
-        ORDER BY mainFlag DESC ,sortIndex is null,sortIndex  ASC
+        ORDER BY mainFlag DESC, sortIndex is null, sortIndex ASC
     </select>
     <select id="getImageById" resultType="com.caimei.po.ProductImage">
         select *
@@ -284,10 +286,14 @@
         where productImageID = #{productImageID}
     </select>
     <select id="getValidFlagByProductId" resultType="java.lang.String">
-        select validFlag from product where productID = #{productID}
+        select validFlag
+        from product
+        where productID = #{productID}
     </select>
     <select id="getBeforeValidFlagByProductId" resultType="java.lang.String">
-        select beforeValidFlag from product where productID = #{productID}
+        select beforeValidFlag
+        from product
+        where productID = #{productID}
     </select>
 
     <insert id="insert" parameterType="Product" keyProperty="id" useGeneratedKeys="true">
@@ -404,68 +410,68 @@
     </insert>
     <update id="update">
         UPDATE product
-        SET productID                   = #{id},
-            brandID                     = #{brandID},
-            tinyTypeID                  = #{tinyTypeID},
-            productCategory             = #{productCategory},
-            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},
-            productType                 = #{productType},
-            qualificationImg            = #{qualificationImg},
-            includedTax                 = #{includedTax},
-            invoiceType                 = #{invoiceType},
-            taxPoint                    = #{taxPoint},
-            supplierTaxPoint            = #{supplierTaxPoint}
+        SET productID            = #{id},
+            brandID              = #{brandID},
+            tinyTypeID           = #{tinyTypeID},
+            productCategory      = #{productCategory},
+            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},
+            productType          = #{productType},
+            qualificationImg     = #{qualificationImg},
+            includedTax          = #{includedTax},
+            invoiceType          = #{invoiceType},
+            taxPoint             = #{taxPoint},
+            supplierTaxPoint     = #{supplierTaxPoint}
         WHERE productID = #{id}
     </update>
 
@@ -483,7 +489,10 @@
     </insert>
 
     <select id="newFloorId" resultType="java.lang.Integer">
-        select id from new_page_floor where floorType=1 limit 1
+        select id
+        from new_page_floor
+        where floorType = 1
+        limit 1
     </select>
 
     <update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
@@ -693,9 +702,9 @@
             <if test="showTime!= '' and showTime!=null">
                 showTime=#{showTime},
             </if>
-        <if test="newvalidFlag == 1">
-            showFlag=1
-        </if>
+            <if test="newvalidFlag == 1">
+                showFlag=1
+            </if>
             <if test="newvalidFlag == 2">
                 showFlag=4
             </if>
@@ -703,72 +712,74 @@
         where productID = #{productID}
     </update>
     <update id="updateImageSort">
-		update productimage set sortIndex = #{sortIndex}
-		where productImageID = #{productImageID}
+        update productimage
+        set sortIndex = #{sortIndex}
+        where productImageID = #{productImageID}
+    </update>
+    <update id="cancelImageMainFlag">
+        update productimage
+        set mainFlag = 0
+        where productID = #{productID}
+          and mainFlag = 1
+    </update>
+    <update id="setImageMainFlag">
+        update productimage
+        set mainFlag = 1
+        where productImageID = #{productImageID}
     </update>
-	<update id="cancelImageMainFlag">
-		update productimage set mainFlag = 0
-		where productID = #{productID}
-		and mainFlag = 1
-	</update>
-	<update id="setImageMainFlag">
-		update productimage set mainFlag = 1
-		where productImageID = #{productImageID}
-	</update>
     <update id="setProductImage">
-        UPDATE product SET mainImage = #{mainImage}
+        UPDATE product
+        SET mainImage = #{mainImage}
         WHERE productID = #{productID}
     </update>
     <delete id="deleteImage">
-		DELETE FROM productimage
-		WHERE productImageID = #{productImageID}
-	</delete>
+        DELETE
+        FROM productimage
+        WHERE productImageID = #{productImageID}
+    </delete>
     <delete id="mulDeleteImage">
-		DELETE FROM productimage
-		WHERE productImageID IN
-		<foreach collection="idList" item="productImageID" index="index" open="(" separator="," close=")">
+        DELETE FROM productimage
+        WHERE productImageID IN
+        <foreach collection="idList" item="productImageID" index="index" open="(" separator="," close=")">
             #{productImageID}
         </foreach>
     </delete>
 
     <delete id="deleteParameters">
-        DELETE FROM cm_product_related_parameters WHERE productId = #{productId}
+        DELETE
+        FROM cm_product_related_parameters
+        WHERE productId = #{productId}
     </delete>
 
     <delete id="deleteImageByProductId">
-        DELETE FROM productimage WHERE productID = #{productID}
+        DELETE
+        FROM productimage
+        WHERE productID = #{productID}
     </delete>
 
-    <insert id="insertParameters"  parameterType="com.caimei.modules.product.entity.ProductParameters">
-        insert into
-        cm_product_related_parameters
+    <insert id="insertParameters" parameterType="com.caimei.modules.product.entity.ProductParameters">
+        insert into cm_product_related_parameters
         (productId,
-        paramsName,
-        paramsContent,
-        delFlag)
-       values
-       (#{productId},
-        #{paramsName},
-        #{paramsContent},
-        #{delFlag})
+         paramsName,
+         paramsContent,
+         delFlag)
+        values (#{productId},
+                #{paramsName},
+                #{paramsContent},
+                #{delFlag})
     </insert>
 
     <insert id="insertStatusRecord">
-        INSERT INTO `product_status_record` (
-          `productId`,
-          `modifyUserId`,
-          `validFlag`,
-          `remarks`,
-          `addTime`
-        )
-        VALUES
-          (
-            #{productId},
-            #{modifyUserId},
-            #{validFlag},
-            #{remarks},
-            #{addTime}
-          )
+        INSERT INTO `product_status_record` (`productId`,
+                                             `modifyUserId`,
+                                             `validFlag`,
+                                             `remarks`,
+                                             `addTime`)
+        VALUES (#{productId},
+                #{modifyUserId},
+                #{validFlag},
+                #{remarks},
+                #{addTime})
     </insert>
     <insert id="addProductData">
         update product
@@ -780,36 +791,38 @@
     </insert>
 
     <select id="findAllStatusRemarks" resultType="com.caimei.modules.product.entity.ProductStatusRecord">
-        SELECT
-          id,
-          `productId`,
-          `modifyUserId`,
-          `validFlag`,
-          `remarks`,
-          `addTime`
-        FROM
-          `product_status_record`
-        WHERE
-          productId = #{productId}
-        ORDER BY
-          addTime DESC
+        SELECT id,
+               `productId`,
+               `modifyUserId`,
+               `validFlag`,
+               `remarks`,
+               `addTime`
+        FROM `product_status_record`
+        WHERE productId = #{productId}
+        ORDER BY addTime DESC
     </select>
     <select id="findSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
-        select shopId,commercialCode as splitCode,codeDetail as codeRemark
+        select shopId, commercialCode as splitCode, codeDetail as codeRemark
         from cm_shop_splitcode
-        where shopId=#{shopID}
+        where shopId = #{shopID}
     </select>
     <select id="findSplitCodeByProduct" resultType="java.lang.String">
-        select splitCode from product where productID = #{productID}
+        select splitCode
+        from product
+        where productID = #{productID}
     </select>
     <select id="getShopIdByName" resultType="java.lang.Integer">
-        select shopID from shop where name like concat('%',#{shopName},'%') order by shopID desc limit 1
+        select shopID
+        from shop
+        where name like concat('%', #{shopName}, '%')
+        order by shopID desc
+        limit 1
     </select>
     <select id="findSecondSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
-        select css.shopId,css.commercialCode as splitCode,css.codeDetail as codeRemark
+        select css.shopId, css.commercialCode as splitCode, css.codeDetail as codeRemark
         from cm_shop_splitcode css
-        left join product p on p.shopID = css.shopId
-        where p.productID=#{id}
+                 left join product p on p.shopID = css.shopId
+        where p.productID = #{id}
     </select>
 </mapper>