Ver código fonte

Merge branch 'master' of http://116.63.33.55/git/industry-data-platform

lry 8 meses atrás
pai
commit
f761a31488

+ 19 - 1
industry-admin/src/views/device/deviceLedger/itemList.vue

@@ -50,6 +50,7 @@ import {
     updateLedgerItemSort, updateLedgerItemType
 } from '@/api/device/deviceLedger'
 import { getDictListByType } from '@/api/system/dict';
+import {getUid} from "@/utils/auth";
 
 export default {
     mounted() {
@@ -108,6 +109,11 @@ export default {
                     type: 'input',
                     methodName: "handleInputChange",
                     width:'80'
+                },
+                {
+                  propName: "createUserName",
+                  labelName: "创建人",
+                  align: "left",
                 }
             ],
             tableData: [],
@@ -118,6 +124,7 @@ export default {
                     style: 'color: red;',
                     icon: 'el-icon-delete',
                     methodName: "deleteItem",
+                  hidden: row => this.showDelete(row.createUserId)
                 }
             ],
             queryParam: {
@@ -232,6 +239,14 @@ export default {
         },
         /** 批量删除点位 */
         multipleDelItemEvent() {
+          const otherUserCheckItemList = this.checkItemList.filter(o => !this.showDelete(o.createUserId))
+          if (otherUserCheckItemList && otherUserCheckItemList.length > 0) {
+            this.$message({
+              message: '请取消选择其他创建人创建的数据!',
+              type: 'warning'
+            })
+            return
+          }
             if (!this.checkItemList || this.checkItemList.length == 0) {
                 this.$message({
                     message: '请至少选择一项数据!',
@@ -268,7 +283,10 @@ export default {
         addItemEvent() {
             this.$refs.addItem.deviceLedgerId = this.queryParam.deviceLedgerId
             this.$refs.addItem.visible = true
-        }
+        },
+      showDelete(userId){
+        return !userId || getUid() == userId
+      }
     }
 }
 </script>

+ 0 - 1
industry-admin/src/views/largeScreen/deviceDataItem/index.vue

@@ -200,7 +200,6 @@ export default {
     },
     /** 批量删除点位 */
     multipleDelDeviceDataItemEvent() {
-      debugger
       const otherUserCheckItemList = this.checkItemList.filter(o => !this.showDelete(o.createUserId))
       if (otherUserCheckItemList && otherUserCheckItemList.length > 0) {
         this.$message({

+ 4 - 0
industry-system/cqcy-ei-common/src/main/java/com/example/opc_common/entity/DeviceLedgerItem.java

@@ -17,6 +17,10 @@ public class DeviceLedgerItem extends ItemsParent{
     private Integer ledgerItemType;
     //排序号
     private Integer sortNum;
+    // 创建用户ID
+    private String createUserId;
+    // 创建用户
+    private String createUserName;
 
     /**
      * 根据台账点位以及数据模型,生成由id为键,数据模型为值得map

+ 6 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/controller/DeviceLedgerController.java

@@ -10,6 +10,7 @@ import com.example.opc_common.util.Blank;
 import com.example.opc_common.util.Result;
 import com.example.opc_da.annotation.WebLog;
 import com.example.opc_da.service.DeviceLedgerService;
+import com.example.opc_da.util.UserUtil;
 import com.example.opc_da.util.downloadExcel.DownloadExcelUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,6 +18,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import javax.validation.constraints.Min;
@@ -36,6 +38,9 @@ public class DeviceLedgerController {
     @Autowired
     private DeviceLedgerService deviceLedgerService;
 
+    @Resource
+    private UserUtil userUtil;
+
     /**
      * 新增设备目录
      *
@@ -317,7 +322,7 @@ public class DeviceLedgerController {
         if (Blank.isEmpty(deviceLedgerId, itemIdList)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
         }
-        return deviceLedgerService.addLedgerItemList(deviceLedgerId, itemIdList);
+        return deviceLedgerService.addLedgerItemList(deviceLedgerId, itemIdList, userUtil.getCurrentUserId());
     }
 
     /**

+ 1 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/dao/DeviceLedgerDao.java

@@ -80,7 +80,7 @@ public interface DeviceLedgerDao {
 
     Integer getLedgerItem(List<Integer> itemIdList);
 
-    Integer addLedgerItemList(Integer deviceLedgerId, List<Integer> itemIdList);
+    Integer addLedgerItemList(Integer deviceLedgerId, List<Integer> itemIdList, String createUserId);
 
     Integer updateLedgerItemSort(Integer deviceLedgerId, Integer itemId, Integer sortNum);
 

+ 1 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/service/DeviceLedgerService.java

@@ -41,7 +41,7 @@ public interface DeviceLedgerService {
 
     Result getLedgerItemList(Integer page, Integer limit, Integer deviceLedgerId, String itemReadName);
 
-    Result addLedgerItemList(Integer deviceLedgerId, List<Integer> itemIdList);
+    Result addLedgerItemList(Integer deviceLedgerId, List<Integer> itemIdList, String createUserId);
 
     Result updateLedgerItemSort(Integer deviceLedgerId, Integer itemId, Integer sortNum);
 

+ 2 - 2
industry-system/industry-da/src/main/java/com/example/opc_da/service/impl/DeviceLedgerServiceImpl.java

@@ -400,12 +400,12 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
     }
 
     @Override
-    public synchronized Result addLedgerItemList(Integer deviceLedgerId, List<Integer> itemIdList) {
+    public synchronized Result addLedgerItemList(Integer deviceLedgerId, List<Integer> itemIdList, String createUserId) {
         Integer count = deviceLedgerDao.getLedgerItem(itemIdList);
         if (count != 0) {
             return Result.no(ResultEnum.SUCCESS.getRespCode(), "设备台账点位含有重复的点位,添加失败");
         }
-        if (deviceLedgerDao.addLedgerItemList(deviceLedgerId, itemIdList) <= 0) {
+        if (deviceLedgerDao.addLedgerItemList(deviceLedgerId, itemIdList, createUserId) <= 0) {
             return Result.no(ResultEnum.SUCCESS.getRespCode(), "添加设备台账点位失败");
         }
         return Result.ok("添加设备台账点位成功");

+ 5 - 2
industry-system/industry-da/src/main/resources/mapper/DeviceLedgerDao.xml

@@ -72,10 +72,10 @@
     </insert>
 
     <insert id="addLedgerItemList">
-        insert into t_device_ledger_item(device_ledger_id, item_id ,sort_num)
+        insert into t_device_ledger_item(device_ledger_id, item_id ,sort_num,create_user_id)
         values
         <foreach collection="itemIdList" item="itemId" index="index" separator=",">
-            (#{deviceLedgerId}, #{itemId}, 0)
+            (#{deviceLedgerId}, #{itemId}, 0, #{createUserId})
         </foreach>
     </insert>
 
@@ -528,9 +528,12 @@
         ti.describe,
         ti.unit,
         tdli.sort_num
+        ,tdli.create_user_id
+        ,u.user_name create_user_name
         from t_device_ledger_item tdli
         left join t_item ti on tdli.item_id = ti.id
         left join t_item_group tig on ti.item_group_id=tig.id
+        left join sys_user u on tdli.create_user_id = u.user_id
         where tdli.device_ledger_id = #{deviceLedgerId}
         <if test="itemReadName !=null and itemReadName !=''">
             AND ti.item_read_name LIKE CONCAT('%',#{itemReadName},'%')