From 23855599412c4d61b38d78f0f3abd3430a48b5b1 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 25 六月 2025 11:51:38 +0800
Subject: [PATCH] Merge branch 'mdc_hyjs_master'

---
 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcUserProductionServiceImpl.java |  152 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 152 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcUserProductionServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcUserProductionServiceImpl.java
new file mode 100644
index 0000000..f236c24
--- /dev/null
+++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcUserProductionServiceImpl.java
@@ -0,0 +1,152 @@
+package org.jeecg.modules.system.service.impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.system.entity.MdcProduction;
+import org.jeecg.modules.system.entity.MdcUserProduction;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.mapper.MdcUserProductionMapper;
+import org.jeecg.modules.system.model.ProductionIdModel;
+import org.jeecg.modules.system.service.IMdcProductionService;
+import org.jeecg.modules.system.service.IMdcUserProductionService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description: 鐢ㄦ埛浜х嚎琛�
+ * @author: LiuS
+ * @create: 2023-03-27 11:58
+ */
+@Service
+public class MdcUserProductionServiceImpl extends ServiceImpl<MdcUserProductionMapper, MdcUserProduction> implements IMdcUserProductionService {
+
+    @Resource
+    private IMdcProductionService mdcProductionService;
+
+    /**
+     * 鏍规嵁鐢ㄦ埛id鏌ヨ浜х嚎淇℃伅
+     */
+    @Override
+    public List<ProductionIdModel> queryProductionIdsOfUser(String userId) {
+        LambdaQueryWrapper<MdcUserProduction> queryUserPro = new LambdaQueryWrapper<>();
+        LambdaQueryWrapper<MdcProduction> queryPro = new LambdaQueryWrapper<>();
+        try {
+            queryUserPro.eq(MdcUserProduction::getUserId, userId);
+            List<String> proIdList = new ArrayList<>();
+            List<ProductionIdModel> proIdModelList = new ArrayList<>();
+            List<MdcUserProduction> userProList = this.list(queryUserPro);
+            if (userProList != null && !userProList.isEmpty()) {
+                for (MdcUserProduction userProduction : userProList) {
+                    proIdList.add(userProduction.getProId());
+                }
+                queryPro.in(MdcProduction::getId, proIdList);
+                List<MdcProduction> proList = mdcProductionService.list(queryPro);
+                if (proList != null && !proList.isEmpty()) {
+                    for (MdcProduction mdcProduction : proList) {
+                        proIdModelList.add(new ProductionIdModel().convertByUserProduction(mdcProduction));
+                    }
+                }
+                return proIdModelList;
+            }
+        } catch (Exception e) {
+            e.fillInStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 鏍规嵁鎸囧畾鐢ㄦ埛id鏌ヨ浜х嚎id闆嗗悎
+     */
+    @Override
+    public List<String> queryProductionIdsByUserId(String userId) {
+        return this.baseMapper.queryProductionIdsByUserId(userId);
+    }
+
+    /**
+     * 鏍规嵁涓�缁勮溅闂磇d鏌ヨ鐢ㄦ埛浜х嚎淇℃伅
+     * @param productionIds
+     */
+    @Override
+    public List<MdcUserProduction> queryByProductionIds(List<String> productionIds){
+        if (!productionIds.isEmpty()){
+            return super.list(new LambdaQueryWrapper<MdcUserProduction>().in(MdcUserProduction::getProId, productionIds));
+        }
+        return null;
+    }
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class})
+    public boolean removeByCollection(List<MdcUserProduction> mdcUserProductions) {
+        if(mdcUserProductions == null || mdcUserProductions.isEmpty())
+            return false;
+        if(mdcUserProductions.size() == 1){
+            return super.removeById(mdcUserProductions.get(0).getId());
+        }
+        List<String> ids = new ArrayList<>();
+        mdcUserProductions.forEach(item -> {
+            ids.add(item.getId());
+        });
+        return super.removeByIds(ids);
+    }
+
+    /**
+     * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛鍒楄〃
+     * @param proId
+     * @return
+     */
+    @Override
+    public List<SysUser> getUserPermsByGroupId(String proId){
+        return super.getBaseMapper().getUserPermsByGroupId(proId);
+    }
+
+    /**
+     * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛鍒楄〃
+     * @param proId
+     * @return
+     */
+    @Override
+    public List<SysUser> getUserNonPermsByGroupId(String proId){
+        return super.getBaseMapper().getUserNonPermsByGroupId(proId);
+    }
+
+    /**
+     * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛
+     * @param proId
+     * @return
+     */
+    @Override
+    public List<SysUser> getUserNonPermsByDeviceId(String proId){
+        return super.getBaseMapper().getUserNonPermsByDeviceId(proId);
+    }
+
+    @Override
+    public List<SysUser> getUserPermsByDeviceId(String proId) {
+        return super.getBaseMapper().getUserPermsByDeviceId(proId);
+    }
+
+    /**
+     * 閫氳繃杞﹂棿id涓庡矖浣峣d绛涢�夌敤鎴�
+     * @param post
+     * @param proId
+     * @return
+     */
+    @Override
+    public List<SysUser> queryByPostAndProId(String post, String proId){
+        return super.getBaseMapper().queryByPostAndProId(post, proId);
+    }
+
+    @Override
+    public MdcUserProduction getByUserIdAndGroupId(String userId, String proId){
+        if(StrUtil.isEmpty(userId) || StrUtil.isEmpty(proId))
+            return null;
+        List<MdcUserProduction> list = super.lambdaQuery().eq(MdcUserProduction::getUserId, userId).eq(MdcUserProduction::getProId, proId).list();
+        if(list == null || list.isEmpty())
+            return null;
+        return list.get(0);
+    }
+}

--
Gitblit v1.9.3