23 files added
1 files deleted
1 files renamed
6 files modified
| New file |
| | |
| | | package cn.huge.module.cust.constant; |
| | | |
| | | import cn.huge.module.cust.dto.CtUserDTO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | /** |
| | | * @title: 系统角菜单相关常量枚举类 |
| | | * @description: 系统角菜单相关常量枚举类 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2021-11-05 16:51:48 |
| | | * @version: 1.0.0 |
| | | */ |
| | | public enum MenuBaseEnum { |
| | | |
| | | /** |
| | | * 平台基础角色 |
| | | */ |
| | | MENU_APP_1("mediate", "调解中心"), |
| | | MENU_APP_2("operation", "客户中心"); |
| | | |
| | | /** |
| | | * 代码编号 |
| | | */ |
| | | private String index; |
| | | |
| | | /** |
| | | * 描述 |
| | | */ |
| | | private String des; |
| | | |
| | | public String getIndex() { |
| | | return index; |
| | | } |
| | | |
| | | public void setIndex(String index) { |
| | | this.index = index; |
| | | } |
| | | |
| | | public String getDes() { |
| | | return des; |
| | | } |
| | | |
| | | public void setDes(String desc) { |
| | | this.des = desc; |
| | | } |
| | | |
| | | /** |
| | | * 构造方法 |
| | | * @param index |
| | | * @param des |
| | | */ |
| | | MenuBaseEnum(String index, String des) { |
| | | this.index = index; |
| | | this.des = des; |
| | | } |
| | | |
| | | /** |
| | | * 静态方法 |
| | | * @param index |
| | | * @return |
| | | */ |
| | | public static String getDes(String index) { |
| | | for (MenuBaseEnum constantEnum : MenuBaseEnum.values()) { |
| | | if (constantEnum.getIndex().equals(index)) { |
| | | return constantEnum.des; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | /** |
| | | * @title: 调解相关常量枚举类 |
| | | * @description: 调解相关常量枚举类 |
| | | * @title: 系统角色相关常量枚举类 |
| | | * @description: 系统角色相关常量枚举类 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2021-11-05 16:51:48 |
| | |
| | | /** |
| | | * 平台基础角色 |
| | | */ |
| | | ROLE_1("22_00024-1", "运维技术人员"), |
| | | ROLE_1("22_00024-1", "运维人员"), |
| | | ROLE_2("22_00024-2", "超级管理员"), |
| | | ROLE_3("22_00024-3", "组织管理员"), |
| | | ROLE_4("22_00024-4", "人民调解员"), |
| | | ROLE_5("22_00024-5", "法官"), |
| | | ROLE_6("22_00024-6", "法院"), |
| | | ROLE_7("22_00024-7", "调度人员"), |
| | | ROLE_8("22_00024-8", "法官助理/书记员"), |
| | | ROLE_9("22_00024-9", "调委会管理员"), |
| | | ROLE_10("22_00024-10", "司法局"); |
| | | ROLE_3("22_00024-3", "单位管理员"), |
| | | ROLE_4("22_00024-4", "纠纷化解人员"); |
| | | |
| | | /** |
| | | * 代码编号 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 判断是否有超级管理员权限 |
| | | * @param roleCodes 角色代码编号,多个用,分开 |
| | | * @return Boolean |
| | | */ |
| | | public static Boolean checkAdminPower(String roleCodes){ |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_1.getIndex()) != -1 || |
| | | roleCodes.indexOf(ROLE_2.getIndex()) != -1 || |
| | | roleCodes.indexOf(ROLE_7.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 临时-演示用户赋予超级管理员角色 |
| | | * 判断是否有超级管理员权限 |
| | | * @param loginUser 角色代码编号,多个用,分开 |
| | |
| | | String roleCodes = loginUser.getRoleCodes(); |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_1.getIndex()) != -1 || |
| | | roleCodes.indexOf(ROLE_2.getIndex()) != -1 || |
| | | roleCodes.indexOf(ROLE_7.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否有组织管理员权限 |
| | | * @param roleCodes 角色代码编号,多个用,分开 |
| | | * @return Boolean |
| | | */ |
| | | public static Boolean checkUnitPower(String roleCodes){ |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_3.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否有调委会管理员权限 |
| | | * @param roleCodes 角色代码编号,多个用,分开 |
| | | * @return Boolean |
| | | */ |
| | | public static Boolean checkTwhPower(String roleCodes){ |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_9.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否有是个人权限 |
| | | * @param roleCodes 角色代码编号,多个用,分开 |
| | | * @return Boolean |
| | | */ |
| | | public static Boolean checkUserPower(String roleCodes){ |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_4.getIndex()) != -1 || |
| | | roleCodes.indexOf(ROLE_5.getIndex()) != -1 || |
| | | roleCodes.indexOf(ROLE_8.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否是法院或组织管理员的权限 |
| | | * @param roleCodes 角色代码编号,多个用,分开 |
| | | * @return Boolean |
| | | */ |
| | | public static Boolean checkCourtOrUnitPower(String roleCodes){ |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_3.getIndex()) != -1 || |
| | | roleCodes.indexOf(ROLE_6.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否是法院的权限 |
| | | * @param roleCodes 角色代码编号,多个用,分开 |
| | | * @return Boolean |
| | | */ |
| | | public static Boolean checkCourtPower(String roleCodes){ |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_5.getIndex()) != -1 || |
| | | roleCodes.indexOf(ROLE_6.getIndex()) != -1 || |
| | | roleCodes.indexOf(ROLE_8.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否有法院管理权限 |
| | | * @param roleCodes 角色代码编号,多个用,分开 |
| | | * @return Boolean |
| | | */ |
| | | public static Boolean checkCourtAdminPower(String roleCodes){ |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_6.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否有法官权限 |
| | | * @param roleCodes 角色代码编号,多个用,分开 |
| | | * @return Boolean |
| | | */ |
| | | public static Boolean checkJudgePower(String roleCodes){ |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_5.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否有调度权限 |
| | | * @param roleCodes 角色代码编号,多个用,分开 |
| | | * @return Boolean |
| | | */ |
| | | public static Boolean checkDispPower(String roleCodes){ |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_7.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否有司法局权限 |
| | | * @param roleCodes 角色代码编号,多个用,分开 |
| | | * @return Boolean |
| | | */ |
| | | public static Boolean checkSfjPower(String roleCodes){ |
| | | if (StringUtils.isNotEmpty(roleCodes)) { |
| | | if (roleCodes.indexOf(ROLE_10.getIndex()) != -1) { |
| | | roleCodes.indexOf(ROLE_2.getIndex()) != -1) { |
| | | return true; |
| | | } else { |
| | | return false; |
| New file |
| | |
| | | package cn.huge.module.bytogz.controller; |
| | | |
| | | import cn.huge.base.common.dto.SelectTermDTO; |
| | | import cn.huge.base.common.utils.ObjectUtils; |
| | | import cn.huge.base.common.utils.ReturnFailUtils; |
| | | import cn.huge.base.common.utils.ReturnSucUtils; |
| | | import cn.huge.base.config.CurrentUser; |
| | | import cn.huge.module.bytogz.service.ByToGzService; |
| | | import cn.huge.module.ctrole.service.CtRoleService; |
| | | import cn.huge.module.ctuser.domain.po.CtAccount; |
| | | import cn.huge.module.ctuser.domain.po.CtUser; |
| | | import cn.huge.module.ctuser.dto.CtUserInfoDTO; |
| | | import cn.huge.module.ctuser.dto.CtUserSaveDTO; |
| | | import cn.huge.module.ctuser.service.*; |
| | | import cn.huge.module.cust.constant.UserBaseConsts; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.google.common.collect.Maps; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @title: 白云数据割接为广州数据接口api |
| | | * @description: 白云数据割接为广州数据接口api |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-08-19 20:04:19 |
| | | * @version: 1.0.0 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/api/byToGz") |
| | | public class ByToGzController { |
| | | |
| | | @Autowired(required = false) |
| | | private HttpServletRequest request; |
| | | |
| | | @Autowired |
| | | private ByToGzService service; |
| | | |
| | | /** |
| | | * 用户角色更新-白云角色映射为广州角色 |
| | | * @url {ctx}/api/byToGz/upUserole |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/upUserole") |
| | | public Object upUserole() { |
| | | try { |
| | | service.upBytoGzUserole(); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package cn.huge.module.bytogz.service; |
| | | |
| | | import cn.huge.base.common.exception.ServiceException; |
| | | import cn.huge.base.common.utils.DateUtils; |
| | | import cn.huge.base.common.utils.IdUtils; |
| | | import cn.huge.module.client.api.impl.UtilsClientImpl; |
| | | import cn.huge.module.ctrole.constant.ByRoleBaseEnum; |
| | | import cn.huge.module.ctuser.dao.mapper.CtUseroleMapper; |
| | | import cn.huge.module.ctuser.domain.po.CtUser; |
| | | import cn.huge.module.ctuser.domain.po.CtUserole; |
| | | import cn.huge.module.ctuser.service.CtUserService; |
| | | import cn.huge.module.ctuser.service.CtUseroleService; |
| | | import cn.huge.module.cust.constant.RoleBaseEnum; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.collect.Maps; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageImpl; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @title: 白云数据割接为广州数据的业务逻辑处理 |
| | | * @Description 白云数据割接为广州数据的业务逻辑处理 |
| | | * @company hugeinfo |
| | | * @author liyj |
| | | * @Time 2024-08-19 20:04:19 |
| | | * @version 1.0.0 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class ByToGzService{ |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private CtUseroleService ctUseroleService; |
| | | @Autowired |
| | | private CtUserService ctUserService; |
| | | |
| | | /** |
| | | * 用户角色更新-白云角色映射为广州角色 |
| | | */ |
| | | public void upBytoGzUserole(){ |
| | | try{ |
| | | List<CtUserole> ctUseroleList = ctUseroleService.list(); |
| | | for (CtUserole ctUserole: ctUseroleList){ |
| | | if (ctUserole.getRoleCode().equals(ByRoleBaseEnum.ROLE_5) |
| | | || ctUserole.getRoleCode().equals(ByRoleBaseEnum.ROLE_7) |
| | | || ctUserole.getRoleCode().equals(ByRoleBaseEnum.ROLE_8)){ |
| | | ctUseroleService.removeById(ctUserole.getId()); |
| | | }else { |
| | | RoleBaseEnum roleBaseEnum = ByRoleBaseEnum.getGzRole(ctUserole.getRoleCode()); |
| | | ctUserole.setRoleId(roleBaseEnum.getIndex()); |
| | | ctUserole.setRoleCode(roleBaseEnum.getIndex()); |
| | | ctUserole.setRoleName(roleBaseEnum.getDes()); |
| | | ctUseroleService.updateById(ctUserole); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("[ByToGzService.upBytoGzUserole]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("ByToGzService.upBytoGzUserole", e); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package cn.huge.module.ctrole.constant; |
| | | |
| | | |
| | | import cn.huge.module.cust.constant.RoleBaseEnum; |
| | | |
| | | /** |
| | | * @title: 白云多元化的角色相关常量枚举类 |
| | | * @description: 白云多元化的角色相关常量枚举类 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2021-11-05 16:51:48 |
| | | * @version: 1.0.0 |
| | | */ |
| | | public enum ByRoleBaseEnum { |
| | | |
| | | /** |
| | | * 平台基础角色 |
| | | */ |
| | | ROLE_1("22_00024-1", "运维技术人员"), |
| | | ROLE_2("22_00024-2", "超级管理员"), |
| | | ROLE_3("22_00024-3", "组织管理员"), |
| | | ROLE_4("22_00024-4", "人民调解员"), |
| | | ROLE_5("22_00024-5", "法官"), |
| | | ROLE_6("22_00024-6", "法院"), |
| | | ROLE_7("22_00024-7", "调度人员"), |
| | | ROLE_8("22_00024-8", "法官助理/书记员"), |
| | | ROLE_9("22_00024-9", "调委会管理员"), |
| | | ROLE_10("22_00024-10", "司法局"); |
| | | |
| | | /** |
| | | * 代码编号 |
| | | */ |
| | | private String index; |
| | | |
| | | /** |
| | | * 描述 |
| | | */ |
| | | private String des; |
| | | |
| | | public String getIndex() { |
| | | return index; |
| | | } |
| | | |
| | | public void setIndex(String index) { |
| | | this.index = index; |
| | | } |
| | | |
| | | public String getDes() { |
| | | return des; |
| | | } |
| | | |
| | | public void setDes(String desc) { |
| | | this.des = desc; |
| | | } |
| | | |
| | | /** |
| | | * 构造方法 |
| | | * @param index |
| | | * @param des |
| | | */ |
| | | ByRoleBaseEnum(String index, String des) { |
| | | this.index = index; |
| | | this.des = des; |
| | | } |
| | | |
| | | /** |
| | | * 静态方法 |
| | | * @param index |
| | | * @return |
| | | */ |
| | | public static String getDes(String index) { |
| | | for (ByRoleBaseEnum constantEnum : ByRoleBaseEnum.values()) { |
| | | if (constantEnum.getIndex().equals(index)) { |
| | | return constantEnum.des; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据白云多元化的角色对应获取本平台的角色 |
| | | * @param byRoleIndex 白云多元化的角色编号 |
| | | * @return |
| | | */ |
| | | public static RoleBaseEnum getGzRole(String byRoleIndex) { |
| | | if(ROLE_1.getIndex().equals(byRoleIndex)) { |
| | | return RoleBaseEnum.ROLE_1; |
| | | } |
| | | |
| | | if(ROLE_2.getIndex().equals(byRoleIndex)){ |
| | | return RoleBaseEnum.ROLE_2; |
| | | } |
| | | |
| | | if(ROLE_3.getIndex().equals(byRoleIndex)){ |
| | | return RoleBaseEnum.ROLE_3; |
| | | } |
| | | |
| | | if(ROLE_4.getIndex().equals(byRoleIndex)){ |
| | | return RoleBaseEnum.ROLE_4; |
| | | } |
| | | |
| | | if(ROLE_5.getIndex().equals(byRoleIndex)){ |
| | | return RoleBaseEnum.ROLE_4; |
| | | } |
| | | |
| | | if(ROLE_6.getIndex().equals(byRoleIndex)){ |
| | | return RoleBaseEnum.ROLE_3; |
| | | } |
| | | |
| | | if(ROLE_7.getIndex().equals(byRoleIndex)){ |
| | | return RoleBaseEnum.ROLE_4; |
| | | } |
| | | |
| | | if(ROLE_8.getIndex().equals(byRoleIndex)){ |
| | | return RoleBaseEnum.ROLE_4; |
| | | } |
| | | |
| | | if(ROLE_9.getIndex().equals(byRoleIndex)){ |
| | | return RoleBaseEnum.ROLE_3; |
| | | } |
| | | |
| | | if(ROLE_10.getIndex().equals(byRoleIndex)){ |
| | | return RoleBaseEnum.ROLE_3; |
| | | } |
| | | |
| | | return RoleBaseEnum.ROLE_4; |
| | | } |
| | | } |
| | |
| | | import cn.huge.module.ctrole.domain.po.CtRole; |
| | | import cn.huge.module.ctrole.service.CtRoleService; |
| | | import cn.huge.module.ctrole.service.CtRolefunService; |
| | | import cn.huge.module.ctuser.domain.bo.RoleTreeBO; |
| | | import cn.huge.module.ctuser.service.CtUserService; |
| | | import cn.huge.module.cust.dto.CtUserDTO; |
| | | import cn.huge.module.rsoper.domain.dto.RsRoleDTO; |
| | | import cn.huge.module.rsoper.service.RsRoleService; |
| | | import com.google.common.collect.Maps; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageRequest; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private CtRoleService service; |
| | | |
| | | @Autowired |
| | | private CtUserService ctUserService; |
| | | |
| | | @Autowired |
| | | private CtRolefunService ctRolefunService; |
| | | private RsRoleService rsRoleService; |
| | | |
| | | /** |
| | | * 获取请求URL参数 |
| | |
| | | @GetMapping("/getById") |
| | | public Object getById(@RequestParam(value = "id") String id, @CurrentUser String userId) { |
| | | try { |
| | | CtRoleBO bo = service.webGetById(id, userId); |
| | | return ReturnSucUtils.getRepInfo(bo); |
| | | RsRoleDTO rsRoleDTO = rsRoleService.webGetRoleMenu(id, userId); |
| | | return ReturnSucUtils.getRepInfo(rsRoleDTO); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | |
| | | |
| | | import cn.huge.module.ctrole.domain.po.CtRole; |
| | | import cn.huge.module.ctrole.domain.po.CtRolefun; |
| | | import cn.huge.module.ctuser.domain.bo.RoleTreeBO; |
| | | import cn.huge.module.rsoper.domain.dto.RoleMenuTreeDTO; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | |
| | | /** |
| | | * 返回树形结构 |
| | | */ |
| | | List<RoleTreeBO> roleTreeBOS; |
| | | List<RoleMenuTreeDTO> roleMenuTreeDTOS; |
| | | } |
| | |
| | | import cn.huge.module.ctrole.dao.mapper.CtRoleMapper; |
| | | import cn.huge.module.ctrole.domain.bo.CtRoleBO; |
| | | import cn.huge.module.ctrole.domain.po.CtRole; |
| | | import cn.huge.module.ctuser.domain.bo.RoleTreeBO; |
| | | import cn.huge.module.rsoper.domain.dto.RoleMenuTreeDTO; |
| | | import cn.huge.module.ctuser.service.CtUserService; |
| | | import cn.huge.module.cust.dto.CtUserDTO; |
| | | import cn.huge.module.rsoper.domain.po.RsRole; |
| | | import cn.huge.module.rsoper.service.RsRolefunService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | @Autowired |
| | | private UtilsClientImpl utilsClient; |
| | | |
| | | @Autowired |
| | | private CtUserService ctUserService; |
| | | |
| | | @Autowired |
| | | private CtRolefunService ctRolefunService; |
| | | @Autowired |
| | | private RsRolefunService rsRolefunService; |
| | | |
| | | /** |
| | | * 更新对象 |
| | |
| | | ctRoleQueryWrapper.eq("unit_id", unitId).eq("role_code", roleId); |
| | | CtRole ctRole = mapper.selectOne(ctRoleQueryWrapper); |
| | | return ctRole; |
| | | } |
| | | |
| | | /** |
| | | * 根据单位编号和角色编号查询 |
| | | * @param id |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | public CtRoleBO webGetById(String id, String userId){ |
| | | // 临时-演示用户赋予超级管理员角色 |
| | | // 获取当前登录用户 |
| | | CtUserDTO loginUser = ctUserService.clientGetUserAll(userId); |
| | | String acc = loginUser.getAcc(); |
| | | if ("yanstjy".equals(acc) || "yansjdb".equals(acc)){ |
| | | id = "2303191513151003"; |
| | | } |
| | | CtRole ctRole = this.getById(id); |
| | | CtRoleBO bo = new CtRoleBO(); |
| | | BeanUtils.copyProperties(ctRole,bo); |
| | | //查询角色权限 |
| | | List<RoleTreeBO> roleTrees = ctRolefunService.getRolefunTree(ctRole.getId()); |
| | | bo.setRoleTreeBOS(roleTrees); |
| | | return bo; |
| | | } |
| | | } |
| | |
| | | import cn.huge.module.constant.BaseConsts; |
| | | import cn.huge.module.ctrole.dao.mapper.CtRolefunMapper; |
| | | import cn.huge.module.ctrole.domain.po.CtRolefun; |
| | | import cn.huge.module.ctuser.domain.bo.RoleTreeBO; |
| | | import cn.huge.module.cust.constant.UserBaseConsts; |
| | | import cn.huge.module.rsoper.domain.dto.RoleMenuTreeDTO; |
| | | import cn.huge.module.rsoper.service.RsRolefunService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.collect.Maps; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageImpl; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | private UtilsClientImpl utilsClient; |
| | | @Autowired |
| | | private RsRolefunService rsRolefunService; |
| | | |
| | | /** |
| | | * 更新对象 |
| | |
| | | log.error("[CtRolefunService.saveCtRolefun]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("CtRolefunService.saveCtRolefun", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询角色树形结构 |
| | | * @param roleId 角色编号 |
| | | * @return List<RoleTreeBO> 树形结构 |
| | | */ |
| | | public List<RoleTreeBO> getRolefunTree(String roleId){ |
| | | //查询所有的关系 |
| | | Map<String, Object> terms = Maps.newHashMap(); |
| | | terms.put("roleId",roleId); |
| | | List<CtRolefun> rolefuns = mapper.listTerms(terms); |
| | | List<CtRolefun> list = new ArrayList<>(); |
| | | List<RoleTreeBO> treeBOS = new ArrayList<>(); |
| | | if (rolefuns.size() > 0) { |
| | | //第一级菜单集合 |
| | | for (int i = 0; i < rolefuns.size(); i++) { |
| | | // 一级菜单没有parentId |
| | | if (BaseConsts.ROOT.equals(rolefuns.get(i).getParentId())) { |
| | | list.add(rolefuns.get(i)); |
| | | } |
| | | } |
| | | // 为一级菜单设置子菜单,getChild是递归调用的 |
| | | for (CtRolefun rolefun : list) { |
| | | RoleTreeBO treeBO = new RoleTreeBO(); |
| | | treeBO.setLabel(rolefun.getPowerName()); |
| | | treeBO.setValue(rolefun.getPowerId()); |
| | | treeBO.setLabelType(rolefun.getPowerType()); |
| | | treeBO.setAppClient(rolefun.getAppClient()); |
| | | treeBO.setPowerTag(rolefun.getPowerTag()); |
| | | treeBO.setPowerUrl(rolefun.getPowerUrl()); |
| | | treeBO.setPowerIcon(rolefun.getPowerIcon()); |
| | | treeBO.setChildren(getChild(rolefun.getPowerId(), rolefuns)); |
| | | treeBOS.add(treeBO); |
| | | } |
| | | } |
| | | return treeBOS; |
| | | } |
| | | |
| | | /** |
| | | * 递归查找子菜单 |
| | | * @param id 当前菜单id |
| | | * @param ctRolefuns 要查找的列表 |
| | | * @return List<TreeBO> 树形列表集合 |
| | | */ |
| | | private List<RoleTreeBO> getChild(String id, List<CtRolefun> ctRolefuns) { |
| | | // 子菜单 |
| | | List<RoleTreeBO> childList = new ArrayList<>(); |
| | | for (CtRolefun rolefun : ctRolefuns) { |
| | | // 遍历所有节点,将父菜单id与传过来的id比较 |
| | | if (StringUtils.isNotBlank(rolefun.getParentId())) { |
| | | if (rolefun.getParentId().equals(id)) { |
| | | RoleTreeBO roleTree = new RoleTreeBO(); |
| | | roleTree.setLabel(rolefun.getPowerName()); |
| | | roleTree.setValue(rolefun.getPowerId()); |
| | | roleTree.setLabelType(rolefun.getPowerType()); |
| | | roleTree.setAppClient(rolefun.getAppClient()); |
| | | roleTree.setPowerTag(rolefun.getPowerTag()); |
| | | roleTree.setPowerUrl(rolefun.getPowerUrl()); |
| | | roleTree.setPowerIcon(rolefun.getPowerIcon()); |
| | | roleTree.setChildren(getChild(rolefun.getPowerId(), ctRolefuns)); |
| | | childList.add(roleTree); |
| | | } |
| | | } |
| | | } |
| | | return childList; |
| | | } |
| | | } |
| | |
| | | .select("unit_type"); |
| | | CtUnit ctUnit = ctUnitService.getOne(ctUnitQueryWrapper1); |
| | | if (ctUnit.getUnitType() == UserBaseConsts.UNIT_TYPE_4) { |
| | | ctRoleQueryWrapper.ne("role_code", RoleBaseEnum.ROLE_9.getIndex()); |
| | | ctRoleQueryWrapper.ne("role_code", RoleBaseEnum.ROLE_1.getIndex()); |
| | | } |
| | | List<CtRole> ctRoleList = ctRoleService.list(ctRoleQueryWrapper); |
| | | List<SelectTermDTO> roleSelectTerms = new ArrayList<>(); |
| New file |
| | |
| | | package cn.huge.module.rsoper.controller.web; |
| | | |
| | | import cn.huge.base.common.utils.ReturnFailUtils; |
| | | import cn.huge.base.common.utils.ReturnSucUtils; |
| | | import cn.huge.module.rsoper.domain.po.RsMenu; |
| | | import cn.huge.module.rsoper.service.RsMenuService; |
| | | import com.google.common.collect.Maps; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * @title: 平台功能目录表接口api-web端 |
| | | * @description: 平台功能目录表接口api-web端 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 10:57:02 |
| | | * @version: 1.0.0 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/api/web/rsMenu") |
| | | public class RsMenuWebController { |
| | | |
| | | @Autowired(required = false) |
| | | private HttpServletRequest request; |
| | | |
| | | @Autowired |
| | | private RsMenuService service; |
| | | |
| | | /** |
| | | * 获取请求URL参数 |
| | | * @return Map<String, Object> |
| | | */ |
| | | private Map<String, Object> getParameter(){ |
| | | Map<String, Object> terms = Maps.newHashMap(); |
| | | // 目录编号 |
| | | String id = request.getParameter("id"); |
| | | if (StringUtils.isNotBlank(id)){ |
| | | terms.put("id", id); |
| | | } |
| | | // 目录类型,0:应用,1:模块,2:菜单,3:功能 |
| | | String menuType = request.getParameter("menuType"); |
| | | if (StringUtils.isNotBlank(menuType)){ |
| | | terms.put("menuType", menuType); |
| | | } |
| | | // 目录标签 |
| | | String menuTag = request.getParameter("menuTag"); |
| | | if (StringUtils.isNotBlank(menuTag)){ |
| | | terms.put("menuTag", menuTag); |
| | | } |
| | | // 目录名称 |
| | | String menuName = request.getParameter("menuName"); |
| | | if (StringUtils.isNotBlank(menuName)){ |
| | | terms.put("menuName", menuName); |
| | | } |
| | | // 目录图标 |
| | | String menuIcon = request.getParameter("menuIcon"); |
| | | if (StringUtils.isNotBlank(menuIcon)){ |
| | | terms.put("menuIcon", menuIcon); |
| | | } |
| | | // 目录访问url |
| | | String menuUrl = request.getParameter("menuUrl"); |
| | | if (StringUtils.isNotBlank(menuUrl)){ |
| | | terms.put("menuUrl", menuUrl); |
| | | } |
| | | // 目录描述 |
| | | String menuDes = request.getParameter("menuDes"); |
| | | if (StringUtils.isNotBlank(menuDes)){ |
| | | terms.put("menuDes", menuDes); |
| | | } |
| | | // 所属应用客户端,1:web端,2:当事人小程序 |
| | | String appClient = request.getParameter("appClient"); |
| | | if (StringUtils.isNotBlank(appClient)){ |
| | | terms.put("appClient", appClient); |
| | | } |
| | | // 所属应用类型,1:普通应用,2:付费应用 |
| | | String appType = request.getParameter("appType"); |
| | | if (StringUtils.isNotBlank(appType)){ |
| | | terms.put("appType", appType); |
| | | } |
| | | // 同级目录排序 |
| | | String sorts = request.getParameter("sorts"); |
| | | if (StringUtils.isNotBlank(sorts)){ |
| | | terms.put("sorts", sorts); |
| | | } |
| | | // 父模块编号,根级默认root |
| | | String parentId = request.getParameter("parentId"); |
| | | if (StringUtils.isNotBlank(parentId)){ |
| | | terms.put("parentId", parentId); |
| | | } |
| | | // 删除状态,0:未删除,1:已删除 |
| | | String deleteStatus = request.getParameter("deleteStatus"); |
| | | if (StringUtils.isNotBlank(deleteStatus)){ |
| | | terms.put("deleteStatus", deleteStatus); |
| | | } |
| | | // 创建时间区间 |
| | | String createStart = request.getParameter("createStart"); |
| | | String createEnd = request.getParameter("createEnd"); |
| | | if(StringUtils.isNotBlank(createStart) && StringUtils.isNotBlank(createEnd)) { |
| | | terms.put("createStart", createStart); |
| | | terms.put("createEnd", createEnd); |
| | | } |
| | | // 更新时间区间 |
| | | String updateStart = request.getParameter("updateStart"); |
| | | String updateEnd = request.getParameter("updateEnd"); |
| | | if(StringUtils.isNotBlank(updateStart) && StringUtils.isNotBlank(updateEnd)) { |
| | | terms.put("updateStart", updateStart); |
| | | terms.put("updateEnd", updateEnd); |
| | | } |
| | | return terms; |
| | | } |
| | | |
| | | /** |
| | | * 条件查询多个 |
| | | * @url {ctx}/api/web/rsMenu/listQuery |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/listQuery") |
| | | public Object listQuery() { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | return ReturnSucUtils.getRepInfo(service.listTerms(terms)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件分页查询 |
| | | * @url {ctx}/api/web/rsMenu/pageQuery |
| | | * @param page 页码 |
| | | * @param size 每页数量 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/pageQuery") |
| | | public Object pageQuery(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "create_time"); |
| | | PageRequest pageRequest = PageRequest.of(page-1, size, sort); |
| | | Page<RsMenu> rsMenuPage = service.pageQuery(pageRequest, terms); |
| | | return ReturnSucUtils.getRepInfo( "处理成功", rsMenuPage); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据编号查询单个 |
| | | * @url {ctx}/api/web/rsMenu/getById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/getById") |
| | | public Object getById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | return ReturnSucUtils.getRepInfo(service.getById(id)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据主键单个 |
| | | * @url {ctx}/api/web/rsMenu/deleteById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/deleteById") |
| | | public Object deleteById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | service.removeById(id); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @url {ctx}/api/web/rsMenu/saveRsMenu |
| | | * @param rsMenu 实体对象 |
| | | * @return Object |
| | | */ |
| | | @PostMapping("/saveRsMenu") |
| | | public Object saveRsMenu(@RequestBody RsMenu rsMenu) { |
| | | try { |
| | | service.saveRsMenu(rsMenu); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.controller.web; |
| | | |
| | | import cn.huge.base.common.utils.ReturnFailUtils; |
| | | import cn.huge.base.common.utils.ReturnSucUtils; |
| | | import cn.huge.module.rsoper.domain.po.RsRolefun; |
| | | import cn.huge.module.rsoper.service.RsRolefunService; |
| | | import com.google.common.collect.Maps; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * @title: 系统角色功能权限表接口api-web端 |
| | | * @description: 系统角色功能权限表接口api-web端 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 15:46:25 |
| | | * @version: 1.0.0 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/api/web/rsRolefun") |
| | | public class RsRolefunWebController { |
| | | |
| | | @Autowired(required = false) |
| | | private HttpServletRequest request; |
| | | |
| | | @Autowired |
| | | private RsRolefunService service; |
| | | |
| | | /** |
| | | * 获取请求URL参数 |
| | | * @return Map<String, Object> |
| | | */ |
| | | private Map<String, Object> getParameter(){ |
| | | Map<String, Object> terms = Maps.newHashMap(); |
| | | // 角色功能编号 |
| | | String id = request.getParameter("id"); |
| | | if (StringUtils.isNotBlank(id)){ |
| | | terms.put("id", id); |
| | | } |
| | | // 角色编号 |
| | | String roleId = request.getParameter("roleId"); |
| | | if (StringUtils.isNotBlank(roleId)){ |
| | | terms.put("roleId", roleId); |
| | | } |
| | | // 权限编号 |
| | | String menuId = request.getParameter("menuId"); |
| | | if (StringUtils.isNotBlank(menuId)){ |
| | | terms.put("menuId", menuId); |
| | | } |
| | | // 父级编号,根级默认为root |
| | | String parentId = request.getParameter("parentId"); |
| | | if (StringUtils.isNotBlank(parentId)){ |
| | | terms.put("parentId", parentId); |
| | | } |
| | | // 创建时间区间 |
| | | String createStart = request.getParameter("createStart"); |
| | | String createEnd = request.getParameter("createEnd"); |
| | | if(StringUtils.isNotBlank(createStart) && StringUtils.isNotBlank(createEnd)) { |
| | | terms.put("createStart", createStart); |
| | | terms.put("createEnd", createEnd); |
| | | } |
| | | // 更新时间区间 |
| | | String updateStart = request.getParameter("updateStart"); |
| | | String updateEnd = request.getParameter("updateEnd"); |
| | | if(StringUtils.isNotBlank(updateStart) && StringUtils.isNotBlank(updateEnd)) { |
| | | terms.put("updateStart", updateStart); |
| | | terms.put("updateEnd", updateEnd); |
| | | } |
| | | return terms; |
| | | } |
| | | |
| | | /** |
| | | * 条件查询多个 |
| | | * @url {ctx}/api/web/rsRolefun/listQuery |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/listQuery") |
| | | public Object listQuery() { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | return ReturnSucUtils.getRepInfo(service.listTerms(terms)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件分页查询 |
| | | * @url {ctx}/api/web/rsRolefun/pageQuery |
| | | * @param page 页码 |
| | | * @param size 每页数量 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/pageQuery") |
| | | public Object pageQuery(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "create_time"); |
| | | PageRequest pageRequest = PageRequest.of(page-1, size, sort); |
| | | Page<RsRolefun> rsRolefunPage = service.pageQuery(pageRequest, terms); |
| | | return ReturnSucUtils.getRepInfo( "处理成功", rsRolefunPage); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据编号查询单个 |
| | | * @url {ctx}/api/web/rsRolefun/getById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/getById") |
| | | public Object getById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | return ReturnSucUtils.getRepInfo(service.getById(id)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据主键单个 |
| | | * @url {ctx}/api/web/rsRolefun/deleteById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/deleteById") |
| | | public Object deleteById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | service.removeById(id); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @url {ctx}/api/web/rsRolefun/saveRsRolefun |
| | | * @param rsRolefun 实体对象 |
| | | * @return Object |
| | | */ |
| | | @PostMapping("/saveRsRolefun") |
| | | public Object saveRsRolefun(@RequestBody RsRolefun rsRolefun) { |
| | | try { |
| | | service.saveRsRolefun(rsRolefun); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 人工临时处理-给所有角色赋菜单权限 |
| | | * @url {ctx}/api/web/rsRoleFun/setFun |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/setFun") |
| | | public Object setFun() { |
| | | try { |
| | | service.webSetFun(); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.controller.web; |
| | | |
| | | import cn.huge.base.common.utils.ReturnFailUtils; |
| | | import cn.huge.base.common.utils.ReturnSucUtils; |
| | | import cn.huge.module.rsoper.domain.po.RsRole; |
| | | import cn.huge.module.rsoper.service.RsRoleService; |
| | | import com.google.common.collect.Maps; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * @title: 系统角色定义表接口api-web端 |
| | | * @description: 系统角色定义表接口api-web端 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 10:57:02 |
| | | * @version: 1.0.0 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/api/web/rsRole") |
| | | public class RsRoleWebController { |
| | | |
| | | @Autowired(required = false) |
| | | private HttpServletRequest request; |
| | | |
| | | @Autowired |
| | | private RsRoleService service; |
| | | |
| | | /** |
| | | * 获取请求URL参数 |
| | | * @return Map<String, Object> |
| | | */ |
| | | private Map<String, Object> getParameter(){ |
| | | Map<String, Object> terms = Maps.newHashMap(); |
| | | // 角色编号 |
| | | String id = request.getParameter("id"); |
| | | if (StringUtils.isNotBlank(id)){ |
| | | terms.put("id", id); |
| | | } |
| | | // 角色名称 |
| | | String name = request.getParameter("name"); |
| | | if (StringUtils.isNotBlank(name)){ |
| | | terms.put("name", name); |
| | | } |
| | | // 角色类型,1:系统角色,2:用户自定义角色 |
| | | String roleType = request.getParameter("roleType"); |
| | | if (StringUtils.isNotBlank(roleType)){ |
| | | terms.put("roleType", roleType); |
| | | } |
| | | // 删除状态,0:未删除,1:已删除 |
| | | String deleteStatus = request.getParameter("deleteStatus"); |
| | | if (StringUtils.isNotBlank(deleteStatus)){ |
| | | terms.put("deleteStatus", deleteStatus); |
| | | } |
| | | // 创建时间区间 |
| | | String createStart = request.getParameter("createStart"); |
| | | String createEnd = request.getParameter("createEnd"); |
| | | if(StringUtils.isNotBlank(createStart) && StringUtils.isNotBlank(createEnd)) { |
| | | terms.put("createStart", createStart); |
| | | terms.put("createEnd", createEnd); |
| | | } |
| | | // 更新时间区间 |
| | | String updateStart = request.getParameter("updateStart"); |
| | | String updateEnd = request.getParameter("updateEnd"); |
| | | if(StringUtils.isNotBlank(updateStart) && StringUtils.isNotBlank(updateEnd)) { |
| | | terms.put("updateStart", updateStart); |
| | | terms.put("updateEnd", updateEnd); |
| | | } |
| | | return terms; |
| | | } |
| | | |
| | | /** |
| | | * 条件查询多个 |
| | | * @url {ctx}/api/web/rsRole/listQuery |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/listQuery") |
| | | public Object listQuery() { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | return ReturnSucUtils.getRepInfo(service.listTerms(terms)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件分页查询 |
| | | * @url {ctx}/api/web/rsRole/pageQuery |
| | | * @param page 页码 |
| | | * @param size 每页数量 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/pageQuery") |
| | | public Object pageQuery(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "create_time"); |
| | | PageRequest pageRequest = PageRequest.of(page-1, size, sort); |
| | | Page<RsRole> rsRolePage = service.pageQuery(pageRequest, terms); |
| | | return ReturnSucUtils.getRepInfo( "处理成功", rsRolePage); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据编号查询单个 |
| | | * @url {ctx}/api/web/rsRole/getById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/getById") |
| | | public Object getById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | return ReturnSucUtils.getRepInfo(service.getById(id)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据主键单个 |
| | | * @url {ctx}/api/web/rsRole/deleteById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/deleteById") |
| | | public Object deleteById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | service.removeById(id); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @url {ctx}/api/web/rsRole/saveRsRole |
| | | * @param rsRole 实体对象 |
| | | * @return Object |
| | | */ |
| | | @PostMapping("/saveRsRole") |
| | | public Object saveRsRole(@RequestBody RsRole rsRole) { |
| | | try { |
| | | service.saveRsRole(rsRole); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.dao.mapper; |
| | | |
| | | import cn.huge.module.rsoper.domain.po.RsMenu; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @title: 平台功能目录表持久层业务处理 |
| | | * @Description 此处仅涉及复杂SQL操作,务必不要在此再次写单表的CRUD操作,因为mybatisPlus已经实现。 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 10:57:02 |
| | | * @version 1.0.0 |
| | | */ |
| | | @Repository |
| | | public interface RsMenuMapper extends BaseMapper<RsMenu>{ |
| | | |
| | | /** |
| | | * 更新对象 |
| | | * @param entity 对象 |
| | | */ |
| | | void updateRsMenu(@Param("entity") RsMenu entity); |
| | | |
| | | /** |
| | | * 条件更新对象 |
| | | * @param entity 对象 |
| | | * @param terms 条件 |
| | | */ |
| | | void updateRsMenuTerms(@Param("entity") RsMenu entity, @Param("terms") Map<String, Object> terms); |
| | | |
| | | /** |
| | | * 根据编号物理删除 |
| | | * @param id 查询条件集合 |
| | | */ |
| | | void deleteRsMenu(@Param("id") String id); |
| | | |
| | | /** |
| | | * 按条件查询结果集 |
| | | * @param terms 查询条件集合 |
| | | * @return List<RsMenu> |
| | | */ |
| | | List<RsMenu> listTerms(@Param("terms") Map<String, Object> terms); |
| | | |
| | | /** |
| | | * 按条件查询实体总数 |
| | | * @param terms 查询条件集合 |
| | | * @return long |
| | | */ |
| | | long countTerms(@Param("terms") Map<String, Object> terms); |
| | | |
| | | /** |
| | | * 按条件查询实体分页结果集 |
| | | * @param page 分页对象 |
| | | * @param terms 查询条件集合 |
| | | * @return List<RsMenu> |
| | | */ |
| | | List<RsMenu> pageTerms(@Param("page") PageRequest page, @Param("terms") Map<String, Object> terms); |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.dao.mapper; |
| | | |
| | | import cn.huge.module.rsoper.domain.dto.RoleMenuTreeDTO; |
| | | import cn.huge.module.rsoper.domain.po.RsRolefun; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @title: 系统角色功能权限表持久层业务处理 |
| | | * @Description 此处仅涉及复杂SQL操作,务必不要在此再次写单表的CRUD操作,因为mybatisPlus已经实现。 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 15:46:25 |
| | | * @version 1.0.0 |
| | | */ |
| | | @Repository |
| | | public interface RsRolefunMapper extends BaseMapper<RsRolefun>{ |
| | | |
| | | /** |
| | | * 更新对象 |
| | | * @param entity 对象 |
| | | */ |
| | | void updateRsRolefun(@Param("entity") RsRolefun entity); |
| | | |
| | | /** |
| | | * 条件更新对象 |
| | | * @param entity 对象 |
| | | * @param terms 条件 |
| | | */ |
| | | void updateRsRolefunTerms(@Param("entity") RsRolefun entity, @Param("terms") Map<String, Object> terms); |
| | | |
| | | /** |
| | | * 根据编号物理删除 |
| | | * @param id 查询条件集合 |
| | | */ |
| | | void deleteRsRolefun(@Param("id") String id); |
| | | |
| | | /** |
| | | * 按条件查询结果集 |
| | | * @param terms 查询条件集合 |
| | | * @return List<RsRolefun> |
| | | */ |
| | | List<RsRolefun> listTerms(@Param("terms") Map<String, Object> terms); |
| | | |
| | | /** |
| | | * 按条件查询实体总数 |
| | | * @param terms 查询条件集合 |
| | | * @return long |
| | | */ |
| | | long countTerms(@Param("terms") Map<String, Object> terms); |
| | | |
| | | /** |
| | | * 按条件查询实体分页结果集 |
| | | * @param page 分页对象 |
| | | * @param terms 查询条件集合 |
| | | * @return List<RsRolefun> |
| | | */ |
| | | List<RsRolefun> pageTerms(@Param("page") PageRequest page, @Param("terms") Map<String, Object> terms); |
| | | |
| | | /** |
| | | * 获取角色的菜单权限 |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | List<RoleMenuTreeDTO> listMenuByRoleId(@Param("roleId") String roleId); |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.dao.mapper; |
| | | |
| | | import cn.huge.module.rsoper.domain.po.RsRole; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @title: 系统角色定义表持久层业务处理 |
| | | * @Description 此处仅涉及复杂SQL操作,务必不要在此再次写单表的CRUD操作,因为mybatisPlus已经实现。 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 10:57:02 |
| | | * @version 1.0.0 |
| | | */ |
| | | @Repository |
| | | public interface RsRoleMapper extends BaseMapper<RsRole>{ |
| | | |
| | | /** |
| | | * 更新对象 |
| | | * @param entity 对象 |
| | | */ |
| | | void updateRsRole(@Param("entity") RsRole entity); |
| | | |
| | | /** |
| | | * 条件更新对象 |
| | | * @param entity 对象 |
| | | * @param terms 条件 |
| | | */ |
| | | void updateRsRoleTerms(@Param("entity") RsRole entity, @Param("terms") Map<String, Object> terms); |
| | | |
| | | /** |
| | | * 根据编号物理删除 |
| | | * @param id 查询条件集合 |
| | | */ |
| | | void deleteRsRole(@Param("id") String id); |
| | | |
| | | /** |
| | | * 按条件查询结果集 |
| | | * @param terms 查询条件集合 |
| | | * @return List<RsRole> |
| | | */ |
| | | List<RsRole> listTerms(@Param("terms") Map<String, Object> terms); |
| | | |
| | | /** |
| | | * 按条件查询实体总数 |
| | | * @param terms 查询条件集合 |
| | | * @return long |
| | | */ |
| | | long countTerms(@Param("terms") Map<String, Object> terms); |
| | | |
| | | /** |
| | | * 按条件查询实体分页结果集 |
| | | * @param page 分页对象 |
| | | * @param terms 查询条件集合 |
| | | * @return List<RsRole> |
| | | */ |
| | | List<RsRole> pageTerms(@Param("page") PageRequest page, @Param("terms") Map<String, Object> terms); |
| | | |
| | | } |
| New file |
| | |
| | | <?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"> |
| | | <!-- |
| | | * @title: 平台功能目录表 |
| | | * @description: 自定义sql,请自行实现业务逻辑 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time:2024-09-10 10:57:02 |
| | | * @version 1.0.0 |
| | | --> |
| | | <mapper namespace="cn.huge.module.rsoper.dao.mapper.RsMenuMapper"> |
| | | <!-- 结果集 --> |
| | | <resultMap id="dataResult" type="cn.huge.module.rsoper.domain.po.RsMenu"> |
| | | <result property="id" column="id"/> |
| | | <result property="menuType" column="menu_type"/> |
| | | <result property="menuTag" column="menu_tag"/> |
| | | <result property="menuName" column="menu_name"/> |
| | | <result property="menuIcon" column="menu_icon"/> |
| | | <result property="menuUrl" column="menu_url"/> |
| | | <result property="menuDes" column="menu_des"/> |
| | | <result property="appClient" column="app_client"/> |
| | | <result property="appType" column="app_type"/> |
| | | <result property="sorts" column="sorts"/> |
| | | <result property="parentId" column="parent_id"/> |
| | | <result property="deleteStatus" column="delete_status"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | <!-- 表 --> |
| | | <sql id='table-name'>dyh_rs_menu</sql> |
| | | <!-- 字段 --> |
| | | <sql id="column-part"> |
| | | id, |
| | | menu_type, |
| | | menu_tag, |
| | | menu_name, |
| | | menu_icon, |
| | | menu_url, |
| | | menu_des, |
| | | app_client, |
| | | app_type, |
| | | sorts, |
| | | parent_id, |
| | | delete_status, |
| | | create_time, |
| | | update_time |
| | | </sql> |
| | | <!-- 更新实体字段 --> |
| | | <sql id="set-part"> |
| | | <if test="entity.menuType != null">menu_type = #{entity.menuType},</if> |
| | | <if test="entity.menuTag != null">menu_tag = #{entity.menuTag},</if> |
| | | <if test="entity.menuName != null">menu_name = #{entity.menuName},</if> |
| | | <if test="entity.menuIcon != null">menu_icon = #{entity.menuIcon},</if> |
| | | <if test="entity.menuUrl != null">menu_url = #{entity.menuUrl},</if> |
| | | <if test="entity.menuDes != null">menu_des = #{entity.menuDes},</if> |
| | | <if test="entity.appClient != null">app_client = #{entity.appClient},</if> |
| | | <if test="entity.appType != null">app_type = #{entity.appType},</if> |
| | | <if test="entity.sorts != null">sorts = #{entity.sorts},</if> |
| | | <if test="entity.parentId != null">parent_id = #{entity.parentId},</if> |
| | | <if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</if> |
| | | <if test="entity.createTime != null">create_time = #{entity.createTime},</if> |
| | | <if test="entity.updateTime != null">update_time = #{entity.updateTime}</if> |
| | | </sql> |
| | | <!-- 条件 --> |
| | | <sql id="where-part"> |
| | | <if test="terms != null"> |
| | | <where> |
| | | <if test="terms.id != null and terms.id !=''"> |
| | | and id = #{terms.id} |
| | | </if> |
| | | <if test="terms.menuType != null and terms.menuType !=''"> |
| | | and menu_type = #{terms.menuType} |
| | | </if> |
| | | <if test="terms.menuTag != null and terms.menuTag !=''"> |
| | | and menu_tag = #{terms.menuTag} |
| | | </if> |
| | | <if test="terms.menuName != null and terms.menuName !=''"> |
| | | and menu_name = #{terms.menuName} |
| | | </if> |
| | | <if test="terms.menuIcon != null and terms.menuIcon !=''"> |
| | | and menu_icon = #{terms.menuIcon} |
| | | </if> |
| | | <if test="terms.menuUrl != null and terms.menuUrl !=''"> |
| | | and menu_url = #{terms.menuUrl} |
| | | </if> |
| | | <if test="terms.menuDes != null and terms.menuDes !=''"> |
| | | and menu_des = #{terms.menuDes} |
| | | </if> |
| | | <if test="terms.appClient != null and terms.appClient !=''"> |
| | | and app_client = #{terms.appClient} |
| | | </if> |
| | | <if test="terms.appType != null and terms.appType !=''"> |
| | | and app_type = #{terms.appType} |
| | | </if> |
| | | <if test="terms.sorts != null and terms.sorts !=''"> |
| | | and sorts = #{terms.sorts} |
| | | </if> |
| | | <if test="terms.parentId != null and terms.parentId !=''"> |
| | | and parent_id = #{terms.parentId} |
| | | </if> |
| | | <if test="terms.deleteStatus = null and terms.deleteStatus =''"> |
| | | and delete_status = 0 |
| | | </if> |
| | | <if test="terms.deleteStatus != null and terms.deleteStatus !=''"> |
| | | and delete_status = #{terms.deleteStatus} |
| | | </if> |
| | | <if test="terms.createTime != null and terms.createTime !=''"> |
| | | and DATE_FORMAT(create_time,'%Y-%m-%d') = #{terms.createTime} |
| | | </if> |
| | | <if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''"> |
| | | and (DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createStart} |
| | | and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createEnd}) |
| | | </if> |
| | | <if test="terms.updateTime != null and terms.updateTime !=''"> |
| | | and DATE_FORMAT(update_time,'%Y-%m-%d') = #{terms.updateTime} |
| | | </if> |
| | | <if test="terms.updateStart != null and terms.updateStart !='' and terms.updateEnd != null and terms.updateEnd !=''"> |
| | | and (DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.updateStart} |
| | | and DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.updateEnd}) |
| | | </if> |
| | | </where> |
| | | </if> |
| | | </sql> |
| | | <!-- 更新对象 --> |
| | | <update id="updateRsMenu"> |
| | | update |
| | | <include refid="table-name"/> |
| | | <set> |
| | | <include refid="set-part"/> |
| | | </set> |
| | | <where> |
| | | id = #{entity.id} |
| | | </where> |
| | | </update> |
| | | <!-- 条件更新对象 --> |
| | | <update id="updateRsMenuTerms"> |
| | | update |
| | | <include refid="table-name"/> |
| | | <set> |
| | | <include refid="set-part"/> |
| | | </set> |
| | | <include refid="where-part"/> |
| | | </update> |
| | | <!-- 根据编号物理删除 --> |
| | | <delete id="deleteRsMenu"> |
| | | delete from |
| | | <include refid="table-name" /> |
| | | where id = #{id} |
| | | </delete> |
| | | <!-- 根据条件查询 --> |
| | | <select id="listTerms" resultMap="dataResult"> |
| | | select |
| | | <include refid="column-part"/> |
| | | from |
| | | <include refid="table-name" /> |
| | | <include refid="where-part"/> |
| | | </select> |
| | | <!-- 根据条件统计 --> |
| | | <select id="countTerms" resultType="java.lang.Long"> |
| | | select |
| | | COUNT(1) |
| | | from |
| | | <include refid="table-name" /> |
| | | <include refid="where-part"/> |
| | | </select> |
| | | <!-- 根据条件分页查询 --> |
| | | <select id="pageTerms" resultMap="dataResult"> |
| | | SELECT |
| | | <include refid="column-part"/> |
| | | FROM |
| | | <include refid="table-name" /> |
| | | <include refid="where-part"/> |
| | | <if test="page.sort != null"> |
| | | <foreach collection="page.sort" item="s" index="index" separator="," open="order by "> |
| | | isnull(${s.property}), ${s.property} ${s.direction} |
| | | </foreach> |
| | | </if> |
| | | <if test="page.sort == null"> |
| | | order by isnull(create_time), create_time desc |
| | | </if> |
| | | limit #{page.offset}, #{page.size} |
| | | </select> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | <?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"> |
| | | <!-- |
| | | * @title: 系统角色功能权限表 |
| | | * @description: 自定义sql,请自行实现业务逻辑 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time:2024-09-10 15:46:25 |
| | | * @version 1.0.0 |
| | | --> |
| | | <mapper namespace="cn.huge.module.rsoper.dao.mapper.RsRolefunMapper"> |
| | | <!-- 结果集 --> |
| | | <resultMap id="dataResult" type="cn.huge.module.rsoper.domain.po.RsRolefun"> |
| | | <result property="id" column="id"/> |
| | | <result property="roleId" column="role_id"/> |
| | | <result property="menuId" column="menu_id"/> |
| | | <result property="parentId" column="parent_id"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | <!-- 表 --> |
| | | <sql id='table-name'>dyh_rs_rolefun</sql> |
| | | <!-- 字段 --> |
| | | <sql id="column-part"> |
| | | id, |
| | | role_id, |
| | | menu_id, |
| | | parent_id, |
| | | create_time, |
| | | update_time |
| | | </sql> |
| | | <!-- 更新实体字段 --> |
| | | <sql id="set-part"> |
| | | <if test="entity.roleId != null">role_id = #{entity.roleId},</if> |
| | | <if test="entity.menuId != null">menu_id = #{entity.menuId},</if> |
| | | <if test="entity.parentId != null">parent_id = #{entity.parentId},</if> |
| | | <if test="entity.createTime != null">create_time = #{entity.createTime},</if> |
| | | <if test="entity.updateTime != null">update_time = #{entity.updateTime}</if> |
| | | </sql> |
| | | <!-- 条件 --> |
| | | <sql id="where-part"> |
| | | <if test="terms != null"> |
| | | <where> |
| | | <if test="terms.id != null and terms.id !=''"> |
| | | and id = #{terms.id} |
| | | </if> |
| | | <if test="terms.roleId != null and terms.roleId !=''"> |
| | | and role_id = #{terms.roleId} |
| | | </if> |
| | | <if test="terms.menuId != null and terms.menuId !=''"> |
| | | and menu_id = #{terms.menuId} |
| | | </if> |
| | | <if test="terms.parentId != null and terms.parentId !=''"> |
| | | and parent_id = #{terms.parentId} |
| | | </if> |
| | | <if test="terms.createTime != null and terms.createTime !=''"> |
| | | and DATE_FORMAT(create_time,'%Y-%m-%d') = #{terms.createTime} |
| | | </if> |
| | | <if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''"> |
| | | and (DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createStart} |
| | | and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createEnd}) |
| | | </if> |
| | | <if test="terms.updateTime != null and terms.updateTime !=''"> |
| | | and DATE_FORMAT(update_time,'%Y-%m-%d') = #{terms.updateTime} |
| | | </if> |
| | | <if test="terms.updateStart != null and terms.updateStart !='' and terms.updateEnd != null and terms.updateEnd !=''"> |
| | | and (DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.updateStart} |
| | | and DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.updateEnd}) |
| | | </if> |
| | | </where> |
| | | </if> |
| | | </sql> |
| | | <!-- 更新对象 --> |
| | | <update id="updateRsRolefun"> |
| | | update |
| | | <include refid="table-name"/> |
| | | <set> |
| | | <include refid="set-part"/> |
| | | </set> |
| | | <where> |
| | | id = #{entity.id} |
| | | </where> |
| | | </update> |
| | | <!-- 条件更新对象 --> |
| | | <update id="updateRsRolefunTerms"> |
| | | update |
| | | <include refid="table-name"/> |
| | | <set> |
| | | <include refid="set-part"/> |
| | | </set> |
| | | <include refid="where-part"/> |
| | | </update> |
| | | <!-- 根据编号物理删除 --> |
| | | <delete id="deleteRsRolefun"> |
| | | delete from |
| | | <include refid="table-name" /> |
| | | where id = #{id} |
| | | </delete> |
| | | <!-- 根据条件查询 --> |
| | | <select id="listTerms" resultMap="dataResult"> |
| | | select |
| | | <include refid="column-part"/> |
| | | from |
| | | <include refid="table-name" /> |
| | | <include refid="where-part"/> |
| | | </select> |
| | | <!-- 根据条件统计 --> |
| | | <select id="countTerms" resultType="java.lang.Long"> |
| | | select |
| | | COUNT(1) |
| | | from |
| | | <include refid="table-name" /> |
| | | <include refid="where-part"/> |
| | | </select> |
| | | <!-- 根据条件分页查询 --> |
| | | <select id="pageTerms" resultMap="dataResult"> |
| | | SELECT |
| | | <include refid="column-part"/> |
| | | FROM |
| | | <include refid="table-name" /> |
| | | <include refid="where-part"/> |
| | | <if test="page.sort != null"> |
| | | <foreach collection="page.sort" item="s" index="index" separator="," open="order by "> |
| | | isnull(${s.property}), ${s.property} ${s.direction} |
| | | </foreach> |
| | | </if> |
| | | <if test="page.sort == null"> |
| | | order by isnull(create_time), create_time desc |
| | | </if> |
| | | limit #{page.offset}, #{page.size} |
| | | </select> |
| | | |
| | | <!-- 获取角色的菜单权限 --> |
| | | <select id="listMenuByRoleId" resultType="cn.huge.module.rsoper.domain.dto.RoleMenuTreeDTO"> |
| | | select t2.menu_name as label, t2.id as value, t2.menu_type as labelType, |
| | | t2.app_client as appClient, t2.menu_tag as powerTag, t2.menu_url as powerUrl, |
| | | t2.menu_icon as powerIcon, t2.parent_id as parentId |
| | | from dyh_rs_rolefun t1 left join dyh_rs_menu t2 on t1.menu_id = t2.id |
| | | where role_id = #{roleId} |
| | | </select> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | <?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"> |
| | | <!-- |
| | | * @title: 系统角色定义表 |
| | | * @description: 自定义sql,请自行实现业务逻辑 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time:2024-09-10 10:57:02 |
| | | * @version 1.0.0 |
| | | --> |
| | | <mapper namespace="cn.huge.module.rsoper.dao.mapper.RsRoleMapper"> |
| | | <!-- 结果集 --> |
| | | <resultMap id="dataResult" type="cn.huge.module.rsoper.domain.po.RsRole"> |
| | | <result property="id" column="id"/> |
| | | <result property="name" column="name"/> |
| | | <result property="roleType" column="role_type"/> |
| | | <result property="deleteStatus" column="delete_status"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | <!-- 表 --> |
| | | <sql id='table-name'>dyh_rs_role</sql> |
| | | <!-- 字段 --> |
| | | <sql id="column-part"> |
| | | id, |
| | | name, |
| | | role_type, |
| | | delete_status, |
| | | create_time, |
| | | update_time |
| | | </sql> |
| | | <!-- 更新实体字段 --> |
| | | <sql id="set-part"> |
| | | <if test="entity.name != null">name = #{entity.name},</if> |
| | | <if test="entity.roleType != null">role_type = #{entity.roleType},</if> |
| | | <if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</if> |
| | | <if test="entity.createTime != null">create_time = #{entity.createTime},</if> |
| | | <if test="entity.updateTime != null">update_time = #{entity.updateTime}</if> |
| | | </sql> |
| | | <!-- 条件 --> |
| | | <sql id="where-part"> |
| | | <if test="terms != null"> |
| | | <where> |
| | | <if test="terms.id != null and terms.id !=''"> |
| | | and id = #{terms.id} |
| | | </if> |
| | | <if test="terms.name != null and terms.name !=''"> |
| | | and name = #{terms.name} |
| | | </if> |
| | | <if test="terms.roleType != null and terms.roleType !=''"> |
| | | and role_type = #{terms.roleType} |
| | | </if> |
| | | <if test="terms.deleteStatus = null and terms.deleteStatus =''"> |
| | | and delete_status = 0 |
| | | </if> |
| | | <if test="terms.deleteStatus != null and terms.deleteStatus !=''"> |
| | | and delete_status = #{terms.deleteStatus} |
| | | </if> |
| | | <if test="terms.createTime != null and terms.createTime !=''"> |
| | | and DATE_FORMAT(create_time,'%Y-%m-%d') = #{terms.createTime} |
| | | </if> |
| | | <if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''"> |
| | | and (DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createStart} |
| | | and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createEnd}) |
| | | </if> |
| | | <if test="terms.updateTime != null and terms.updateTime !=''"> |
| | | and DATE_FORMAT(update_time,'%Y-%m-%d') = #{terms.updateTime} |
| | | </if> |
| | | <if test="terms.updateStart != null and terms.updateStart !='' and terms.updateEnd != null and terms.updateEnd !=''"> |
| | | and (DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.updateStart} |
| | | and DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.updateEnd}) |
| | | </if> |
| | | </where> |
| | | </if> |
| | | </sql> |
| | | <!-- 更新对象 --> |
| | | <update id="updateRsRole"> |
| | | update |
| | | <include refid="table-name"/> |
| | | <set> |
| | | <include refid="set-part"/> |
| | | </set> |
| | | <where> |
| | | id = #{entity.id} |
| | | </where> |
| | | </update> |
| | | <!-- 条件更新对象 --> |
| | | <update id="updateRsRoleTerms"> |
| | | update |
| | | <include refid="table-name"/> |
| | | <set> |
| | | <include refid="set-part"/> |
| | | </set> |
| | | <include refid="where-part"/> |
| | | </update> |
| | | <!-- 根据编号物理删除 --> |
| | | <delete id="deleteRsRole"> |
| | | delete from |
| | | <include refid="table-name" /> |
| | | where id = #{id} |
| | | </delete> |
| | | <!-- 根据条件查询 --> |
| | | <select id="listTerms" resultMap="dataResult"> |
| | | select |
| | | <include refid="column-part"/> |
| | | from |
| | | <include refid="table-name" /> |
| | | <include refid="where-part"/> |
| | | </select> |
| | | <!-- 根据条件统计 --> |
| | | <select id="countTerms" resultType="java.lang.Long"> |
| | | select |
| | | COUNT(1) |
| | | from |
| | | <include refid="table-name" /> |
| | | <include refid="where-part"/> |
| | | </select> |
| | | <!-- 根据条件分页查询 --> |
| | | <select id="pageTerms" resultMap="dataResult"> |
| | | SELECT |
| | | <include refid="column-part"/> |
| | | FROM |
| | | <include refid="table-name" /> |
| | | <include refid="where-part"/> |
| | | <if test="page.sort != null"> |
| | | <foreach collection="page.sort" item="s" index="index" separator="," open="order by "> |
| | | isnull(${s.property}), ${s.property} ${s.direction} |
| | | </foreach> |
| | | </if> |
| | | <if test="page.sort == null"> |
| | | order by isnull(create_time), create_time desc |
| | | </if> |
| | | limit #{page.offset}, #{page.size} |
| | | </select> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | package cn.huge.module.rsoper.domain.bo; |
| | | |
| | | import cn.huge.module.rsoper.domain.po.RsMenu; |
| | | |
| | | /** |
| | | * @title: 平台功能目录表业务扩展类 |
| | | * @description: 平台功能目录表业务扩展类 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 10:57:02 |
| | | * @version: 1.0.0 |
| | | * @see cn.huge.module.rsoper.domain.po.RsMenu |
| | | */ |
| | | public class RsMenuBO extends RsMenu { |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.domain.bo; |
| | | |
| | | import cn.huge.module.rsoper.domain.po.RsRole; |
| | | |
| | | /** |
| | | * @title: 系统角色定义表业务扩展类 |
| | | * @description: 系统角色定义表业务扩展类 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 10:57:02 |
| | | * @version: 1.0.0 |
| | | * @see cn.huge.module.rsoper.domain.po.RsRole |
| | | */ |
| | | public class RsRoleBO extends RsRole { |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.domain.bo; |
| | | |
| | | import cn.huge.module.rsoper.domain.po.RsRolefun; |
| | | |
| | | /** |
| | | * @title: 系统角色功能权限表业务扩展类 |
| | | * @description: 系统角色功能权限表业务扩展类 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 15:46:25 |
| | | * @version: 1.0.0 |
| | | * @see cn.huge.module.rsoper.domain.po.RsRolefun |
| | | */ |
| | | public class RsRolefunBO extends RsRolefun { |
| | | |
| | | |
| | | } |
| File was renamed from dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/bo/RoleTreeBO.java |
| | |
| | | package cn.huge.module.ctuser.domain.bo; |
| | | package cn.huge.module.rsoper.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | |
| | | * @author: chenx |
| | | * @time: 2022-03-05 14:16:28 |
| | | * @version: 1.0.0 |
| | | * @see RoleTreeBO |
| | | * @see RoleMenuTreeDTO |
| | | */ |
| | | @Data |
| | | public class RoleTreeBO { |
| | | public class RoleMenuTreeDTO { |
| | | |
| | | /** |
| | | * 树形名称 |
| | |
| | | private String powerIcon; |
| | | |
| | | /** |
| | | * 父级编号 |
| | | */ |
| | | private String parentId; |
| | | |
| | | /** |
| | | * 子集 |
| | | */ |
| | | private List<RoleTreeBO> children; |
| | | private List<RoleMenuTreeDTO> children; |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.domain.dto; |
| | | |
| | | import cn.huge.module.ctrole.domain.po.CtRolefun; |
| | | import cn.huge.module.rsoper.domain.po.RsRole; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @title: 系统角色定义表业务扩展类 |
| | | * @description: 系统角色定义表业务扩展类 |
| | | * @company: hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 10:57:02 |
| | | * @version: 1.0.0 |
| | | * @see RsRole |
| | | */ |
| | | @Data |
| | | public class RsRoleDTO extends RsRole { |
| | | |
| | | /** |
| | | * 角色代码 |
| | | */ |
| | | private String roleCode; |
| | | |
| | | /** |
| | | * 角色类型,1:系统角色,2:用户自定义角色 |
| | | */ |
| | | private Integer roleType; |
| | | |
| | | /** |
| | | * 返回树形结构 |
| | | */ |
| | | List<RoleMenuTreeDTO> roleTreeBOS; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.domain.po; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @title: 平台功能目录表数据库对应关系类 |
| | | * @description: PO中的属性与数据表是一一对应关系,如需根据业务处理不同,请使用BO对象。 |
| | | * @company:hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 10:57:02 |
| | | * @version 1.0.0 |
| | | */ |
| | | @TableName(value = "dyh_rs_menu") |
| | | @Data |
| | | public class RsMenu { |
| | | |
| | | /** |
| | | * 目录编号 |
| | | */ |
| | | @TableId(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 目录类型,0:应用,1:模块,2:菜单,3:功能 |
| | | */ |
| | | @TableField(value = "menu_type") |
| | | private Integer menuType; |
| | | |
| | | /** |
| | | * 目录标签 |
| | | */ |
| | | @TableField(value = "menu_tag") |
| | | private String menuTag; |
| | | |
| | | /** |
| | | * 目录名称 |
| | | */ |
| | | @TableField(value = "menu_name") |
| | | private String menuName; |
| | | |
| | | /** |
| | | * 目录图标 |
| | | */ |
| | | @TableField(value = "menu_icon") |
| | | private String menuIcon; |
| | | |
| | | /** |
| | | * 目录访问url |
| | | */ |
| | | @TableField(value = "menu_url") |
| | | private String menuUrl; |
| | | |
| | | /** |
| | | * 目录描述 |
| | | */ |
| | | @TableField(value = "menu_des") |
| | | private String menuDes; |
| | | |
| | | /** |
| | | * 所属应用客户端,1:web端,2:当事人小程序 |
| | | */ |
| | | @TableField(value = "app_client") |
| | | private Integer appClient; |
| | | |
| | | /** |
| | | * 所属应用类型,1:普通应用,2:付费应用 |
| | | */ |
| | | @TableField(value = "app_type") |
| | | private Integer appType; |
| | | |
| | | /** |
| | | * 同级目录排序 |
| | | */ |
| | | @TableField(value = "sorts") |
| | | private Integer sorts; |
| | | |
| | | /** |
| | | * 父模块编号,根级默认root |
| | | */ |
| | | @TableField(value = "parent_id") |
| | | private String parentId; |
| | | |
| | | /** |
| | | * 删除状态,0:未删除,1:已删除 |
| | | */ |
| | | @TableLogic |
| | | @TableField(value = "delete_status") |
| | | private Integer deleteStatus; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(value = "create_time") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(value = "update_time") |
| | | private Date updateTime; |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.domain.po; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @title: 系统角色定义表数据库对应关系类 |
| | | * @description: PO中的属性与数据表是一一对应关系,如需根据业务处理不同,请使用BO对象。 |
| | | * @company:hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 10:57:02 |
| | | * @version 1.0.0 |
| | | */ |
| | | @TableName(value = "dyh_rs_role") |
| | | @Data |
| | | public class RsRole { |
| | | |
| | | /** |
| | | * 角色编号 |
| | | */ |
| | | @TableId(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 角色名称 |
| | | */ |
| | | @TableField(value = "name") |
| | | private String name; |
| | | |
| | | /** |
| | | * 角色类型,1:系统角色,2:用户自定义角色 |
| | | */ |
| | | @TableField(value = "role_type") |
| | | private Integer roleType; |
| | | |
| | | /** |
| | | * 删除状态,0:未删除,1:已删除 |
| | | */ |
| | | @TableLogic |
| | | @TableField(value = "delete_status") |
| | | private Integer deleteStatus; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(value = "create_time") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(value = "update_time") |
| | | private Date updateTime; |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.domain.po; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @title: 系统角色功能权限表数据库对应关系类 |
| | | * @description: PO中的属性与数据表是一一对应关系,如需根据业务处理不同,请使用BO对象。 |
| | | * @company:hugeinfo |
| | | * @author: liyj |
| | | * @time: 2024-09-10 15:46:25 |
| | | * @version 1.0.0 |
| | | */ |
| | | @TableName(value = "dyh_rs_rolefun") |
| | | @Data |
| | | public class RsRolefun { |
| | | |
| | | /** |
| | | * 角色功能编号 |
| | | */ |
| | | @TableId(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 角色编号 |
| | | */ |
| | | @TableField(value = "role_id") |
| | | private String roleId; |
| | | |
| | | /** |
| | | * 权限编号 |
| | | */ |
| | | @TableField(value = "menu_id") |
| | | private String menuId; |
| | | |
| | | /** |
| | | * 父级编号,根级默认为root |
| | | */ |
| | | @TableField(value = "parent_id") |
| | | private String parentId; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(value = "create_time") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(value = "update_time") |
| | | private Date updateTime; |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.service; |
| | | |
| | | import cn.huge.base.common.exception.ServiceException; |
| | | import cn.huge.base.common.utils.DateUtils; |
| | | import cn.huge.base.common.utils.IdUtils; |
| | | import cn.huge.module.client.api.impl.UtilsClientImpl; |
| | | import cn.huge.module.rsoper.dao.mapper.RsMenuMapper; |
| | | import cn.huge.module.rsoper.domain.po.RsMenu; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageImpl; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @title: 平台功能目录表业务逻辑处理 |
| | | * @Description 平台功能目录表业务逻辑处理 |
| | | * @company hugeinfo |
| | | * @author liyj |
| | | * @Time 2024-09-10 10:57:02 |
| | | * @version 1.0.0 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class RsMenuService extends ServiceImpl<RsMenuMapper, RsMenu>{ |
| | | |
| | | @Autowired |
| | | private RsMenuMapper mapper; |
| | | |
| | | @Autowired |
| | | private UtilsClientImpl utilsClient; |
| | | |
| | | /** |
| | | * 更新对象 |
| | | * @param entity 对象 |
| | | */ |
| | | public void updateRsMenu(RsMenu entity){ |
| | | try{ |
| | | mapper.updateRsMenu(entity); |
| | | }catch (Exception e){ |
| | | log.error("[RsMenuService.updateRsMenu]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsMenuService.updateRsMenu", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件更新对象 |
| | | * @param entity 对象 |
| | | * @param terms 条件 |
| | | */ |
| | | public void updateRsMenuTerms(RsMenu entity, Map<String, Object> terms){ |
| | | try{ |
| | | mapper.updateRsMenuTerms(entity, terms); |
| | | }catch (Exception e){ |
| | | log.error("[RsMenuService.updateRsMenuTerms]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsMenuService.updateRsMenuTerms", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据编号物理删除 |
| | | * @param id 查询条件集合 |
| | | */ |
| | | public void deleteRsMenu(String id){ |
| | | try{ |
| | | mapper.deleteRsMenu(id); |
| | | }catch (Exception e){ |
| | | log.error("[RsMenuService.deleteRsMenu]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsMenuService.deleteRsMenu", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按条件查询 |
| | | * @param terms 条件 |
| | | * @return List |
| | | */ |
| | | public List<RsMenu> listTerms(Map<String, Object> terms){ |
| | | return mapper.listTerms(terms); |
| | | } |
| | | |
| | | /** |
| | | * 按条件统计 |
| | | * @param terms 条件 |
| | | * @return long |
| | | */ |
| | | public long countTerms(Map<String, Object> terms){ |
| | | return mapper.countTerms(terms); |
| | | } |
| | | |
| | | /** |
| | | * 按条件分页查询 |
| | | * @param page 分页对象 |
| | | * @param terms 条件 |
| | | * @return Page |
| | | */ |
| | | public Page<RsMenu> pageQuery(PageRequest page, Map<String, Object> terms){ |
| | | long total = mapper.countTerms(terms); |
| | | List<RsMenu> content = mapper.pageTerms(page, terms); |
| | | return new PageImpl<RsMenu>(content, page, total); |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @param rsMenu 实体对象 |
| | | */ |
| | | public void saveRsMenu(RsMenu rsMenu){ |
| | | try{ |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | // 判断是否新增 |
| | | if (IdUtils.checkNewId(rsMenu.getId())){ |
| | | rsMenu.setId(utilsClient.getNewTimeId()); |
| | | rsMenu.setCreateTime(nowDate); |
| | | } |
| | | rsMenu.setUpdateTime(nowDate); |
| | | this.saveOrUpdate(rsMenu); |
| | | }catch (Exception e){ |
| | | log.error("[RsMenuService.saveRsMenu]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsMenuService.saveRsMenu", e); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.service; |
| | | |
| | | import cn.huge.base.common.exception.ServiceException; |
| | | import cn.huge.base.common.utils.DateUtils; |
| | | import cn.huge.base.common.utils.IdUtils; |
| | | import cn.huge.module.client.api.impl.UtilsClientImpl; |
| | | import cn.huge.module.constant.BaseConsts; |
| | | import cn.huge.module.cust.constant.MenuBaseEnum; |
| | | import cn.huge.module.cust.constant.RoleBaseEnum; |
| | | import cn.huge.module.rsoper.dao.mapper.RsRolefunMapper; |
| | | import cn.huge.module.rsoper.domain.dto.RoleMenuTreeDTO; |
| | | import cn.huge.module.rsoper.domain.po.RsMenu; |
| | | import cn.huge.module.rsoper.domain.po.RsRole; |
| | | import cn.huge.module.rsoper.domain.po.RsRolefun; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageImpl; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @title: 系统角色功能权限表业务逻辑处理 |
| | | * @Description 系统角色功能权限表业务逻辑处理 |
| | | * @company hugeinfo |
| | | * @author liyj |
| | | * @Time 2024-09-10 15:46:25 |
| | | * @version 1.0.0 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class RsRolefunService extends ServiceImpl<RsRolefunMapper, RsRolefun>{ |
| | | |
| | | @Autowired |
| | | private RsRolefunMapper mapper; |
| | | |
| | | @Autowired |
| | | private UtilsClientImpl utilsClient; |
| | | @Autowired |
| | | private RsMenuService rsMenuService; |
| | | @Autowired |
| | | private RsRoleService rsRoleService; |
| | | |
| | | /** |
| | | * 更新对象 |
| | | * @param entity 对象 |
| | | */ |
| | | public void updateRsRolefun(RsRolefun entity){ |
| | | try{ |
| | | mapper.updateRsRolefun(entity); |
| | | }catch (Exception e){ |
| | | log.error("[RsRolefunService.updateRsRolefun]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRolefunService.updateRsRolefun", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件更新对象 |
| | | * @param entity 对象 |
| | | * @param terms 条件 |
| | | */ |
| | | public void updateRsRolefunTerms(RsRolefun entity, Map<String, Object> terms){ |
| | | try{ |
| | | mapper.updateRsRolefunTerms(entity, terms); |
| | | }catch (Exception e){ |
| | | log.error("[RsRolefunService.updateRsRolefunTerms]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRolefunService.updateRsRolefunTerms", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据编号物理删除 |
| | | * @param id 查询条件集合 |
| | | */ |
| | | public void deleteRsRolefun(String id){ |
| | | try{ |
| | | mapper.deleteRsRolefun(id); |
| | | }catch (Exception e){ |
| | | log.error("[RsRolefunService.deleteRsRolefun]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRolefunService.deleteRsRolefun", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按条件查询 |
| | | * @param terms 条件 |
| | | * @return List |
| | | */ |
| | | public List<RsRolefun> listTerms(Map<String, Object> terms){ |
| | | return mapper.listTerms(terms); |
| | | } |
| | | |
| | | /** |
| | | * 按条件统计 |
| | | * @param terms 条件 |
| | | * @return long |
| | | */ |
| | | public long countTerms(Map<String, Object> terms){ |
| | | return mapper.countTerms(terms); |
| | | } |
| | | |
| | | /** |
| | | * 按条件分页查询 |
| | | * @param page 分页对象 |
| | | * @param terms 条件 |
| | | * @return Page |
| | | */ |
| | | public Page<RsRolefun> pageQuery(PageRequest page, Map<String, Object> terms){ |
| | | long total = mapper.countTerms(terms); |
| | | List<RsRolefun> content = mapper.pageTerms(page, terms); |
| | | return new PageImpl<RsRolefun>(content, page, total); |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @param rsRolefun 实体对象 |
| | | */ |
| | | public void saveRsRolefun(RsRolefun rsRolefun){ |
| | | try{ |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | // 判断是否新增 |
| | | if (IdUtils.checkNewId(rsRolefun.getId())){ |
| | | rsRolefun.setId(utilsClient.getNewTimeId()); |
| | | rsRolefun.setCreateTime(nowDate); |
| | | } |
| | | rsRolefun.setUpdateTime(nowDate); |
| | | this.saveOrUpdate(rsRolefun); |
| | | }catch (Exception e){ |
| | | log.error("[RsRolefunService.saveRsRolefun]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRolefunService.saveRsRolefun", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取角色的菜单权限 |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | public List<RoleMenuTreeDTO> listMenuByRoleId(String roleId){ |
| | | return mapper.listMenuByRoleId(roleId); |
| | | } |
| | | |
| | | /** |
| | | * 查询角色菜单权限树形结构 |
| | | * @param roleId 角色编号 |
| | | * @return List<RoleTreeBO> 树形结构 |
| | | */ |
| | | public List<RoleMenuTreeDTO> getRolefunTree(String roleId){ |
| | | try{ |
| | | List<RoleMenuTreeDTO> roleMenuTreeDTOList = mapper.listMenuByRoleId(roleId); |
| | | List<RoleMenuTreeDTO> firstList = new ArrayList<>(); |
| | | List<RoleMenuTreeDTO> treeList = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(roleMenuTreeDTOList)) { |
| | | //第一级菜单集合 |
| | | for (RoleMenuTreeDTO roleMenuTreeDTO: roleMenuTreeDTOList) { |
| | | // 一级菜单parentId为root |
| | | if (BaseConsts.ROOT.equals(roleMenuTreeDTO.getParentId())) { |
| | | firstList.add(roleMenuTreeDTO); |
| | | } |
| | | } |
| | | // 为一级菜单设置子菜单,getChild是递归调用的 |
| | | for (RoleMenuTreeDTO roleMenuTreeDTO : firstList) { |
| | | roleMenuTreeDTO.setChildren(getChild(roleMenuTreeDTO.getValue(), roleMenuTreeDTOList)); |
| | | treeList.add(roleMenuTreeDTO); |
| | | } |
| | | } |
| | | return treeList; |
| | | }catch (Exception e){ |
| | | log.error("[RsRolefunService.getRolefunTree]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRolefunService.getRolefunTree", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 递归查找子菜单 |
| | | * @param id 当前菜单id |
| | | * @param roleMenuTreeDTOList 要查找的列表 |
| | | * @return List<TreeBO> 树形列表集合 |
| | | */ |
| | | private List<RoleMenuTreeDTO> getChild(String id, List<RoleMenuTreeDTO> roleMenuTreeDTOList) { |
| | | // 子菜单 |
| | | List<RoleMenuTreeDTO> childList = new ArrayList<>(); |
| | | for (RoleMenuTreeDTO roleMenuTreeDTO: roleMenuTreeDTOList) { |
| | | // 遍历所有节点,将父菜单id与传过来的id比较 |
| | | if (StringUtils.isNotBlank(roleMenuTreeDTO.getParentId())) { |
| | | if (roleMenuTreeDTO.getParentId().equals(id)) { |
| | | roleMenuTreeDTO.setChildren(getChild(roleMenuTreeDTO.getValue(), roleMenuTreeDTOList)); |
| | | childList.add(roleMenuTreeDTO); |
| | | } |
| | | } |
| | | } |
| | | return childList; |
| | | } |
| | | |
| | | /** |
| | | * 人工临时处理-给所有角色赋菜单权限 |
| | | */ |
| | | public void webSetFun(){ |
| | | try{ |
| | | // 查询客户中心 |
| | | QueryWrapper<RsMenu> rsMenuQueryWrapper = new QueryWrapper<>(); |
| | | rsMenuQueryWrapper.eq("menu_tag", MenuBaseEnum.MENU_APP_2.getIndex()); |
| | | RsMenu khzxMenu = rsMenuService.getOne(rsMenuQueryWrapper); |
| | | // 给角色赋菜单权限 |
| | | List<RsRole> rsRoleList = rsRoleService.list(); |
| | | List<RsMenu> rsMenuList = rsMenuService.list(); |
| | | for (RsRole rsRole: rsRoleList){ |
| | | QueryWrapper<RsRolefun> rsRoleFunQueryWrapper = new QueryWrapper<>(); |
| | | rsRoleFunQueryWrapper.eq("role_id", rsRole.getId()); |
| | | mapper.delete(rsRoleFunQueryWrapper); |
| | | for (RsMenu rsMenu: rsMenuList){ |
| | | if (RoleBaseEnum.ROLE_4.getIndex().equals(rsRole.getId())){ |
| | | if (khzxMenu.getId().equals(rsMenu.getId()) || khzxMenu.getId().equals(rsMenu.getParentId())){ |
| | | continue; |
| | | } |
| | | } |
| | | RsRolefun rsRolefun = new RsRolefun(); |
| | | rsRolefun.setId(utilsClient.getNewTimeId()); |
| | | rsRolefun.setRoleId(rsRole.getId()); |
| | | rsRolefun.setMenuId(rsMenu.getId()); |
| | | mapper.insert(rsRolefun); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("[RsRoleFunService.webSetFun]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRoleFunService.webSetFun", e); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package cn.huge.module.rsoper.service; |
| | | |
| | | import cn.huge.base.common.exception.ServiceException; |
| | | import cn.huge.base.common.utils.DateUtils; |
| | | import cn.huge.base.common.utils.IdUtils; |
| | | import cn.huge.module.client.api.impl.UtilsClientImpl; |
| | | import cn.huge.module.ctrole.domain.bo.CtRoleBO; |
| | | import cn.huge.module.rsoper.dao.mapper.RsRoleMapper; |
| | | import cn.huge.module.rsoper.domain.dto.RoleMenuTreeDTO; |
| | | import cn.huge.module.rsoper.domain.dto.RsRoleDTO; |
| | | import cn.huge.module.rsoper.domain.po.RsRole; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageImpl; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @title: 系统角色定义表业务逻辑处理 |
| | | * @Description 系统角色定义表业务逻辑处理 |
| | | * @company hugeinfo |
| | | * @author liyj |
| | | * @Time 2024-09-10 10:57:02 |
| | | * @version 1.0.0 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class RsRoleService extends ServiceImpl<RsRoleMapper, RsRole>{ |
| | | |
| | | @Autowired |
| | | private RsRoleMapper mapper; |
| | | |
| | | @Autowired |
| | | private UtilsClientImpl utilsClient; |
| | | @Autowired |
| | | private RsRolefunService rsRolefunService; |
| | | |
| | | /** |
| | | * 更新对象 |
| | | * @param entity 对象 |
| | | */ |
| | | public void updateRsRole(RsRole entity){ |
| | | try{ |
| | | mapper.updateRsRole(entity); |
| | | }catch (Exception e){ |
| | | log.error("[RsRoleService.updateRsRole]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRoleService.updateRsRole", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件更新对象 |
| | | * @param entity 对象 |
| | | * @param terms 条件 |
| | | */ |
| | | public void updateRsRoleTerms(RsRole entity, Map<String, Object> terms){ |
| | | try{ |
| | | mapper.updateRsRoleTerms(entity, terms); |
| | | }catch (Exception e){ |
| | | log.error("[RsRoleService.updateRsRoleTerms]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRoleService.updateRsRoleTerms", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据编号物理删除 |
| | | * @param id 查询条件集合 |
| | | */ |
| | | public void deleteRsRole(String id){ |
| | | try{ |
| | | mapper.deleteRsRole(id); |
| | | }catch (Exception e){ |
| | | log.error("[RsRoleService.deleteRsRole]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRoleService.deleteRsRole", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按条件查询 |
| | | * @param terms 条件 |
| | | * @return List |
| | | */ |
| | | public List<RsRole> listTerms(Map<String, Object> terms){ |
| | | return mapper.listTerms(terms); |
| | | } |
| | | |
| | | /** |
| | | * 按条件统计 |
| | | * @param terms 条件 |
| | | * @return long |
| | | */ |
| | | public long countTerms(Map<String, Object> terms){ |
| | | return mapper.countTerms(terms); |
| | | } |
| | | |
| | | /** |
| | | * 按条件分页查询 |
| | | * @param page 分页对象 |
| | | * @param terms 条件 |
| | | * @return Page |
| | | */ |
| | | public Page<RsRole> pageQuery(PageRequest page, Map<String, Object> terms){ |
| | | long total = mapper.countTerms(terms); |
| | | List<RsRole> content = mapper.pageTerms(page, terms); |
| | | return new PageImpl<RsRole>(content, page, total); |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @param rsRole 实体对象 |
| | | */ |
| | | public void saveRsRole(RsRole rsRole){ |
| | | try{ |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | // 判断是否新增 |
| | | if (IdUtils.checkNewId(rsRole.getId())){ |
| | | rsRole.setId(utilsClient.getNewTimeId()); |
| | | rsRole.setCreateTime(nowDate); |
| | | } |
| | | rsRole.setUpdateTime(nowDate); |
| | | this.saveOrUpdate(rsRole); |
| | | }catch (Exception e){ |
| | | log.error("[RsRoleService.saveRsRole]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRoleService.saveRsRole", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取角色的菜单权限 |
| | | * @param roleId |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | public RsRoleDTO webGetRoleMenu(String roleId, String userId){ |
| | | try{ |
| | | // 查询角色权限树形结构 |
| | | List<RoleMenuTreeDTO> roleTrees = rsRolefunService.getRolefunTree(roleId); |
| | | // 封装角色权限信息 |
| | | RsRole rsRole = this.getById(roleId); |
| | | RsRoleDTO rsRoleDTO = new RsRoleDTO(); |
| | | BeanUtils.copyProperties(rsRole, rsRoleDTO); |
| | | rsRoleDTO.setRoleCode(rsRole.getId()); |
| | | rsRoleDTO.setRoleTreeBOS(roleTrees); |
| | | return rsRoleDTO; |
| | | }catch (Exception e){ |
| | | log.error("[RsRoleService.webGetRoleMenu]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("RsRoleService.webGetRoleMenu", e); |
| | | } |
| | | } |
| | | |
| | | } |