瀏覽代碼

设备新增代码提交

jingyuanchao 1 年之前
父節點
當前提交
9612b4819a

+ 10 - 2
project_data/sql/0.1.1/soc/soc.sql

@@ -1026,7 +1026,7 @@ BEGIN
             ADD COLUMN `device_status` int(2) NULL COMMENT '设备状态' AFTER `device_type`,
             ADD COLUMN `device_model` varchar(255) NULL COMMENT '设备型号' AFTER `device_brand`,
             ADD COLUMN `address` varchar(255) NULL COMMENT '安装位置' AFTER `device_model`,
-            ADD COLUMN `purchasing_time` datetime NULL COMMENT '采购时间' AFTER `address`,
+            ADD COLUMN `purchasing_time` date NULL COMMENT '采购时间' AFTER `address`,
             ADD COLUMN `use_time` datetime NULL COMMENT '开始使用时间' AFTER `maintenance_term`,
             ADD COLUMN `remove _time` datetime NULL COMMENT '移除时间' AFTER `use_time`,
             ADD COLUMN `scrap_time` datetime NULL COMMENT '报废时间' AFTER `remove _time`,
@@ -1042,4 +1042,12 @@ BEGIN
 	end if;
 END ??
 DELIMITER ;
-CALL schema_change();
+CALL schema_change();
+
+delete from sys_dict_type where dict_type='asset_status';
+delete from sys_dict_data where dict_type='asset_status';
+INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES ('资产状态', 'asset_status', '0', '超级管理员', '2024-09-27 15:57:25', '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (0, '待安装', '0', 'asset_status', null, 'default', 'N', '0', '超级管理员', '2024-09-27 15:58:39', '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (1, '使用中', '1', 'asset_status', null, 'default', 'N', '0', '超级管理员', '2024-09-27 15:59:01', '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (2, '移除', '2', 'asset_status', null, 'default', 'N', '0', '超级管理员', '2024-09-27 15:59:11', '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (3, '报废', '3', 'asset_status', null, 'default', 'N', '0', '超级管理员', '2024-09-27 15:59:22', '', null, null);

+ 6 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysMultiLayerDictionaryController.java

@@ -32,5 +32,11 @@ public class SysMultiLayerDictionaryController {
         final List<DictionaryTreeVo> list = sysMultiLayerDictionaryService.getDictionaryTree();
         return AjaxResult.success(list);
     }
+
+    @GetMapping("/getDictTreeByParentId")
+    private AjaxResult getDictTreeByParentId(Long parentId){
+        final List<DictionaryTreeVo> list = sysMultiLayerDictionaryService.getDictTreeByParentId(parentId);
+        return AjaxResult.success(list);
+    }
 }
 

+ 1 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysMultiLayerDictionaryService.java

@@ -19,4 +19,5 @@ public interface ISysMultiLayerDictionaryService extends IService<SysMultiLayerD
 
     List<DictionaryTreeVo> getDictionaryTree();
 
+    List<DictionaryTreeVo> getDictTreeByParentId(Long parentId);
 }

+ 2 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysDeviceServiceImpl.java

@@ -260,7 +260,9 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
     @Override
     public int insertSysDevice(SysDevice sysDevice) {
         sysDevice.setCreateTime(DateUtils.getNowDate());
+        sysDevice.setUpdateTime(DateUtils.getNowDate());
         sysDevice.setCreateBy(SecurityUtils.getUsername());
+        sysDevice.setUpdateBy(SecurityUtils.getUsername());
         SysOrg sysOrg = orgService.selectSysOrgById(sysDevice.getOrgId());
         sysDevice.setOrgName(sysOrg.getShortName());
         SysDevice sysDevice1 = this.checkName(sysDevice.getOrgId(), sysDevice.getDeviceName());

+ 10 - 2
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysMultiLayerDictionaryServiceImpl.java

@@ -30,8 +30,16 @@ public class SysMultiLayerDictionaryServiceImpl extends ServiceImpl<SysMultiLaye
         wrapper.eq(SysMultiLayerDictionary::getDeleted, 0);
         final List<SysMultiLayerDictionary> dictionaryList = baseMapper.selectList(wrapper);
         final List<DictionaryTreeVo> treeVoList = BeanHelper.copyProperties(dictionaryList, DictionaryTreeVo.class);
-        final List<DictionaryTreeVo> tree = buildTree(treeVoList, -1L);
-        return tree;
+        return buildTree(treeVoList, -1L);
+    }
+
+    @Override
+    public List<DictionaryTreeVo> getDictTreeByParentId(Long parentId) {
+        LambdaQueryWrapper<SysMultiLayerDictionary> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(SysMultiLayerDictionary::getDeleted, 0);
+        wrapper.eq(SysMultiLayerDictionary::getParentId, parentId);
+        final List<SysMultiLayerDictionary> dictionaryList = baseMapper.selectList(wrapper);
+        return BeanHelper.copyProperties(dictionaryList, DictionaryTreeVo.class);
     }
 
     //递归构建