소스 검색

Merge remote-tracking branch 'origin/dev/ez-security210625' into dev/ez-security210625

# Conflicts:
#	dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/MenuMapper.java
#	dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/RoleSoftwareMenuMapper.java
#	dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/SoftwareMenuMapper.java
rengb 3 년 전
부모
커밋
aa2970fcf8
26개의 변경된 파일694개의 추가작업 그리고 71개의 파일을 삭제
  1. 5 1
      common/src/main/java/com/lantone/common/dto/MenuDTO.java
  2. 3 1
      common/src/main/java/com/lantone/common/vo/MenuVO.java
  3. 41 0
      common/src/main/java/com/lantone/common/vo/SaveDictionaryVO.java
  4. 25 0
      common/src/main/java/com/lantone/common/vo/ViewDictionaryInfoVO.java
  5. 87 0
      dblayer-mbg/src/main/java/com/lantone/dblayermbg/entity/SysDictionaryInfo.java
  6. 14 0
      dblayer-mbg/src/main/java/com/lantone/dblayermbg/facade/SysDictionaryInfoFacade.java
  7. 4 0
      dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/MenuMapper.java
  8. 1 1
      dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/RoleSoftwareMenuMapper.java
  9. 4 0
      dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/SoftwareMenuMapper.java
  10. 14 0
      dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/SysDictionaryInfoMapper.java
  11. 13 0
      dblayer-mbg/src/main/java/com/lantone/dblayermbg/service/SysDictionaryInfoService.java
  12. 17 0
      dblayer-mbg/src/main/java/com/lantone/dblayermbg/service/impl/SysDictionaryInfoServiceImpl.java
  13. 36 1
      dblayer-mbg/src/main/resources/mapper/MenuMapper.xml
  14. 4 4
      dblayer-mbg/src/main/resources/mapper/RoleSoftwareMenuMapper.xml
  15. 16 1
      dblayer-mbg/src/main/resources/mapper/SoftwareMenuMapper.xml
  16. 5 0
      dblayer-mbg/src/main/resources/mapper/SysDictionaryInfoMapper.xml
  17. 22 0
      dblayer-mbg/src/main/resources/mapper/base/BaseSysDictionaryInfoMapper.xml
  18. 20 0
      dblayer-mbg/src/main/resources/mapper/base/BaseSysRegionDeptMapper.xml
  19. 22 0
      dblayer-mbg/src/main/resources/mapper/base/BaseSysRegionMapper.xml
  20. 2 1
      gateway-service/src/main/resources/bootstrap.yml
  21. 12 1
      security-center/src/main/java/com/lantone/security/facade/DataAuthHandleFacade.java
  22. 86 0
      security-center/src/main/java/com/lantone/security/facade/DictionaryInfoFacade.java
  23. 165 58
      security-center/src/main/java/com/lantone/security/facade/FuncManagementFacade.java
  24. 64 0
      security-center/src/main/java/com/lantone/security/web/DictionaryManagementController.java
  25. 9 0
      security-center/src/main/java/com/lantone/security/web/FuncManagementController.java
  26. 3 2
      security-center/src/main/java/com/lantone/security/web/RegionManagementController.java

+ 5 - 1
common/src/main/java/com/lantone/common/dto/MenuDTO.java

@@ -28,10 +28,14 @@ public class MenuDTO implements Serializable {
     private Long resourceId;
 
     @ApiModelProperty(value = "服务id")
-    private Long serviceId;
+    private Long softwareId;
+    @ApiModelProperty(value = "服务名称")
+    private String softwareName;
 
     @ApiModelProperty(value = "功能名称")
     private String name;
+    @ApiModelProperty(value = "功能名称")
+    private String parentName;
 
     @ApiModelProperty(value = "类型:0:目录,1菜单,2按钮,3:超链接")
     private String type;

+ 3 - 1
common/src/main/java/com/lantone/common/vo/MenuVO.java

@@ -28,9 +28,11 @@ public class MenuVO implements Serializable {
 
     @ApiModelProperty(value = "父级编号")
     private Long parentId;
+    @ApiModelProperty(value = "服务编号")
+    private Long softwareId;
 
     @ApiModelProperty(value = "服务id列表")
-    private List<Long> services;
+    private List<Long> softwares;
 
     @ApiModelProperty(value = "功能名称")
     private String name;

+ 41 - 0
common/src/main/java/com/lantone/common/vo/SaveDictionaryVO.java

@@ -0,0 +1,41 @@
+package com.lantone.common.vo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+
+/**
+ * <p>
+ * 系统字典表
+ * </p>
+ */
+@Data
+public class SaveDictionaryVO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    @ApiModelProperty(value = "分组(值自定义)")
+    private Long groupType;
+
+    @ApiModelProperty(value = "内容")
+    @NotBlank
+    private String name;
+
+    @ApiModelProperty(value = "值")
+    @NotBlank
+    private String val;
+
+    @ApiModelProperty(value = "是否启用(0-否 1-是)")
+    @NotBlank
+    private Long status;
+
+    @ApiModelProperty(value = "备注")
+    @NotBlank
+    private String remark;
+
+
+}

+ 25 - 0
common/src/main/java/com/lantone/common/vo/ViewDictionaryInfoVO.java

@@ -0,0 +1,25 @@
+package com.lantone.common.vo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+@Data
+public class ViewDictionaryInfoVO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    @ApiModelProperty(value = "分组(值自定义)")
+    private Long groupType;
+
+    @ApiModelProperty(value = "代码名称")
+    private String name;
+
+    @ApiModelProperty(value = "医院ID")
+    private Long hospitalId;
+
+}

+ 87 - 0
dblayer-mbg/src/main/java/com/lantone/dblayermbg/entity/SysDictionaryInfo.java

@@ -0,0 +1,87 @@
+package com.lantone.dblayermbg.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 系统字典表
+ * </p>
+ */
+@Data
+@TableName("sys_dictionary_info")
+@ApiModel(value="SysDictionaryInfo对象", description="系统字典表")
+public class SysDictionaryInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty(value = "分组(值自定义)")
+    @TableField("group_type")
+    private Long groupType;
+
+    @ApiModelProperty(value = "内容")
+    @TableField("name")
+    private String name;
+
+    @ApiModelProperty(value = "值")
+    @TableField("val")
+    private String val;
+
+    @ApiModelProperty(value = "是否启用(0-否 1-是)")
+    @TableField("status")
+    private Long status;
+
+    @ApiModelProperty(value = "返回类型(0: 都返回,1:后台维护返回 2:界面返回)")
+    @TableField("return_type")
+    @JsonIgnore
+    private Integer returnType;
+
+    @ApiModelProperty(value = "排序号")
+    @TableField("order_no")
+    @JsonIgnore
+    private Integer orderNo;
+
+    @ApiModelProperty(value = "是否删除,N:未删除,Y:删除")
+    @TableField("is_deleted")
+    @JsonIgnore
+    private String isDeleted;
+
+    @ApiModelProperty(value = "记录创建时间")
+    @TableField("gmt_create")
+    @JsonIgnore
+    private Date gmtCreate;
+
+    @ApiModelProperty(value = "记录修改时间,如果时间是1970年则表示纪录未修改")
+    @TableField("gmt_modified")
+    @JsonIgnore
+    private Date gmtModified;
+
+    @ApiModelProperty(value = "创建人,0表示无创建人值")
+    @TableField("creator")
+    @JsonIgnore
+    private String creator;
+
+    @ApiModelProperty(value = "修改人,如果为0则表示纪录未修改")
+    @TableField("modifier")
+    @JsonIgnore
+    private String modifier;
+
+    @ApiModelProperty(value = "备注")
+    @TableField("remark")
+    private String remark;
+
+
+}

+ 14 - 0
dblayer-mbg/src/main/java/com/lantone/dblayermbg/facade/SysDictionaryInfoFacade.java

@@ -0,0 +1,14 @@
+package com.lantone.dblayermbg.facade;
+
+import com.lantone.dblayermbg.service.impl.SysDictionaryInfoServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * <p>
+ * 系统字典表 服务实现类Facade
+ * </p>
+ */
+@Component
+public class SysDictionaryInfoFacade extends SysDictionaryInfoServiceImpl {
+
+}

+ 4 - 0
dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/MenuMapper.java

@@ -1,7 +1,10 @@
 package com.lantone.dblayermbg.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.lantone.common.dto.MenuDTO;
+import com.lantone.common.vo.MenuVO;
 import com.lantone.dblayermbg.entity.Menu;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -10,4 +13,5 @@ import com.lantone.dblayermbg.entity.Menu;
  */
 public interface MenuMapper extends BaseMapper<Menu> {
 
+    MenuDTO getMenuById(@Param("menuVO") MenuVO menuVO);
 }

+ 1 - 1
dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/RoleSoftwareMenuMapper.java

@@ -23,5 +23,5 @@ public interface RoleSoftwareMenuMapper extends BaseMapper<RoleSoftwareMenu> {
      * @Return java.util.List<com.lantone.common.dto.MenuDTO>
      * @Date 2021/7/28
      */
-    List<MenuDTO> getMenus(@Param("roleSoftwareMenuVo") RoleSoftwareMenuVo roleSoftwareMenuVo);
+    List<MenuDTO> getMenus(@Param("roleSoftwareMenuVos") RoleSoftwareMenuVo roleSoftwareMenuVo);
 }

+ 4 - 0
dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/SoftwareMenuMapper.java

@@ -2,6 +2,9 @@ package com.lantone.dblayermbg.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.lantone.dblayermbg.entity.SoftwareMenu;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -10,4 +13,5 @@ import com.lantone.dblayermbg.entity.SoftwareMenu;
  */
 public interface SoftwareMenuMapper extends BaseMapper<SoftwareMenu> {
 
+    List<SoftwareMenu> getSoftwareMenu(@Param("menuId") Long menuId, @Param("softwareMenuIds") List<Long> softwareMenuIds);
 }

+ 14 - 0
dblayer-mbg/src/main/java/com/lantone/dblayermbg/mapper/SysDictionaryInfoMapper.java

@@ -0,0 +1,14 @@
+package com.lantone.dblayermbg.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.lantone.dblayermbg.entity.SysDictionaryInfo;
+
+/**
+ * <p>
+ * 系统字典表 Mapper 接口
+ * </p>
+ */
+public interface SysDictionaryInfoMapper extends BaseMapper<SysDictionaryInfo> {
+
+}
+

+ 13 - 0
dblayer-mbg/src/main/java/com/lantone/dblayermbg/service/SysDictionaryInfoService.java

@@ -0,0 +1,13 @@
+package com.lantone.dblayermbg.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.lantone.dblayermbg.entity.SysDictionaryInfo;
+
+/**
+ * <p>
+ * 系统字典表 服务类
+ * </p>
+ */
+public interface SysDictionaryInfoService extends IService<SysDictionaryInfo> {
+
+}

+ 17 - 0
dblayer-mbg/src/main/java/com/lantone/dblayermbg/service/impl/SysDictionaryInfoServiceImpl.java

@@ -0,0 +1,17 @@
+package com.lantone.dblayermbg.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.lantone.dblayermbg.entity.SysDictionaryInfo;
+import com.lantone.dblayermbg.mapper.SysDictionaryInfoMapper;
+import com.lantone.dblayermbg.service.SysDictionaryInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 系统字典表 服务实现类
+ * </p>
+ */
+@Service
+public class SysDictionaryInfoServiceImpl extends ServiceImpl<SysDictionaryInfoMapper, SysDictionaryInfo> implements SysDictionaryInfoService {
+
+}

+ 36 - 1
dblayer-mbg/src/main/resources/mapper/MenuMapper.xml

@@ -1,5 +1,40 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.lantone.dblayermbg.mapper.MenuMapper">
-
+    <select id="getMenuById" resultType="com.lantone.common.dto.MenuDTO">
+        SELECT DISTINCT
+        sm.software_id softwareId,
+        IF (
+        sm.software_id = 1,
+        '运行质控',
+        '终末质控'
+        ) softwareName,
+        m.parent_id parentId,
+        pm.`name` parentName,
+        m.`name`,
+        m.type,
+        r.url premission,
+        m.order_no orderNo,
+        m.menu_describe menuDescribe,
+        m.remark,
+        m.`status`
+        FROM
+        sys_software_menu sm,
+        `sys_menu` m
+        LEFT JOIN sys_menu pm ON pm.id = m.parent_id
+        LEFT JOIN sys_menu_resource mr ON mr.menu_id = m.id
+        LEFT JOIN sys_resource r ON mr.resource_id = r.id
+        WHERE
+        sm.menu_id = m.id
+        AND pm.is_deleted = 'N'
+        AND m.is_deleted = 'N'
+        AND mr.is_deleted = 'N'
+        AND r.is_deleted = 'N'
+        <if test="menuVO.softwareId != null and menuVO.softwareId !=''">
+            AND sm.software_id = #{menuVO.softwareId}
+        </if>
+        <if test="menuVO.id != null and menuVO.id !=''">
+            AND m.id = #{menuVO.id}
+        </if>
+    </select>
 </mapper>

+ 4 - 4
dblayer-mbg/src/main/resources/mapper/RoleSoftwareMenuMapper.xml

@@ -24,12 +24,12 @@
         AND r.is_deleted = 'N'
         WHERE m.id = sm.menu_id
         AND sm.id = rsm.software_menu_id
-        <if test="roleSoftwareMenuVo.softwareId != null and roleSoftwareMenuVo.softwareId !=''">
-            AND sm.software_id = #{rolesoftwareMenuVo.softwareId}
+        <if test="roleSoftwareMenuVos.softwareId != null and roleSoftwareMenuVos.softwareId !=''">
+            AND sm.software_id = #{roleSoftwareMenuVos.softwareId}
         </if>
-        <if test="roleSoftwareMenuVo.roles !=null and roleSoftwareMenuVo.roles.size!=0">
+        <if test="roleSoftwareMenuVos.roles !=null and roleSoftwareMenuVos.roles.size!=0">
             AND rsm.role_id IN
-            <foreach collection="roleSoftwareMenuVo.roles" item="id" open="(" close=")" separator=",">
+            <foreach collection="roleSoftwareMenuVos.roles" item="id" open="(" close=")" separator=",">
                 #{id}
             </foreach>
         </if>

+ 16 - 1
dblayer-mbg/src/main/resources/mapper/SoftwareMenuMapper.xml

@@ -1,5 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.lantone.dblayermbg.mapper.SoftwareMenuMapper">
-
+    <select id="getSoftwareMenu" resultType="com.lantone.dblayermbg.entity.SoftwareMenu">
+        SELECT
+        	*
+        FROM
+        	`sys_software_menu`
+        WHERE 1=1
+        <if test="menuId != null ">
+            AND	`menu_id` = #{menuId}
+        </if>
+        <if test="softwareMenuIds !=null and softwareMenuIds.size!=0">
+            AND `id` IN
+            <foreach collection="softwareMenuIds" item="id" open="(" close=")" separator=",">
+                #{id}
+            </foreach>
+        </if>
+    </select>
 </mapper>

+ 5 - 0
dblayer-mbg/src/main/resources/mapper/SysDictionaryInfoMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.lantone.dblayermbg.mapper.SysDictionaryInfoMapper">
+
+</mapper>

+ 22 - 0
dblayer-mbg/src/main/resources/mapper/base/BaseSysDictionaryInfoMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.lantone.dblayermbg.mapper.SysDictionaryInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.lantone.dblayermbg.entity.SysDictionaryInfo">
+        <id column="id" property="id"/>
+        <result column="group_type" property="groupType"/>
+        <result column="name" property="name"/>
+        <result column="val" property="val"/>
+        <result column="status" property="status"/>
+        <result column="return_type" property="returnType"/>
+        <result column="order_no" property="orderNo"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="gmt_create" property="gmtCreate"/>
+        <result column="gmt_modified" property="gmtModified"/>
+        <result column="creator" property="creator"/>
+        <result column="modifier" property="modifier"/>
+        <result column="remark" property="remark"/>
+    </resultMap>
+
+</mapper>

+ 20 - 0
dblayer-mbg/src/main/resources/mapper/base/BaseSysRegionDeptMapper.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.lantone.dblayermbg.mapper.SysRegionDeptMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.lantone.dblayermbg.entity.SysRegionDept">
+        <id column="id" property="id"/>
+        <result column="hospital_id" property="hospitalId"/>
+        <result column="region_id" property="regionId"/>
+        <result column="dept_id" property="deptId"/>
+        <result column="order_no" property="orderNo"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="gmt_create" property="gmtCreate"/>
+        <result column="gmt_modified" property="gmtModified"/>
+        <result column="creator" property="creator"/>
+        <result column="modifier" property="modifier"/>
+        <result column="remark" property="remark"/>
+    </resultMap>
+
+</mapper>

+ 22 - 0
dblayer-mbg/src/main/resources/mapper/base/BaseSysRegionMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.lantone.dblayermbg.mapper.SysRegionMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.lantone.dblayermbg.entity.SysRegion">
+        <id column="id" property="id"/>
+        <result column="hospital_id" property="hospitalId"/>
+        <result column="code" property="code"/>
+        <result column="name" property="name"/>
+        <result column="spell" property="spell"/>
+        <result column="station" property="station"/>
+        <result column="order_no" property="orderNo"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="gmt_create" property="gmtCreate"/>
+        <result column="gmt_modified" property="gmtModified"/>
+        <result column="creator" property="creator"/>
+        <result column="modifier" property="modifier"/>
+        <result column="remark" property="remark"/>
+    </resultMap>
+
+</mapper>

+ 2 - 1
gateway-service/src/main/resources/bootstrap.yml

@@ -96,4 +96,5 @@ secure:
       - "/security-center/func/management/addMenu"
       - "/security-center/func/management/updateMenu"
       - "/security-center/func/management/deleteMenu"
-      - "/security-center/func/management/disableMenu"
+      - "/security-center/func/management/disableMenu"
+      - "/security-center/func/management/getMenuById"

+ 12 - 1
security-center/src/main/java/com/lantone/security/facade/DataAuthHandleFacade.java

@@ -340,10 +340,21 @@ public class DataAuthHandleFacade extends DataAuthServiceImpl {
                     Asserts.fail("系统对应数据权限明细未选择");
                 }
                 break;
-            default:
+            case 3:
+                if (serviceDataAuthVO.getDataAuthVO().getId() == null) {
+                    Asserts.fail("数据权限ID为空");
+                }
+                break;
+            case 5:
                 if (serviceDataAuthVO.getDataAuthVO().getId() == null) {
                     Asserts.fail("数据权限ID为空");
                 }
+                if (serviceDataAuthVO.getDataAuthVO().getStatus() == null) {
+                    Asserts.fail("status为空");
+                }
+                break;
+            default:
+
                 break;
         }
 

+ 86 - 0
security-center/src/main/java/com/lantone/security/facade/DictionaryInfoFacade.java

@@ -0,0 +1,86 @@
+package com.lantone.security.facade;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
+import com.lantone.common.exception.ApiException;
+import com.lantone.common.util.StringUtil;
+import com.lantone.common.vo.SaveDictionaryVO;
+import com.lantone.common.vo.ViewDictionaryInfoVO;
+import com.lantone.dblayermbg.entity.SysDictionaryInfo;
+import com.lantone.dblayermbg.service.impl.SysDictionaryInfoServiceImpl;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+
+/**
+ * <p>
+ * 系统字典表 服务实现类Facade
+ * </p>
+ */
+@Component
+public class DictionaryInfoFacade extends SysDictionaryInfoServiceImpl {
+
+    public Object saveDictionary(SaveDictionaryVO saveDictionaryVO) {
+        Boolean flag = false;
+        //新增-校验重复数据
+        checkDictionary(saveDictionaryVO);
+        SysDictionaryInfo sysDictionaryInfo = new SysDictionaryInfo();
+        BeanUtils.copyProperties(saveDictionaryVO, sysDictionaryInfo);
+        if (null == saveDictionaryVO.getId()) {
+            flag = addDictionary(sysDictionaryInfo);
+        } else if (null != saveDictionaryVO.getId()) {
+            flag = updateDictionary(sysDictionaryInfo);
+        }
+        return flag;
+    }
+
+    ;
+
+
+    public IPage<SysDictionaryInfo> getDictionary(ViewDictionaryInfoVO viewDictionaryInfoVO) {
+        IPage<SysDictionaryInfo> pageInfo = new Page();
+        LambdaQueryChainWrapper<SysDictionaryInfo> sysDictionaryInfoLambdaQuery = this.lambdaQuery();
+        if (StringUtil.isNotEmpty(viewDictionaryInfoVO.getName())) {
+            sysDictionaryInfoLambdaQuery.like(SysDictionaryInfo::getName, viewDictionaryInfoVO.getName());
+        }
+        if (null != viewDictionaryInfoVO.getGroupType()) {
+            sysDictionaryInfoLambdaQuery.like(SysDictionaryInfo::getGroupType, viewDictionaryInfoVO.getGroupType());
+        }
+        IPage<SysDictionaryInfo> page = sysDictionaryInfoLambdaQuery.page(pageInfo);
+        return page;
+    }
+
+    public Boolean deletDictionary(ViewDictionaryInfoVO deleteDictionaryInfoVO) {
+        return this.lambdaUpdate().eq(SysDictionaryInfo::getId, deleteDictionaryInfoVO.getId()).remove();
+    }
+
+    public void checkDictionary(SaveDictionaryVO saveDictionaryVO) {
+        if (null == saveDictionaryVO.getId()) {
+            Integer count = this.lambdaQuery()
+                    .eq(SysDictionaryInfo::getName, saveDictionaryVO.getName())
+                    .eq(SysDictionaryInfo::getVal, saveDictionaryVO.getVal())
+                    .count();
+            if (count > 0) {
+                throw new ApiException("当前字典添加重复");
+            }
+
+        }
+    }
+
+    public Boolean addDictionary(SysDictionaryInfo sysDictionaryInfo) {
+        sysDictionaryInfo.setGmtCreate(new Date());
+        sysDictionaryInfo.setCreator("程瑶-后期改");
+        return this.save(sysDictionaryInfo);
+    }
+
+    public Boolean updateDictionary(SysDictionaryInfo sysDictionaryInfo) {
+        sysDictionaryInfo.setGmtModified(new Date());
+        sysDictionaryInfo.setModifier("程瑶改");
+        return this.updateById(sysDictionaryInfo);
+    }
+
+}
+

+ 165 - 58
security-center/src/main/java/com/lantone/security/facade/FuncManagementFacade.java

@@ -1,6 +1,7 @@
 package com.lantone.security.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.lantone.common.dto.MenuDTO;
 import com.lantone.common.exception.Asserts;
 import com.lantone.common.util.DateUtil;
@@ -23,6 +24,7 @@ import org.springframework.stereotype.Component;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @ClassName: FuncManagementFacade
@@ -75,7 +77,7 @@ public class FuncManagementFacade {
     }
 
     /**
-     * @param roleServiceMenuVo
+     * @param roleSoftwareMenuVo
      * @Method inputParamCheck
      * @Author songxl
      * @Version 1.0
@@ -83,14 +85,14 @@ public class FuncManagementFacade {
      * @Return void
      * @Date 2021/7/28
      */
-    private void inputParamCheck(RoleSoftwareMenuVo roleServiceMenuVo) {
-        if (roleServiceMenuVo == null) {
+    private void inputParamCheck(RoleSoftwareMenuVo roleSoftwareMenuVo) {
+        if (roleSoftwareMenuVo == null) {
             Asserts.fail("入参为空");
         }
-        if (ListUtil.isEmpty(roleServiceMenuVo.getRoles())) {
+        if (ListUtil.isEmpty(roleSoftwareMenuVo.getRoles())) {
             Asserts.fail("角色列表为空");
         }
-        if (roleServiceMenuVo.getSoftwareId() == null) {
+        if (roleSoftwareMenuVo.getSoftwareId() == null) {
             Asserts.fail("服务id为空");
         }
     }
@@ -119,7 +121,7 @@ public class FuncManagementFacade {
                 if (menuVO.getParentId() == null) {
                     Asserts.fail("功能菜单父级ID为空");
                 }
-                if (ListUtil.isEmpty(menuVO.getServices())) {
+                if (ListUtil.isEmpty(menuVO.getSoftwares())) {
                     Asserts.fail("功能菜单所属服务ID列表为空");
                 }
                 if (menuVO.getType() == null) {
@@ -136,17 +138,27 @@ public class FuncManagementFacade {
                 if (menuVO.getParentId() == null) {
                     Asserts.fail("功能菜单父级ID为空");
                 }
-                if (ListUtil.isEmpty(menuVO.getServices())) {
+                if (ListUtil.isEmpty(menuVO.getSoftwares())) {
                     Asserts.fail("功能菜单所属服务ID列表为空");
                 }
                 if (menuVO.getType() == null) {
                     Asserts.fail("功能菜单类型为空");
                 }
                 break;
-            default:
+            case 3:
+                if (menuVO.getId() == null) {
+                    Asserts.fail("功能菜单ID为空");
+                }
+                break;
+            case 5:
                 if (menuVO.getId() == null) {
                     Asserts.fail("功能菜单ID为空");
                 }
+                if (menuVO.getStatus() == null) {
+                    Asserts.fail("status为空");
+                }
+                break;
+            default:
                 break;
         }
     }
@@ -181,22 +193,20 @@ public class FuncManagementFacade {
      * @Date 2021/7/28
      */
     private Boolean addMenu(MenuVO menuVO) {
-        //1.入参校验
-        inputParamCheck(menuVO);
-        //2.插入sys_menu
-        //2.1插入sys_menu
+        //1.插入sys_menu
+        //1.1插入sys_menu
         Menu menu = new Menu();
         BeanUtils.copyProperties(menuVO, menu);
         menu.setGmtCreate(DateUtil.now());
         if (menuFacade.save(menu)) {
-            //2.2插入成功获取 menuID
+            //1.2插入成功获取 menuID
             Long menuID = menuFacade.list(new QueryWrapper<Menu>()
                     .eq("parent_id", menuVO.getParentId())
                     .eq("name", menuVO.getName())
                     .eq("type", menuVO.getType())
                     .eq("is_deleted", IsDeleteEnum.N.getKey())).get(0).getId();
             //插入sys_resource、sys_menu_resource
-            return saveMenuResource(menuVO,menuID);
+            return saveMenuResource(menuVO, menuID);
         } else {
             Asserts.fail("菜单详情插入失败");
         }
@@ -212,35 +222,36 @@ public class FuncManagementFacade {
      * @Return void
      * @Date 2021/7/28
      */
-    private boolean saveMenuResource(MenuVO menuVO,Long menuID) {
-        menuVO.getServices().stream().forEach(serviceId -> {
-            //2.3 判断该功能菜单是否有对应权限
-            if (ListUtil.isNotEmpty(menuVO.getPermissions())) {
-                menuVO.getPermissions().stream().forEach(permission -> {
-                    //2.4 有权限 则插入sys_resource
-                    Resource resource = new Resource();
-                    resource.setUrl(permission);
-                    resource.setGmtCreate(DateUtil.now());
-                    if (resourceFacade.save(resource)) {
-                        //2.5 插入成功获取对应的 resourceID
-                        Long resourceID = resourceFacade.list(new QueryWrapper<Resource>()
-                                .eq("url", resource.getUrl())
-                                .eq("is_deleted", IsDeleteEnum.N.getKey())).get(0).getId();
-                        //2.6 插入菜单和功能对应关系
-                        MenuResource menuResource = new MenuResource();
-                        menuResource.setMenuId(menuID);
-                        menuResource.setResourceId(resourceID);
-                        if (menuResourceFacade.save(menuResource)) {
-                        } else {
-                            Asserts.fail("菜单与资源权限插入失败");
-                        }
+    private boolean saveMenuResource(MenuVO menuVO, Long menuID) {
+        //2.3 判断该功能菜单是否有对应权限
+        if (ListUtil.isNotEmpty(menuVO.getPermissions())) {
+            menuVO.getPermissions().stream().forEach(permission -> {
+                //2.4 有权限 则插入sys_resource
+                Resource resource = new Resource();
+                resource.setUrl(permission);
+                resource.setGmtCreate(DateUtil.now());
+                if (resourceFacade.save(resource)) {
+                    //2.5 插入成功获取对应的 resourceID
+                    Long resourceID = resourceFacade.list(new QueryWrapper<Resource>()
+                            .select("id")
+                            .eq("url", resource.getUrl())
+                            .eq("is_deleted", IsDeleteEnum.N.getKey())).get(0).getId();
+                    //2.6 插入菜单和功能对应关系
+                    MenuResource menuResource = new MenuResource();
+                    menuResource.setMenuId(menuID);
+                    menuResource.setResourceId(resourceID);
+                    if (menuResourceFacade.save(menuResource)) {
                     } else {
-                        Asserts.fail("资源权限插入失败");
+                        Asserts.fail("菜单与资源权限插入失败");
                     }
-                });
-            }
-            //3.插入超级管理员对应系统 sys_service_menu和sys_role_service_menu
-            savaRoleServiceMenu(menuID, serviceId, 1l);
+                } else {
+                    Asserts.fail("资源权限插入失败");
+                }
+            });
+        }
+        menuVO.getSoftwares().stream().forEach(softwareId -> {
+            //3.插入超级管理员对应系统 sys_software_menu和sys_role_software_menu
+            savaRoleSoftwareMenu(menuID, softwareId, 1l);
         });
         return true;
     }
@@ -249,26 +260,26 @@ public class FuncManagementFacade {
      * @param menuID
      * @param softwareId
      * @param roleID
-     * @Method savaRoleServiceMenu
+     * @Method savaRoleSoftwareMenu
      * @Author songxl
      * @Version 1.0
-     * @Description插入超级管理员对应系统 sys_service_menu和sys_role_service_menu
+     * @Description插入超级管理员对应系统 sys_software_menu和sys_role_software_menu
      * @Return void
      * @Date 2021/7/28
      */
-    private void savaRoleServiceMenu(Long menuID, Long softwareId, Long roleID) {
-        SoftwareMenu serviceMenu = new SoftwareMenu();
-        serviceMenu.setMenuId(menuID);
-        serviceMenu.setSoftwareId(softwareId);
-        if (softwareMenuFacade.save(serviceMenu)) {
-            Long serviceMenuId = softwareMenuFacade.list(new QueryWrapper<SoftwareMenu>()
-                    .eq("software_id", serviceMenu.getSoftwareId())
-                    .eq("menu_id", serviceMenu.getMenuId())
+    private void savaRoleSoftwareMenu(Long menuID, Long softwareId, Long roleID) {
+        SoftwareMenu softwareMenu = new SoftwareMenu();
+        softwareMenu.setMenuId(menuID);
+        softwareMenu.setSoftwareId(softwareId);
+        if (softwareMenuFacade.save(softwareMenu)) {
+            Long softwareMenuId = softwareMenuFacade.list(new QueryWrapper<SoftwareMenu>()
+                    .eq("software_id", softwareMenu.getSoftwareId())
+                    .eq("menu_id", softwareMenu.getMenuId())
                     .eq("is_deleted", IsDeleteEnum.N.getKey())).get(0).getId();
-            RoleSoftwareMenu roleServiceMenu = new RoleSoftwareMenu();
-            roleServiceMenu.setRoleId(roleID);
-            roleServiceMenu.setSoftwareMenuId(serviceMenuId);
-            if (roleSoftwareMenuFacade.save(roleServiceMenu)) {
+            RoleSoftwareMenu roleSoftwareMenu = new RoleSoftwareMenu();
+            roleSoftwareMenu.setRoleId(roleID);
+            roleSoftwareMenu.setSoftwareMenuId(softwareMenuId);
+            if (roleSoftwareMenuFacade.save(roleSoftwareMenu)) {
 
             } else {
                 Asserts.fail("角色与服务菜单关系插入失败");
@@ -321,8 +332,10 @@ public class FuncManagementFacade {
      * @Date 2021/7/28
      */
     private Boolean disableDataAuth(MenuVO menuVO) {
-
-        return false;
+        return menuFacade.update(new UpdateWrapper<Menu>()
+                .set("status",menuVO.getStatus())
+                .eq("id",menuVO.getId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey()));
     }
 
     /**
@@ -335,7 +348,14 @@ public class FuncManagementFacade {
      * @Date 2021/7/28
      */
     private Boolean deleteDataAuth(MenuVO menuVO) {
-
+        //1.删除原来menu关联插入的数据
+        if(menuFacade.remove(new UpdateWrapper<Menu>()
+                .eq("id",menuVO.getId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey()))){
+            return deleteMenuJoinDate(menuVO, 1l);
+        }else {
+            Asserts.fail("菜单详情删除失败");
+        }
         return false;
     }
 
@@ -349,7 +369,94 @@ public class FuncManagementFacade {
      * @Date 2021/7/28
      */
     private Boolean updateDataAuth(MenuVO menuVO) {
+        //1.删除原来menu关联插入的数据
+        if(deleteMenuJoinDate(menuVO, 1l)){
+            //2.修改sys_menu 菜单表
+            Menu menu = new Menu();
+            BeanUtils.copyProperties(menuVO, menu);
+           if( menuFacade.update(new UpdateWrapper<Menu>()
+                   .set("name",menu.getName())
+                   .set("type",menu.getType())
+                   .set("url",menu.getUrl())
+                   .set("order_no",menu.getOrderNo())
+                   .set("menu_describe",menu.getMenuDescribe())
+                   .set("remark",menu.getRemark())
+                   .set("status",menu.getStatus())
+                   .eq("id", menu.getId()))){
+               //3.重新插入上面删除的数据
+               return saveMenuResource(menuVO,menuVO.getId());
+           }
+        }
+        return false;
+    }
+    /**
+     * @Method deleteMenuJoinDate
+     * @Author songxl
+     * @Version  1.0
+     * @Description清除原菜单关联的数据
+     * @param menuVO
+     * @param roleId
+     * @Return boolean
+     * @Date 2021/7/29
+     */
+    private boolean deleteMenuJoinDate(MenuVO menuVO, Long roleId) {
 
+        //2.1删除sys_resource、sys_menu_resource原先对应menu的资源权限
+        List<MenuResource> menuResources = menuResourceFacade.list(new QueryWrapper<MenuResource>()
+                .eq("menu_id", menuVO.getId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey()));
+        //2.1有对应的资源权限
+        if (ListUtil.isNotEmpty(menuResources) && menuResources.get(0).getResourceId() != null) {
+            if (menuResourceFacade.remove(new UpdateWrapper<MenuResource>()
+                    .eq("id", menuResources.get(0).getId())
+                    .eq("is_deleted", IsDeleteEnum.N.getKey()))) {
+                if (resourceFacade.remove(new UpdateWrapper<Resource>()
+                        .eq("id", menuResources.get(0).getResourceId())
+                        .eq("is_deleted", IsDeleteEnum.N.getKey()))) {
+                } else {
+                    Asserts.fail("原菜单对应资源详情删除失败");
+                }
+
+            } else {
+                Asserts.fail("原菜单对应资源关联关系删除失败");
+            }
+        }
+        //2.2删除超级管理员该菜单的管理sys_software_menu、sys_role_software_menu
+        List<Long> softwareMenuIds = roleSoftwareMenuFacade.list(new QueryWrapper<RoleSoftwareMenu>()
+                .eq("role_id", roleId)
+                .eq("is_deleted", IsDeleteEnum.N.getKey())).stream().map(RoleSoftwareMenu::getSoftwareMenuId).collect(Collectors.toList());
+        List<SoftwareMenu> softwareMenus = softwareMenuFacade.getBaseMapper().getSoftwareMenu(menuVO.getId(), softwareMenuIds);
+        //如果改菜单没有超级管理员对应关系
+        if(ListUtil.isEmpty(softwareMenus)){
+            return true;
+        }
+        //有删除
+        if (roleSoftwareMenuFacade.remove(new UpdateWrapper<RoleSoftwareMenu>()
+                .in("software_menu_id", softwareMenus.stream().map(SoftwareMenu::getId).collect(Collectors.toList()))
+                .eq("is_deleted", IsDeleteEnum.N.getKey()))) {
+            if (softwareMenuFacade.remove(new UpdateWrapper<SoftwareMenu>()
+                    .in("id", softwareMenus.stream().map(SoftwareMenu::getId).collect(Collectors.toList()))
+                    .eq("is_deleted", IsDeleteEnum.N.getKey()))) {
+                return true;
+            }else {
+                Asserts.fail("服务菜单关系清除失败");
+            }
+        }else {
+            Asserts.fail("角色对应服务菜单关系清除失败");
+        }
         return false;
     }
+
+    /**
+     * @Method getMenuById
+     * @Author songxl
+     * @Version  1.0
+     * @Description获取菜单详情
+     * @param menuVO
+     * @Return com.lantone.common.dto.MenuDTO
+     * @Date 2021/7/29
+     */
+    public MenuDTO getMenuById(MenuVO menuVO) {
+        return menuFacade.getBaseMapper().getMenuById(menuVO);
+    }
 }

+ 64 - 0
security-center/src/main/java/com/lantone/security/web/DictionaryManagementController.java

@@ -0,0 +1,64 @@
+package com.lantone.security.web;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.lantone.common.api.CommonResult;
+import com.lantone.common.vo.SaveDictionaryVO;
+import com.lantone.common.vo.ViewDictionaryInfoVO;
+import com.lantone.dblayermbg.entity.SysDictionaryInfo;
+import com.lantone.security.facade.DictionaryInfoFacade;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * @ClassName: DictionaryManagementController
+ * @Description: 字典管理
+ * @Author cy
+ * @Date 2021/7/29
+ * @Version 1.0
+ */
+@RestController
+@Api(value = "字典管理API", tags = { "字典管理API" })
+@RequestMapping("/dictionary/management")
+public class DictionaryManagementController {
+    @Autowired
+    private DictionaryInfoFacade dictionaryInfoFacade;
+
+    @ApiOperation(value = "新增/修改字典[by:cy]",
+            notes = "id:新增操作为null<br>" +
+                    "groupType:代码类别,必填<br>" +
+                    "val:字典编码,必填<br>" +
+                    "name:代码名称,必填<br>" +
+                    "remark:字典说明,必填<br>" +
+                    "status:是否启用,必填<br>")
+    @PostMapping("/saveDictionary")
+    @ApiIgnore
+    @Transactional
+    public CommonResult<Object> saveDictionary(@RequestBody SaveDictionaryVO saveDictionaryVO) {
+        return CommonResult.success(dictionaryInfoFacade.saveDictionary(saveDictionaryVO));
+    }
+
+    @ApiOperation(value = "查看字典管理[by:cy]",
+            notes = "name:代码名称,<br>" +
+                    "groupType:代码类别,<br>")
+    @PostMapping("/getDictionary")
+    @ApiIgnore
+    public CommonResult<IPage<SysDictionaryInfo>> getDictionary(@RequestBody ViewDictionaryInfoVO viewDictionaryInfoVO) {
+        return CommonResult.success(dictionaryInfoFacade.getDictionary(viewDictionaryInfoVO));
+    }
+
+    @ApiOperation(value = "删除字典管理[by:cy]",
+            notes = "id:<br>")
+    @PostMapping("/deletDictionary")
+    @ApiIgnore
+    @Transactional
+    public CommonResult<Boolean> deletDictionary(@RequestBody ViewDictionaryInfoVO deletDictionaryInfoVO) {
+        return CommonResult.success(dictionaryInfoFacade.deletDictionary(deletDictionaryInfoVO));
+    }
+}

+ 9 - 0
security-center/src/main/java/com/lantone/security/web/FuncManagementController.java

@@ -51,13 +51,21 @@ public class FuncManagementController {
             notes = "menuVO:功能菜单对象,必填<br>" +
                     "opeType:操作码 1:新增;2:修改 ;3:删除;5:启用禁用")
     @PostMapping("/updateMenu")
+    @Transactional
     public CommonResult<Boolean> updateMenu(@RequestBody MenuVO menuVO) {
         return CommonResult.success(funcManagementFacade.CRUDOperation(menuVO));
     }
+    @ApiOperation(value = "获取菜单详情 [by:songxl]",
+            notes = "menuVO:功能菜单对象")
+    @PostMapping("/getMenuById")
+    public CommonResult<MenuDTO> getMenuById(@RequestBody MenuVO menuVO) {
+        return CommonResult.success(funcManagementFacade.getMenuById(menuVO));
+    }
     @ApiOperation(value = "删除功能菜单 [by:songxl]",
             notes = "menuVO:功能菜单对象,必填<br>" +
                     "opeType:操作码 1:新增;2:修改 ;3:删除;5:启用禁用")
     @PostMapping("/deleteMenu")
+    @Transactional
     public CommonResult<Boolean> deleteMenu(@RequestBody MenuVO menuVO) {
         return CommonResult.success(funcManagementFacade.CRUDOperation(menuVO));
     }
@@ -65,6 +73,7 @@ public class FuncManagementController {
             notes = "menuVO:功能菜单对象,必填<br>" +
                     "opeType:操作码 1:新增;2:修改 ;3:删除;5:启用禁用")
     @PostMapping("/disableMenu")
+    @Transactional
     public CommonResult<Boolean> disableMenu(@RequestBody MenuVO menuVO) {
         return CommonResult.success(funcManagementFacade.CRUDOperation(menuVO));
     }

+ 3 - 2
security-center/src/main/java/com/lantone/security/web/RegionManagementController.java

@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
 import springfox.documentation.annotations.ApiIgnore;
 
 /**
- * @ClassName: DataWardController
+ * @ClassName: RegionManagementController
  * @Description: 病区管理
  * @Author cy
  * @Date 2021/7/27
@@ -32,7 +32,8 @@ public class RegionManagementController {
     private RegionManagementFacade sysRegionFacade;
 
     @ApiOperation(value = "新增/修改病区[by:cy]",
-            notes = "organizationName:上级组织名称,必填<br>" +
+            notes = "hospitalName:上级组织名称,必填<br>" +
+                    "id:新增操作为null <br>" +
                     "name:病区名称,必填<br>" +
                     "code:病区编码,<br>" +
                     "deptIds:关联科室,<br>" +