2024-01-15 朱宝民 优化获取角色列表接口
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaRole; |
| | | import com.dy.pipIrrGlobal.voBa.VoRole; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | int updateByPrimaryKey(BaRole record); |
| | | |
| | | /** |
| | | * 查询某个用户所隶属于的角色 |
| | | * @param userId 用户ID |
| | | * @return List<BaRole> |
| | | */ |
| | | List<BaRole> selectByUserId(@Param("userId") Long userId) ; |
| | | |
| | | /** |
| | | * 根据角色名称查询记录数量 |
| | | * @param roleName |
| | | * @return |
| | | */ |
| | | Integer getRecordCountByName(@Param("roleName") String roleName); |
| | | |
| | | /** |
| | | * 根据指定条件获取角色记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取角色记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoRole> getRoles(Map<?, ?> params); |
| | | ///** |
| | | // * 根据指定条件获取角色记录数 |
| | | // * @param params |
| | | // * @return |
| | | // */ |
| | | //Long getRecordCount(Map<?, ?> params); |
| | | // |
| | | ///** |
| | | // * 根据指定条件获取角色记录 |
| | | // * @param params |
| | | // * @return |
| | | // */ |
| | | //List<VoRole> getRoles(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据roleId逻辑删除角色对象 |
| | |
| | | package com.dy.pipIrrGlobal.daoBa; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoBa.BaRolePermissions; |
| | | import com.dy.pipIrrGlobal.voBa.VoRole; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | * @return |
| | | */ |
| | | int delPermissionsByRoleId(@Param("roleId") Long roleId); |
| | | |
| | | /** |
| | | * 根据指定条件获取角色记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取角色记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoRole> getRoles(Map<?, ?> params); |
| | | } |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "角色实体") |
| | | public class BaRole implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151511001L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private String name; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | * @Description |
| | | */ |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotBlank; |
| | |
| | | */ |
| | | @Schema(description = "权限列表", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank(message = "权限列表不能为空") |
| | | private String permissions; |
| | | @TableField(typeHandler = JacksonTypeHandler.class) |
| | | private JSONArray permissions; |
| | | } |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "控制器实体") |
| | | public class PrController implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151517001L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private Byte addways; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "分水房实体") |
| | | public class PrDivide implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151517002L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人编号不能为空") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人ID不能为空") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "流量监测站实体") |
| | | public class PrFlowMonitoring implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151517004L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人编号不能为空") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人ID不能为空") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "流量计实体") |
| | | public class PrFlowmeter implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151517003L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private Byte addways; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "取水口实体") |
| | | public class PrIntake implements BaseEntity { |
| | | public static final long serialVersionUID = 202312260931001L; |
| | | public static final long serialVersionUID = 202401151517005L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人编号不能为空") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人ID不能为空") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "取水口捆绑实体") |
| | | public class PrIntakeController implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151517006L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "监测站流量计关联实体") |
| | | public class PrMonitoringFlowmeter implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151517007L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "开卡/补卡实体") |
| | | public class SeActiveCard implements BaseEntity { |
| | | public static final long serialVersionUID = 202312071927001L; |
| | | public static final long serialVersionUID = 202401151518001L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "水卡注销实体") |
| | | public class SeCancel implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151518002L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "农户实体") |
| | | public class SeClient implements BaseEntity { |
| | | public static final long serialVersionUID = 202311141539001L; |
| | | public static final long serialVersionUID = 202401151518003L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人编号不能为空") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotNull(message = "操作人ID不能为空") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "农户水卡实体") |
| | | public class SeClientCard implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151518004L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | @Schema(name = "挂失实体") |
| | | |
| | | public class SeLoss implements BaseEntity { |
| | | public static final long serialVersionUID = 20231191728001L; |
| | | public static final long serialVersionUID = 202401151518005L; |
| | | /** |
| | | * 主键 |
| | | */ |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "付款方式实体") |
| | | public class SePaymentMethod implements BaseEntity { |
| | | public static final long serialVersionUID = 20231191728001L; |
| | | public static final long serialVersionUID = 202401151518006L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | @Schema(name = "水卡充值实体") |
| | | public class SeRecharge implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 20231191728001L; |
| | | public static final long serialVersionUID = 202401151519001L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "水卡充值历史实体") |
| | | public class SeRechargeHistory implements BaseEntity { |
| | | public static final long serialVersionUID = 202312080812001L; |
| | | public static final long serialVersionUID = 202401151519002L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "水卡冲正实体") |
| | | public class SeReversal implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151519003L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "水卡解锁实体") |
| | | public class SeUnlock implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151519004L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | * 操作人ID |
| | | */ |
| | | @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人编号必须为大于0的整数") |
| | | @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "操作人ID必须为大于0的整数") |
| | | private Long operator; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | @Schema(name = "电子钱包表实体") |
| | | public class SeWallet implements BaseEntity { |
| | | public static final long serialVersionUID = 1L; |
| | | public static final long serialVersionUID = 202401151519005L; |
| | | |
| | | /** |
| | | * 主键 |
| | |
| | | */ |
| | | private String remarks; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getWalletid() { |
| | | return walletid; |
| | | } |
| | | |
| | | public void setWalletid(Long walletid) { |
| | | this.walletid = walletid; |
| | | } |
| | | |
| | | public Long getClientid() { |
| | | return clientid; |
| | | } |
| | | |
| | | public void setClientid(Long clientid) { |
| | | this.clientid = clientid; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Double getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(Double amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public Double getAfterrecharge() { |
| | | return afterrecharge; |
| | | } |
| | | |
| | | public void setAfterrecharge(Double afterrecharge) { |
| | | this.afterrecharge = afterrecharge; |
| | | } |
| | | |
| | | public Date getRechargedt() { |
| | | return rechargedt; |
| | | } |
| | | |
| | | public void setRechargedt(Date rechargedt) { |
| | | this.rechargedt = rechargedt; |
| | | } |
| | | |
| | | public String getRemarks() { |
| | | return remarks; |
| | | } |
| | | |
| | | public void setRemarks(String remarks) { |
| | | this.remarks = remarks; |
| | | } |
| | | } |
| | |
| | | * 备注信息 |
| | | */ |
| | | private String remarks; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getWalletid() { |
| | | return walletid; |
| | | } |
| | | |
| | | public void setWalletid(Long walletid) { |
| | | this.walletid = walletid; |
| | | } |
| | | |
| | | public Long getClientid() { |
| | | return clientid; |
| | | } |
| | | |
| | | public void setClientid(Long clientid) { |
| | | this.clientid = clientid; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Double getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(Double amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public Double getAfterrecharge() { |
| | | return afterrecharge; |
| | | } |
| | | |
| | | public void setAfterrecharge(Double afterrecharge) { |
| | | this.afterrecharge = afterrecharge; |
| | | } |
| | | |
| | | public Date getRechargedt() { |
| | | return rechargedt; |
| | | } |
| | | |
| | | public void setRechargedt(Date rechargedt) { |
| | | this.rechargedt = rechargedt; |
| | | } |
| | | |
| | | public String getRemarks() { |
| | | return remarks; |
| | | } |
| | | |
| | | public void setRemarks(String remarks) { |
| | | this.remarks = remarks; |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.voBa; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | public class VoRole implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "ID") |
| | | private Long id; |
| | | |
| | | @Schema(title = "角色编号") |
| | | private Long roleId; |
| | | private String roleId; |
| | | |
| | | @Schema(title = "角色名称") |
| | | private String roleName; |
| | | |
| | | @Schema(title = "权限ID") |
| | | private Long perId; |
| | | |
| | | @Schema(title = "权限列表") |
| | | private String permissions; |
| | | private JSONArray permissions; |
| | | |
| | | @Schema(title = "操作人") |
| | | private String operator; |
| | |
| | | lazy-load-trigger-methods: "" # 阻挡不相干的操作触发,实现懒加载 |
| | | cache-enabled: true #打开全局缓存开关(二级环境),默认值是true |
| | | default-enum-type-handler: com.dy.common.mybatis.envm.EnumCodeTypeHandler |
| | | type-handlers-package: com.dy.pipIrrGlobal.pojoBa.MySqlJsonHandler |
| | | |
| | | pipIrr: |
| | | global: |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dy.pipIrrGlobal.daoBa.BaRoleMapper"> |
| | | <!-- <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaRole">--> |
| | | <!-- <!–@mbg.generated–>--> |
| | | <!-- <!–@Table ba_role–>--> |
| | | <!-- <id column="id" jdbcType="BIGINT" property="id" />--> |
| | | <!-- <result column="name" jdbcType="VARCHAR" property="name" />--> |
| | | <!-- <result column="operator" jdbcType="BIGINT" property="operator" />--> |
| | | <!-- <result column="operate_dt" jdbcType="TIMESTAMP" property="operateDt" />--> |
| | | <!-- <result column="deleted" jdbcType="TINYINT" property="deleted" />--> |
| | | <!-- </resultMap>--> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaRole"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ba_role--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operate_dt" jdbcType="TIMESTAMP" property="operateDt" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | <result property="deleted" column="deleted" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" javaType="com.dy.common.mybatis.envm.Deleted"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="partResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaRole"> |
| | | <result column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operate_dt" jdbcType="TIMESTAMP" property="operateDt" /> |
| | | </resultMap> |
| | | |
| | | <!-- <resultMap id="someResultMap" extends="partResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaRole">--> |
| | | <!-- <collection property="priviList" fetchType="eager" column="{roleId=id}" select="com.dy.pipIrrGlobal.daoBa.BaPrivilegeMapper.selectPrivilegeByRoleId" />--> |
| | | <!-- </resultMap>--> |
| | | |
| | | <sql id="part_Column_List"> |
| | | id, name, operator, operate_dt, deleted |
| | | </sql> |
| | | |
| | | <select id="selectByUserId" resultMap="partResultMap"> |
| | | select <include refid="part_Column_List" /> |
| | | from ba_role r |
| | | inner join ba_user_role ur on r.id = ur.roleId |
| | | where r.deleted != 1 |
| | | <if test="userId != null"> |
| | | and ur.userId = #{userId,jdbcType=BIGINT} |
| | | </if> |
| | | </select> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, `name`, `operator`, operate_dt, deleted |
| | |
| | | from ba_role |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from ba_role |
| | |
| | | WHERE name = #{roleName} |
| | | </select> |
| | | |
| | | <!--根据指定条件获取角色记录数--> |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM ba_role role |
| | | LEFT JOIN ba_role_permissions per ON per.roleId = role.id |
| | | <where> |
| | | AND role.deleted = 0 |
| | | <!-- <!–根据指定条件获取角色记录数–>--> |
| | | <!-- <select id="getRecordCount" resultType="java.lang.Long">--> |
| | | <!-- SELECT--> |
| | | <!-- COUNT(*) AS recordCount--> |
| | | <!-- FROM ba_role role--> |
| | | <!-- LEFT JOIN ba_role_permissions per ON per.roleId = role.id--> |
| | | <!-- <where>--> |
| | | <!-- AND role.deleted = 0--> |
| | | |
| | | <if test = "roleId != null and roleId > 0"> |
| | | AND role.id = ${roleId} |
| | | </if> |
| | | <!-- <if test = "roleId != null and roleId > 0">--> |
| | | <!-- AND role.id = ${roleId}--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "roleName != null and roleName !=''"> |
| | | AND role.name LIKE CONCAT('%',#{roleName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <!-- <if test = "roleName != null and roleName !=''">--> |
| | | <!-- AND role.name LIKE CONCAT('%',#{roleName},'%')--> |
| | | <!-- </if>--> |
| | | <!-- </where>--> |
| | | <!-- </select>--> |
| | | |
| | | <!--根据指定条件获取角色记录--> |
| | | <select id="getRoles" resultType="com.dy.pipIrrGlobal.voBa.VoRole"> |
| | | SELECT |
| | | (@i:=@i+1) AS id, |
| | | t.* FROM |
| | | ( |
| | | SELECT |
| | | role.id AS roleId, |
| | | role.name AS roleName, |
| | | per.permissions, |
| | | (SELECT `name` FROM ba_user WHERE id = role.operator) AS operator, |
| | | role.operate_dt AS operateDt |
| | | FROM ba_role role |
| | | LEFT JOIN ba_role_permissions per ON per.roleId = role.id |
| | | <where> |
| | | AND role.deleted = 0 |
| | | <!-- <!–根据指定条件获取角色记录–>--> |
| | | <!-- <select id="getRoles" resultType="com.dy.pipIrrGlobal.voBa.VoRole">--> |
| | | <!-- SELECT--> |
| | | <!-- (@i:=@i+1) AS id,--> |
| | | <!-- t.* FROM--> |
| | | <!-- (--> |
| | | <!-- SELECT--> |
| | | <!-- role.id AS roleId,--> |
| | | <!-- role.name AS roleName,--> |
| | | <!-- per.permissions,--> |
| | | <!-- (SELECT `name` FROM ba_user WHERE id = role.operator) AS operator,--> |
| | | <!-- role.operate_dt AS operateDt--> |
| | | <!-- FROM ba_role role--> |
| | | <!-- LEFT JOIN ba_role_permissions per ON per.roleId = role.id--> |
| | | <!-- <where>--> |
| | | <!-- AND role.deleted = 0--> |
| | | |
| | | <if test = "roleId != null and roleId > 0"> |
| | | AND role.id = ${roleId} |
| | | </if> |
| | | <!-- <if test = "roleId != null and roleId > 0">--> |
| | | <!-- AND role.id = ${roleId}--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "roleName != null and roleName !=''"> |
| | | AND role.name LIKE CONCAT('%',#{roleName},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY role.operate_dt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | ) t |
| | | , (SELECT @i:=0) AS itable |
| | | </select> |
| | | <!-- <if test = "roleName != null and roleName !=''">--> |
| | | <!-- AND role.name LIKE CONCAT('%',#{roleName},'%')--> |
| | | <!-- </if>--> |
| | | <!-- </where>--> |
| | | <!-- ORDER BY role.operate_dt DESC--> |
| | | <!-- <if test="pageCurr != null and pageSize != null">--> |
| | | <!-- LIMIT ${pageCurr}, ${pageSize}--> |
| | | <!-- </if>--> |
| | | <!-- ) t--> |
| | | <!-- , (SELECT @i:=0) AS itable--> |
| | | <!-- </select>--> |
| | | |
| | | <!--根据roleId逻辑删除角色对象--> |
| | | <update id="deleteRoleById"> |
| | |
| | | <!--@Table ba_role_permissions--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="roleId" jdbcType="BIGINT" property="roleid" /> |
| | | <result column="permissions" jdbcType="VARCHAR" property="permissions" /> |
| | | <!-- <result column="permissions" jdbcType="VARCHAR" property="permissions" />--> |
| | | <result column="permissions" property="permissions" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, roleId, permissions |
| | | </sql> |
| | | |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | |
| | | <!--@mbg.generated--> |
| | | insert into ba_role_permissions (id, roleId, permissions |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{roleid,jdbcType=BIGINT}, #{permissions,jdbcType=VARCHAR} |
| | | values (#{id,jdbcType=BIGINT}, #{roleid,jdbcType=BIGINT}, #{permissions,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler} |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | #{roleid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="permissions != null"> |
| | | #{permissions,jdbcType=VARCHAR}, |
| | | #{permissions,jdbcType=JAVA_OBJECT,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | |
| | | roleId = #{roleid,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="permissions != null"> |
| | | permissions = #{permissions,jdbcType=VARCHAR}, |
| | | permissions = #{permissions,jdbcType=JAVA_OBJECT,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | |
| | | <!--@mbg.generated--> |
| | | update ba_role_permissions |
| | | set roleId = #{roleid,jdbcType=BIGINT}, |
| | | permissions = #{permissions,jdbcType=VARCHAR} |
| | | permissions = #{permissions,jdbcType=JAVA_OBJECT,typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据指定条件获取角色记录数--> |
| | | <select id="getRecordCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM ba_role role |
| | | LEFT JOIN ba_role_permissions per ON per.roleId = role.id |
| | | <where> |
| | | AND role.deleted = 0 |
| | | |
| | | <if test = "roleId != null and roleId > 0"> |
| | | AND role.id = ${roleId} |
| | | </if> |
| | | |
| | | <if test = "roleName != null and roleName !=''"> |
| | | AND role.name LIKE CONCAT('%',#{roleName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取角色记录--> |
| | | <select id="getRoles" resultType="com.dy.pipIrrGlobal.voBa.VoRole"> |
| | | SELECT |
| | | |
| | | CAST(role.id AS char) AS roleId, |
| | | role.name AS roleName, |
| | | per.id AS perId, |
| | | (SELECT `name` FROM ba_user WHERE id = role.operator) AS operator, |
| | | role.operate_dt AS operateDt |
| | | FROM ba_role role |
| | | LEFT JOIN ba_role_permissions per ON per.roleId = role.id |
| | | <where> |
| | | AND role.deleted = 0 |
| | | |
| | | <if test = "roleId != null and roleId > 0"> |
| | | AND role.id = ${roleId} |
| | | </if> |
| | | |
| | | <if test = "roleName != null and roleName !=''"> |
| | | AND role.name LIKE CONCAT('%',#{roleName},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY role.operate_dt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | package com.dy.pipIrrBase.role; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mybatis.envm.Deleted; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoRole>>> getRoles(QueryVo vo){ |
| | | try { |
| | | //BaRolePermissions baRolePermissions = roleSv.getRolePermissionsById(2023122018334500002L); |
| | | //return BaseResponseUtils.buildSuccess(baRolePermissions); |
| | | |
| | | QueryResultVo<List<VoRole>> res = roleSv.getRoles(vo); |
| | | if(res.itemTotal != null && res.itemTotal > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | }else { |
| | | return BaseResponseUtils.buildFail(SystemResultCode.NO_ROLES.getMessage()); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("获取开卡记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | |
| | | // 添加权限列表 |
| | | BaRolePermissions baRolePermissions = new BaRolePermissions(); |
| | | baRolePermissions.setRoleid(roleId); |
| | | baRolePermissions.setPermissions(permissions); |
| | | baRolePermissions.setPermissions(new JSONArray(permissions)); |
| | | Integer rc = Optional.ofNullable(roleSv.addPermissions(baRolePermissions)).orElse(0); |
| | | if(rc <= 0) { |
| | | return BaseResponseUtils.buildFail(SystemResultCode.ADD_ROLE_FAIL.getMessage()); |
| | |
| | | |
| | | BaRolePermissions baRolePermissions = new BaRolePermissions(); |
| | | baRolePermissions.setRoleid(roleId); |
| | | baRolePermissions.setPermissions(permissions); |
| | | baRolePermissions.setPermissions(new JSONArray(permissions)); |
| | | roleSv.addPermissions(baRolePermissions); |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | |
| | | // 修改角色授权 |
| | | BaRolePermissions baRolePermissions = new BaRolePermissions(); |
| | | baRolePermissions.setRoleid(roleId); |
| | | baRolePermissions.setPermissions(permissions); |
| | | baRolePermissions.setPermissions(new JSONArray(permissions)); |
| | | roleSv.delPermissionsByRoleId(roleId); |
| | | roleSv.addPermissions(baRolePermissions); |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | |
| | | package com.dy.pipIrrBase.role; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoBa.BaRoleMapper; |
| | | import com.dy.pipIrrGlobal.daoBa.BaRolePermissionsMapper; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | public QueryResultVo<List<VoRole>> getRoles(QueryVo queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = baRoleMapper.getRecordCount(params); |
| | | Long itemTotal = baRolePermissionsMapper.getRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoRole>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = baRoleMapper.getRoles(params); |
| | | //rsVo.obj = baRoleMapper.getRoles(params); |
| | | |
| | | /** |
| | | * 获取角色列表,把汗角色权限ID |
| | | * 遍历角色列表并取出角色对象中的perId |
| | | * 根据perId获取权限对象,并将对象添加到角色对象中 |
| | | */ |
| | | List<VoRole> list_Roles = Optional.ofNullable(baRolePermissionsMapper.getRoles(params)).orElse(new ArrayList<>()); |
| | | if(list_Roles.size() > 0) { |
| | | for(int i = 0; i < list_Roles.size(); i++) { |
| | | VoRole voRole = list_Roles.get(i); |
| | | Long perId = voRole.getPerId(); |
| | | BaRolePermissions baRolePermissions = baRolePermissionsMapper.selectByPrimaryKey(perId); |
| | | JSONArray array_permission = JSONArray.parseArray("[]"); |
| | | if(baRolePermissions != null) { |
| | | array_permission = baRolePermissions.getPermissions(); |
| | | } |
| | | voRole.setPermissions(array_permission); |
| | | } |
| | | } |
| | | rsVo.obj = list_Roles; |
| | | return rsVo ; |
| | | } |
| | | |
| | | public BaRolePermissions getRolePermissionsById(Long id) { |
| | | return baRolePermissionsMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | /** |
| | | * 得到所有角色 |
| | | * @return 所有角色集合 |