chao 3 роки тому
батько
коміт
79aa9eb018

+ 11 - 2
src/main/java/com/caimei365/commodity/components/PriceUtilService.java

@@ -107,8 +107,17 @@ public class PriceUtilService {
         price.setActStatus(0);
         // 用户身份: 2-会员机构, 4-普通机构
         price.setUserIdentity(identity);
-        // 设置价格标志(协销|价格公开|仅对医美机构公开|仅对会员机构公开|供应商)
-        boolean setFlag = identity == 1 || priceFlag == 0 || (priceFlag == 3 && clubType == 1) || (priceFlag == 2 && (identity == 2 || isSuperVip)) || identity == 3;
+        //是否是供应商自己的商品
+        boolean isShopOwn = false;
+        if (identity == 3){
+            // 根据用户Id查询供应商Id
+            Integer shopId = priceMapper.getShopIdByUserId(userId);
+            if (null != shopId && shopId.equals(price.getShopId())){
+                isShopOwn = true;
+            }
+        }
+        // 设置价格标志(协销|价格公开|仅对医美机构公开|仅对会员机构公开|供应商自己的商品)
+        boolean setFlag = identity == 1 || priceFlag == 0 || (priceFlag == 3 && clubType == 1) || (priceFlag == 2 && (identity == 2 || isSuperVip)) || isShopOwn;
         if (setFlag) {
             // 设置划线价
             price.setOriginalPrice(price.getPrice());

+ 4 - 0
src/main/java/com/caimei365/commodity/mapper/PriceMapper.java

@@ -65,4 +65,8 @@ public interface PriceMapper {
      * 会员机构类型:1医美,2生美
      */
     Integer getClubTypeById(Integer userId);
+    /**
+     * 根据用户Id查询供应商Id
+     */
+    Integer getShopIdByUserId(Integer userId);
 }

+ 3 - 0
src/main/resources/mapper/PriceMapper.xml

@@ -140,4 +140,7 @@
     <select id="getClubTypeById" resultType="java.lang.Integer">
         SELECT firstClubType FROM club WHERE userID = #{userId}
     </select>
+    <select id="getShopIdByUserId" resultType="java.lang.Integer">
+        SELECT shopID FROM shop WHERE userID = #{userId}
+    </select>
 </mapper>

+ 0 - 1
src/main/resources/mapper/SearchMapper.xml

@@ -127,7 +127,6 @@
         s.businessScope as s_business,
         s.townID as s_town_id,
         CONCAT(p.name, c.name) as s_address,
-        s.sortIndex as s_sort,
         s.status as s_valid
     </sql>
     <sql id="Supplier_Joins">