Browse Source

fixed 商品查询权限优化

fushengqian 3 months ago
parent
commit
40cf8ae330

+ 1 - 1
db/fuint-db.sql

@@ -467,7 +467,7 @@ DROP TABLE IF EXISTS `mt_goods`;
 
 
 CREATE TABLE `mt_goods` (
 CREATE TABLE `mt_goods` (
   `ID` int NOT NULL AUTO_INCREMENT COMMENT '自增ID',
   `ID` int NOT NULL AUTO_INCREMENT COMMENT '自增ID',
-  `TYPE` varchar(30) DEFAULT 'product' COMMENT '商品类别',
+  `TYPE` varchar(30) DEFAULT 'goods' COMMENT '商品类别',
   `MERCHANT_ID` int DEFAULT '0' COMMENT '所属商户ID',
   `MERCHANT_ID` int DEFAULT '0' COMMENT '所属商户ID',
   `STORE_ID` int DEFAULT '0' COMMENT '所属店铺ID',
   `STORE_ID` int DEFAULT '0' COMMENT '所属店铺ID',
   `NAME` varchar(100) DEFAULT '' COMMENT '商品名称',
   `NAME` varchar(100) DEFAULT '' COMMENT '商品名称',

+ 3 - 3
fuint-application/src/main/java/com/fuint/common/service/impl/GoodsServiceImpl.java

@@ -108,9 +108,9 @@ public class GoodsServiceImpl extends ServiceImpl<MtGoodsMapper, MtGoods> implem
         }
         }
         String storeId = paginationRequest.getSearchParams().get("storeId") == null ? "" : paginationRequest.getSearchParams().get("storeId").toString();
         String storeId = paginationRequest.getSearchParams().get("storeId") == null ? "" : paginationRequest.getSearchParams().get("storeId").toString();
         if (StringUtils.isNotBlank(storeId)) {
         if (StringUtils.isNotBlank(storeId)) {
-            lambdaQueryWrapper.eq(MtGoods::getStoreId, storeId)
-                               .or(qw -> qw.eq(MtGoods::getStoreId, 0)
-                               .inSql(MtGoods::getId, "SELECT s.goods_id FROM mt_store_goods s WHERE s.store_id = "+ storeId +" and s.status='A'"));
+            lambdaQueryWrapper.and(qw -> qw.eq(MtGoods::getStoreId, storeId)
+                                        .or(qw2 -> qw2.eq(MtGoods::getStoreId, 0)
+                                        .inSql(MtGoods::getId, "SELECT s.GOODS_ID FROM mt_store_goods s WHERE s.STORE_ID = "+storeId+" AND s.status = 'A'")));
         }
         }
         String type = paginationRequest.getSearchParams().get("type") == null ? "" : paginationRequest.getSearchParams().get("type").toString();
         String type = paginationRequest.getSearchParams().get("type") == null ? "" : paginationRequest.getSearchParams().get("type").toString();
         if (StringUtils.isNotBlank(type)) {
         if (StringUtils.isNotBlank(type)) {