Sfoglia il codice sorgente

知识库状态增加字典

jingyuanchao 2 anni fa
parent
commit
5090aa63ad

+ 8 - 1
project_data/sql/0.0.2/soc/soc.sql

@@ -2076,6 +2076,14 @@ insert into sys_role_menu select  id,1714187748136493058 from sys_role where rol
 insert into sys_role_menu select  id,1714187851295399937 from sys_role where role_name like '%省联社安全保卫管理人员%';
 insert into sys_role_menu select  id,1714188002965626881 from sys_role where role_name like '%省联社安全保卫管理人员%';
 insert into sys_role_menu select  id,1714188131026116609 from sys_role where role_name like '%省联社安全保卫管理人员%';
+
+delete from sys_dict_type where dict_type='materials_status';
+delete from sys_dict_data where dict_type='materials_status';
+INSERT INTO sys_dict_type ( dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES ('知识库状态', 'materials_status', '0', null, now(), '', 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', 'materials_status', null, 'default', 'N', '0', null, now(), '', 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', 'materials_status', null, 'default', 'N', '0', null, now(), '', 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', 'materials_status', null, 'default', 'N', '0', null, now(), '', null, null);
+
 -- -------------------------------------------------------
 -- ----------新增数据 end  ----------------------------
 -- -------------------------------------------------------
@@ -2180,7 +2188,6 @@ update sys_menu set menu_name ='教育培训计划下发' where menu_name='下
 delete from sys_role_menu where role_id in (select id from sys_role  where org_type=4) and menu_id in (select id from sys_menu m where menu_name like '%培训计划%');
 delete from sys_role_menu where role_id in (select id from sys_role  where org_type=4) and menu_id in (select id from sys_menu m where menu_name like '%演练计划%');
 
-
 -- -------------------------------------------------------
 -- ----------更新数据 end  ----------------------------
 -- -------------------------------------------------------

+ 12 - 6
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/SysLearningMaterialsServiceImpl.java

@@ -61,8 +61,8 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
 
         int checkSelect = checkSelect(request);
         dealParam(request);
-        Page<SysLearningMaterialsPageVo> page=null;
-        switch (checkSelect){
+        Page<SysLearningMaterialsPageVo> page = null;
+        switch (checkSelect) {
             case 1:
                 //不下穿查询其他机构: 仅查询目标机构公开数据
                 page = sysLearningMaterialsMapper.selectPageData1(request.getPageRequest(), request);
@@ -83,14 +83,14 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
                 //下穿查询子机构:查询下级公开数据
                 page = sysLearningMaterialsMapper.selectPageData5(request.getPageRequest(), request);
                 break;
-            default:break;
+            default:
+                break;
         }
-        if (page==null){
+        if (page == null) {
             return TableDataInfo.build();
         }
 
 
-
         for (SysLearningMaterialsPageVo record : page.getRecords()) {
             record.setNo(page.getRecords().indexOf(record));
         }
@@ -295,7 +295,13 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
     public int editOpen(Long id, Integer isOpen) {
         SysLearningMaterials sysLearningMaterials = sysLearningMaterialsMapper.selectById(id);
         if (sysLearningMaterials != null) {
-            sysLearningMaterials.setIsOpen(isOpen);
+            if (isOpen == 1) {
+                //发布:使用中
+                sysLearningMaterials.setIsOpen(isOpen);
+            } else if (isOpen == 0) {
+                //取消发布:停用
+                sysLearningMaterials.setIsOpen(2);
+            }
             sysLearningMaterials.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
             sysLearningMaterials.setUpdateTime(DateUtils.getNowDate());
             return sysLearningMaterialsMapper.updateById(sysLearningMaterials);