瀏覽代碼

no message

FengChaoYu 7 月之前
父節點
當前提交
d09cba3d7f

+ 3 - 2
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/commonmapper/stock/MaterialGoodsStockCMapper.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.gree.mall.miniapp.bean.material.stock.WebsitStockDTO;
 import com.gree.mall.miniapp.bean.material.stock.WorkerStockBean;
 import com.gree.mall.miniapp.bean.material.stock.WorkerStockDTO;
+import com.gree.mall.miniapp.plus.entity.User;
 import com.gree.mall.miniapp.plus.entity.WebsitGoodsCategory;
 import com.gree.mall.miniapp.plus.entity.WebsitStock;
 import com.gree.mall.miniapp.plus.entity.WorkerStock;
@@ -20,7 +21,7 @@ public interface MaterialGoodsStockCMapper {
     @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
     List<WebsitGoodsCategory> queryWebsitGoodsCategoryList(
             @Param("websitId") String websitId,
-            @Param("userId") String userId,
+            @Param("user") User user,
             @Param("goodsType") String goodsType
     );
 
@@ -28,7 +29,7 @@ public interface MaterialGoodsStockCMapper {
     IPage<WorkerStockBean> queryWorkerStockList(
             IPage page,
             @Param("websitId") String websitId,
-            @Param("userId") String userId,
+            @Param("user") User user,
             @Param("goodsType") String goodsType,
             @Param("categoryId") String categoryId
     );

+ 2 - 2
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/material/stock/MaterialGoodsStockLogic.java

@@ -67,7 +67,7 @@ public class MaterialGoodsStockLogic {
      */
     public List<WebsitGoodsCategory> websitGoodsCategoryList(String webistId, String goodsType) {
         CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
-        List<WebsitGoodsCategory> websitGoodsCategories = materialGoodsStockCMapper.queryWebsitGoodsCategoryList(webistId, currentCompanyWechat.getUser().getWorkerNumber(), goodsType);
+        List<WebsitGoodsCategory> websitGoodsCategories = materialGoodsStockCMapper.queryWebsitGoodsCategoryList(webistId, currentCompanyWechat.getUser(), goodsType);
         return websitGoodsCategories;
     }
 
@@ -83,7 +83,7 @@ public class MaterialGoodsStockLogic {
     public IPage<WorkerStockBean> workerStockList(String websitId, String goodsType, String categoryId, Integer pageNum, Integer pageSize) {
         CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
         IPage<WorkerStockBean> workerStockBeanIPage = materialGoodsStockCMapper
-                .queryWorkerStockList(new Page(pageNum, pageSize), websitId, currentCompanyWechat.getUser().getWorkerNumber(), goodsType, categoryId);
+                .queryWorkerStockList(new Page(pageNum, pageSize), websitId, currentCompanyWechat.getUser(), goodsType, categoryId);
 
         return workerStockBeanIPage;
     }

+ 16 - 4
mall-miniapp-service/src/main/resources/mapper/WorkerStockCMapper.xml

@@ -17,8 +17,14 @@
             <if test="websitId != null and websitId !=''">
                 and c.websit_id = #{websitId}
             </if>
-            <if test="userId != null and userId !=''">
-                and c.worker_id = #{userId}
+            <if test="goodsType != null and goodsType == 'M'">
+                and c.identity = #{user.idCard}
+            </if>
+            <if test="goodsType != null and goodsType == 'P'">
+                and c.worker_id = #{user.workerNumber}
+            </if>
+            <if test="goodsType == null">
+                and c.worker_id = ''
             </if>
         </where>
     </select>
@@ -42,8 +48,14 @@
             <if test="websitId != null and websitId !=''">
                 and a.websit_id = #{websitId}
             </if>
-            <if test="userId != null and userId !=''">
-                and a.worker_id = #{userId}
+            <if test="goodsType != null and goodsType == 'M'">
+                and a.identity = #{user.idCard}
+            </if>
+            <if test="goodsType != null and goodsType == 'P'">
+                and a.worker_id = #{user.workerNumber}
+            </if>
+            <if test="goodsType == null">
+                and a.worker_id = ''
             </if>
             <if test="categoryId != null and categoryId !=''">
                 and b.goods_category_id = #{categoryId}