wuzeyu
2024-01-15 835ac4c14a2ae8d17578e2b7bbbaa54d5a12f40a
Merge remote-tracking branch 'origin/master'
44个文件已修改
2个文件已添加
1542 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRoleMapper.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRolePermissionsMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserRoleMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRole.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRolePermissions.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrDivide.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowMonitoring.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrIntake.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrIntakeController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrMonitoringFlowmeter.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeActiveCard.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeCancel.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeClient.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeClientCard.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeLoss.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SePaymentMethod.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeRecharge.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeRechargeHistory.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeReversal.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeUnlock.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWallet.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRecharge.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRechargeHistory.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voBa/VoRole.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voBa/VoUserInfo.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoDivide.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRoleMapper.xml 186 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRolePermissionsMapper.xml 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserRoleMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrDivideMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/result/SystemResultCode.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/DtoRole.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/QueryVo.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleCtrl.java 370 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java 219 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRoleMapper.java
@@ -6,16 +6,27 @@
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
 * @author ZhuBaoMin
 * @date 2024-01-10 11:00
 * @LastEditTime 2024-01-10 11:00
 * @Description
 */
@Mapper
public interface BaRoleMapper extends BaseMapper<BaRole> {
    int deleteByPrimaryKey(Long id);
    /**
     * 查询全部
     * @return List<BaRole>
     */
    List<BaRole> selectAll() ;
    int insert(BaRole record);
    int insertSelective(BaRole record);
    BaRole selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(BaRole record);
    int updateByPrimaryKey(BaRole record);
    /**
     * 查询某个用户所隶属于的角色
@@ -24,61 +35,31 @@
     */
    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 总数
     * 根据roleId逻辑删除角色对象
     * @param roleId
     * @return
     */
    Long selectTotal(Map<?, ?> params) ;
    /**
     * 分页查询一些
     * @param params 查询条件
     * @return 实体集合
     */
    List<BaRole> selectSome(Map<?, ?> params) ;
    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int putin(BaRole record);
    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(BaRole record);
    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(BaRole record);
    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(BaRole record);
    /**
     * delete by primary key
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Long id);
    /**
     * 逻辑删除
     * @param id primaryKey
     * @return update count
     */
    int deleteLogicById(Long id);
    Integer deleteRoleById(@Param("roleId") Long roleId);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRolePermissionsMapper.java
@@ -1,7 +1,11 @@
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
@@ -27,4 +31,18 @@
     * @return
     */
    int delPermissionsByRoleId(@Param("roleId") Long roleId);
    /**
     * 根据指定条件获取角色记录数
     * @param params
     * @return
     */
    Long getRecordCount(Map<?, ?> params);
    /**
     * 根据指定条件获取角色记录
     * @param params
     * @return
     */
    List<VoRole> getRoles(Map<?, ?> params);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java
@@ -91,6 +91,14 @@
     * 根据用户编号获取用户信息
     * @param userId 用户编号
     * @return 用户信息列表
     * 2024-01-09 废弃
     */
    List<VoUserInfo> getUserInfos(@Param("userId") Long userId);
    /**
     * 根据用户编号获取用户信息
     * @param userId
     * @return
     */
    Map getUserInfoById(@Param("userId") Long userId);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserRoleMapper.java
@@ -5,6 +5,9 @@
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface BaUserRoleMapper extends BaseMapper<BaUserRole> {
@@ -43,4 +46,11 @@
     * @return deleteCount
     */
    int deleteByRoleId(@Param("roleId") Long roleId);
    /**
     * 根据用户编号获取权限列表
     * @param userId
     * @return
     */
    List<Map<String, Object>> getPermissionsByUserId(@Param("userId") Long userId);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRole.java
@@ -1,24 +1,26 @@
package com.dy.pipIrrGlobal.pojoBa;
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.dy.common.mybatis.envm.Deleted;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import java.util.List;
import java.util.Date;
/**
 * 角色实体
 * @author ZhuBaoMin
 * @date 2024-01-10 11:00
 * @LastEditTime 2024-01-10 11:00
 * @Description
 */
@TableName(value="ba_role", autoResultMap = true)
@Data
@Builder
@@ -27,33 +29,40 @@
@AllArgsConstructor
@Schema(name = "角色实体")
public class BaRole implements BaseEntity {
    public static final long serialVersionUID = 202401151511001L;
    public static final long serialVersionUID = 202310211546001L;
    /**
    * 主键
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public Long id ;
    private Long id;
    /**
     * 角色名称
     */
    * 角色名称
    */
    @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "名称不能为空") //不能为空也不能为null
    @Length(message = "名称不大于{max}字,不小于{min}字", min = 2, max = 25)
    public String name ;
    @NotBlank(message = "名称不能为空")
    private String name;
    /**
     * 是否删除: 0表示未删除  1表示删除.
     */
    * 操作人ID
    */
    @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Positive(message = "操作人ID必须为大于0的整数")
    private Long operator;
    /**
    * 操作时间
    */
    @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date operateDt;
    /**
    * 逻辑删除标识;0-未删除,1-删除
    */
    @Schema(description = "删除标识,表单不用填写", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    public Deleted deleted;
    /**
     * 角色所拥有的权限
     */
    @TableField(exist = false)
    public List<BaPrivilege> priviList ;
    private Byte deleted;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRolePermissions.java
@@ -7,11 +7,14 @@
 * @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;
@@ -60,5 +63,6 @@
    */
    @Schema(description = "权限列表", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotBlank(message = "权限列表不能为空")
    private String permissions;
    @TableField(typeHandler = JacksonTypeHandler.class)
    private JSONArray permissions;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrController.java
@@ -32,7 +32,7 @@
@AllArgsConstructor
@Schema(name = "控制器实体")
public class PrController implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151517001L;
    /**
     * 主键
@@ -77,9 +77,9 @@
    private Byte addways;
    /**
     * 操作人编号
     * 操作人ID
     */
    @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long operator;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrDivide.java
@@ -33,7 +33,7 @@
@AllArgsConstructor
@Schema(name = "分水房实体")
public class PrDivide implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151517002L;
    /**
     * 主键
     */
@@ -129,10 +129,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowMonitoring.java
@@ -29,7 +29,7 @@
@AllArgsConstructor
@Schema(name = "流量监测站实体")
public class PrFlowMonitoring implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151517004L;
    /**
    * 主键
@@ -91,10 +91,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java
@@ -28,7 +28,7 @@
@AllArgsConstructor
@Schema(name = "流量计实体")
public class PrFlowmeter implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151517003L;
    /**
    * 主键
@@ -73,9 +73,9 @@
    private Byte addways;
    /**
    * 操作人编号
    * 操作人ID
    */
    @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Schema(description = "操作人ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long operator;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrIntake.java
@@ -26,7 +26,7 @@
@AllArgsConstructor
@Schema(name = "取水口实体")
public class PrIntake implements BaseEntity {
    public static final long serialVersionUID = 202312260931001L;
    public static final long serialVersionUID = 202401151517005L;
    /**
     * 主键
     */
@@ -105,10 +105,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrIntakeController.java
@@ -35,7 +35,7 @@
@AllArgsConstructor
@Schema(name = "取水口捆绑实体")
public class PrIntakeController implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151517006L;
    /**
    * 主键
@@ -77,10 +77,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrMonitoringFlowmeter.java
@@ -31,7 +31,7 @@
@AllArgsConstructor
@Schema(name = "监测站流量计关联实体")
public class PrMonitoringFlowmeter implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151517007L;
    /**
    * 主键
@@ -73,10 +73,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeActiveCard.java
@@ -32,7 +32,7 @@
@AllArgsConstructor
@Schema(name = "开卡/补卡实体")
public class SeActiveCard implements BaseEntity {
    public static final long serialVersionUID = 202312071927001L;
    public static final long serialVersionUID = 202401151518001L;
    /**
     * 主键
@@ -107,10 +107,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeCancel.java
@@ -33,7 +33,7 @@
@AllArgsConstructor
@Schema(name = "水卡注销实体")
public class SeCancel implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151518002L;
    /**
     * 主键
     */
@@ -79,10 +79,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeClient.java
@@ -30,7 +30,7 @@
@AllArgsConstructor
@Schema(name = "农户实体")
public class SeClient implements BaseEntity {
    public static final long serialVersionUID = 202311141539001L;
    public static final long serialVersionUID = 202401151518003L;
    /**
     * 主键
@@ -161,10 +161,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeClientCard.java
@@ -34,7 +34,7 @@
@AllArgsConstructor
@Schema(name = "农户水卡实体")
public class SeClientCard implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151518004L;
    /**
     * 主键
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeLoss.java
@@ -33,7 +33,7 @@
@Schema(name = "挂失实体")
public class SeLoss implements BaseEntity {
    public static final long serialVersionUID = 20231191728001L;
    public static final long serialVersionUID = 202401151518005L;
    /**
     * 主键
     */
@@ -79,10 +79,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SePaymentMethod.java
@@ -30,7 +30,7 @@
@AllArgsConstructor
@Schema(name = "付款方式实体")
public class SePaymentMethod implements BaseEntity {
    public static final long serialVersionUID = 20231191728001L;
    public static final long serialVersionUID = 202401151518006L;
    /**
    * 主键
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeRecharge.java
@@ -27,7 +27,7 @@
@Schema(name = "水卡充值实体")
public class SeRecharge implements BaseEntity {
    public static final long serialVersionUID = 20231191728001L;
    public static final long serialVersionUID = 202401151519001L;
    /**
     * 主键
@@ -107,10 +107,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeRechargeHistory.java
@@ -33,7 +33,7 @@
@AllArgsConstructor
@Schema(name = "水卡充值历史实体")
public class SeRechargeHistory implements BaseEntity {
    public static final long serialVersionUID = 202312080812001L;
    public static final long serialVersionUID = 202401151519002L;
    /**
     * 主键
@@ -113,10 +113,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeReversal.java
@@ -33,7 +33,7 @@
@AllArgsConstructor
@Schema(name = "水卡冲正实体")
public class SeReversal implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151519003L;
    /**
     * 主键
@@ -80,10 +80,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeUnlock.java
@@ -33,7 +33,7 @@
@AllArgsConstructor
@Schema(name = "水卡解锁实体")
public class SeUnlock implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151519004L;
    /**
     * 主键
@@ -73,10 +73,10 @@
    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;
    /**
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWallet.java
@@ -32,7 +32,7 @@
@AllArgsConstructor
@Schema(name = "电子钱包表实体")
public class SeWallet implements BaseEntity {
    public static final long serialVersionUID = 1L;
    public static final long serialVersionUID = 202401151519005L;
    /**
    * 主键
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRecharge.java
@@ -52,67 +52,4 @@
    */
    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;
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeWalletRechargeHistory.java
@@ -51,68 +51,4 @@
    * 备注信息
    */
    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;
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voBa/VoRole.java
New file
@@ -0,0 +1,43 @@
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;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-01-10 15:13
 * @LastEditTime 2024-01-10 15:13
 * @Description
 */
@Data
@Schema(title = "角色信息视图对象")
public class VoRole implements BaseEntity {
    private static final long serialVersionUID = 1L;
    @Schema(title = "角色编号")
    private String roleId;
    @Schema(title = "角色名称")
    private String roleName;
    @Schema(title = "权限ID")
    private Long perId;
    @Schema(title = "权限列表")
    private JSONArray permissions;
    @Schema(title = "操作人")
    private String operator;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(title = "操作时间")
    private Date operateDt;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voBa/VoUserInfo.java
@@ -4,6 +4,9 @@
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
 * @author ZhuBaoMin
 * @date 2023/12/20 10:19
@@ -22,12 +25,13 @@
    @Schema(title = "用户姓名")
    private String userName;
    @Schema(title = "角色ID")
    private Long roleId;
    @Schema(title = "角色编号列表")
    private List<Map<String, Object>> roleIds;
    @Schema(title = "角色名称")
    private String roleName;
    @Schema(title = "角色名称列表")
    private List<Map<String, Object>> roleNames;
    @Schema(title = "授权列表")
    private String permissions;
}
    @Schema(title = "权限列表")
    private List<Map<String, Object>> permissions;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoDivide.java
@@ -28,6 +28,11 @@
    @ColumnWidth(10)
    private Long id;
    @Schema(title = "分水房编号")
    @ExcelProperty("分水房编号")
    @ColumnWidth(15)
    private String divideId;
    @Schema(title = "分水房名称")
    @ExcelProperty("分水房名称")
    @ColumnWidth(15)
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
@@ -68,6 +68,7 @@
        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:
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml
@@ -50,7 +50,7 @@
          phone = '#{phone,jdbcType=VARCHAR}' and
        </if>
        <if test="area != null">
          area = #{area,jdbcType=INTEGER} and
          area = ${area} and
        </if>
      </trim>
  </select>
@@ -70,7 +70,7 @@
        phone = '#{phone,jdbcType=VARCHAR}' and
      </if>
      <if test="area != null">
        area = #{area,jdbcType=INTEGER} and
        area = ${area} and
      </if>
    </trim>
    order by id DESC
@@ -169,10 +169,10 @@
        color = #{color,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        color = #{remark,jdbcType=VARCHAR},
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        color = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
        deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRoleMapper.xml
@@ -1,36 +1,38 @@
<?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">-->
<!--    &lt;!&ndash;@mbg.generated&ndash;&gt;-->
<!--    &lt;!&ndash;@Table ba_role&ndash;&gt;-->
<!--    <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">
    <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 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="Base_Column_List">
    id, name, deleted
  </sql>
<!--  <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
    id, name, operator, operate_dt, deleted
  </sql>
  <select id="selectAll" resultMap="BaseResultMap">
    select
    <include refid="part_Column_List" />
    from ba_role
    where deleted!=1
  </select>
  <select id="selectByUserId" resultMap="partResultMap">
    select <include refid="part_Column_List" />
@@ -42,43 +44,34 @@
    </if>
  </select>
  <select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long">
    select
    count(*)
    from ba_role where deleted!=1
    <trim prefix="and" suffixOverrides="and">
      <if test="name != null and name != ''">
        name like concat('%', #{name}, '%')
      </if>
    </trim>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, `name`, `operator`, operate_dt, deleted
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from ba_role
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectSome" parameterType="java.util.Map" resultMap="someResultMap">
    select
    <include refid="part_Column_List" />
    from ba_role where deleted!=1
    <trim prefix="and" suffixOverrides="and">
      <if test="name != null and name != ''">
        name like concat('%', #{name}, '%')
      </if>
    </trim>
    order by id DESC
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ba_role
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRole">
    insert into ba_role (<include refid="Base_Column_List" />)
    values (#{id,jdbcType=BIGINT},
            #{name,jdbcType=VARCHAR},
            #{deleted, typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}
      )
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    insert into ba_role (id, `name`, `operator`,
      operate_dt, deleted)
    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT},
      #{operateDt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    insert into ba_role
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
@@ -86,6 +79,12 @@
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="operator != null">
        `operator`,
      </if>
      <if test="operateDt != null">
        operate_dt,
      </if>
      <if test="deleted != null">
        deleted,
@@ -98,41 +97,108 @@
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="operator != null">
        #{operator,jdbcType=BIGINT},
      </if>
      <if test="operateDt != null">
        #{operateDt,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
        #{deleted,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    update ba_role
    <set>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="operator != null">
        `operator` = #{operator,jdbcType=BIGINT},
      </if>
      <if test="operateDt != null">
        operate_dt = #{operateDt,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
        deleted = #{deleted,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    update ba_role
    set `name` = #{name,jdbcType=VARCHAR},
     deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}
      `operator` = #{operator,jdbcType=BIGINT},
      operate_dt = #{operateDt,jdbcType=TIMESTAMP},
      deleted = #{deleted,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据角色名称查询记录数量,添加角色时判断是否重名-->
  <select id="getRecordCountByName" resultType="java.lang.Integer">
    SELECT
        COUNT(*) AS recordCount
    FROM ba_role
    WHERE name = #{roleName}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from ba_role
    where id = #{id,jdbcType=BIGINT}
  </delete>
<!--  &lt;!&ndash;根据指定条件获取角色记录数&ndash;&gt;-->
<!--  <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-->
  <delete id="deleteLogicById" parameterType="java.lang.Long">
    update ba_role set deleted = 1
    where id = #{id,jdbcType=BIGINT}
  </delete>
<!--      <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>-->
<!--  &lt;!&ndash;根据指定条件获取角色记录&ndash;&gt;-->
<!--  <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 = "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">
    UPDATE ba_role SET deleted = 1 WHERE id = ${roleId}
  </update>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRolePermissionsMapper.xml
@@ -6,12 +6,14 @@
    <!--@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 
@@ -34,9 +36,10 @@
    <!--@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>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRolePermissions">
    <!--@mbg.generated-->
    insert into ba_role_permissions
@@ -59,7 +62,7 @@
        #{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>
@@ -71,7 +74,7 @@
        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}
@@ -80,7 +83,54 @@
    <!--@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>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
@@ -223,6 +223,7 @@
    </delete>
    <!--根据用户编号获取用户信息-->
    <!--2024-01-09 废弃-->
    <select id="getUserInfos" resultType="com.dy.pipIrrGlobal.voBa.VoUserInfo">
        SELECT
            user.id AS userId,
@@ -240,4 +241,19 @@
            </if>
        </where>
    </select>
    <!--根据用户编号获取用户信息-->
    <select id="getUserInfoById" resultType="java.util.Map">
        SELECT
            id AS userId,
            name AS userName
        FROM ba_user
        <where>
            AND disabled = 0
            AND deleted = 0
            <if test = "userId != null and userId > 0">
                AND ba_user.id = ${userId}
            </if>
        </where>
    </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserRoleMapper.xml
@@ -60,4 +60,17 @@
    where userId = #{roleId,jdbcType=BIGINT}
  </delete>
  <!--根据用户编号获取权限列表-->
  <select id="getPermissionsByUserId" resultType="java.util.Map">
    SELECT
      rol.id AS roleId,
      rol.`name` AS roleName,
      per.permissions
    FROM ba_user_role use_rol
           INNER JOIN ba_role rol ON rol.id = use_rol.roleId
           INNER JOIN ba_role_permissions per ON per.roleId = rol.id
    WHERE use_rol.userId = ${userId}
  </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrDivideMapper.xml
@@ -259,6 +259,7 @@
  <select id="getDivides" resultType="com.dy.pipIrrGlobal.voPr.VoDivide">
    SELECT
      (@i:=@i+1) AS id,
      CAST(divi.id AS char) AS divideId,
      divi.name AS divideName,
      blo.`name` AS blockName,
      divi.header,
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java
@@ -99,7 +99,8 @@
                            schema = @Schema(implementation = BaBlock.class))}
            )
    })
    @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE)
    //@GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE)
    @GetMapping(path = "one")
    @SsoAop()
    public BaseResponse<BaBlock> one(Long id){
        return BaseResponseUtils.buildSuccess(this.sv.selectById(id));
@@ -192,7 +193,8 @@
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
    //@GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
    @GetMapping(path = "delete")
    @SsoAop()
    public BaseResponse<Boolean> delete(Long id){
        if(id == null){
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/result/SystemResultCode.java
@@ -16,7 +16,12 @@
    /**
     * 角色
     */
    PERMISSION_ERROR(10001, "授权错误");
    PERMISSION_ERROR(10001, "授权错误"),
    ADD_ROLE_FAIL(10002, "角色添加失败"),
    ROLE_NAME_EXIST(10003, "角色名称已存在"),
    NO_ROLES(10004, "没有符合条件的角色记录"),
    PLEASE_INPUT_ROLE_ID(10005, "角色编号不能为空"),
    DELETE_ROLE_FAIL(10006, "删除角色失败");
    private final Integer code;
    private final String message;
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/DtoRole.java
New file
@@ -0,0 +1,48 @@
package com.dy.pipIrrBase.role;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
/**
 * @author ZhuBaoMin
 * @date 2024-01-10 9:16
 * @LastEditTime 2024-01-10 9:16
 * @Description
 */
@Data
@Schema(name = "角色传入对象")
public class DtoRole {
    public static final long serialVersionUID = 1L;
    /**
     * 角色编号
     */
    @Schema(description = "角色编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Positive(message = "角色编号必须为大于0的整数")
    private Long roleid;
    /**
     * 角色名称
     */
    @Schema(description = "角色名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "角色名称不能为空")
    @Length(max = 25, message = "角色名称最多25字")
    private String roleName;
    /**
     * 权限列表
     */
    @Schema(description = "权限列表", requiredMode = Schema.RequiredMode.REQUIRED)
    private String permissions;
    /**
     * 操作人编号
     */
    @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Positive(message = "操作人编号必须为大于0的整数")
    private Long operator;
}
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/QueryVo.java
@@ -13,8 +13,10 @@
@Builder
@Schema(name = "角色查询条件")
public class QueryVo extends QueryConditionVo {
    @Schema(description = "角色ID")
    public Long roleId;
    @Schema(description = "角色名称")
    public String name;
    public String roleName;
}
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleCtrl.java
@@ -1,5 +1,6 @@
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;
@@ -7,9 +8,10 @@
import com.dy.common.webUtil.QueryResultVo;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrBase.result.SystemResultCode;
import com.dy.pipIrrBase.user.QueryVo;
import com.dy.pipIrrGlobal.pojoBa.BaRole;
import com.dy.pipIrrGlobal.pojoBa.BaRolePermissions;
import com.dy.pipIrrGlobal.voBa.VoRole;
import com.dy.pipIrrGlobal.voSe.VoActiveCard;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -19,15 +21,12 @@
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
@Slf4j
@Tag(name = "角色管理", description = "角色增删改查等操作")
@@ -37,89 +36,56 @@
@SuppressWarnings("unchecked")//java版本越高,对泛型约束越严,所以配置SuppressWarnings("unchecked")
public class RoleCtrl {
    private RoleSv sv ;
    //private RoleSv sv ;
    private final RoleSv roleSv;
    @Autowired
    private void setSv(RoleSv sv){
        this.sv = sv ;
    }
    //@Autowired
    //private void setSv(RoleSv sv){
    //    this.sv = sv ;
    //}
    /**
     * 客户端请求得到所有角色数据
     * @return 所有角色数据
     * 根据指定条件(角色编号、角色名称)获取角色列表
     * 当获取一条记录时,传入roleId即可
     * @param vo
     * @return
     */
    @Operation(summary = "获得全部角色", description = "返回全部角色数据")
    @Operation(summary = "获得一页角色记录", description = "返回一页角色数据")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "返回全部角色数据(BaseResponse.content:QueryResultVo[{}])",
                    description = "返回一页控制器数据(BaseResponse.content:QueryResultVo[{}])",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = BaRole.class))}
                            schema = @Schema(implementation = VoActiveCard.class))}
            )
    })
    @GetMapping(path = "all")
    @GetMapping(path = "/roles")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<BaRole>>> all(){
    public BaseResponse<QueryResultVo<List<VoRole>>> getRoles(QueryVo vo){
        try {
            QueryResultVo<List<BaRole>> res = this.sv.selectAll() ;
            return BaseResponseUtils.buildSuccess(res);
            //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);
            log.error("获取开卡记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 客户端请求得到一页角色数据
     * @return 所有角色数据
     * 添加角色及权限列表,添加前判断角色名是否已存在
     * @param po 角色传入对象,包括角色名称、权限列表、操作人编号
     * @param bindingResult
     * @return
     */
    @Operation(summary = "获得一页角色", description = "返回一页角色数据")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "返回一页角色数据(BaseResponse.content:QueryResultVo[{}])",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = BaRole.class))}
            )
    })
    @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE)
    @SsoAop()
    public BaseResponse<QueryResultVo<List<BaRole>>> some(@RequestBody @Valid QueryVo vo){
        try {
            QueryResultVo<List<BaRole>> res = this.sv.selectSome(vo) ;
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询角色异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 得到一个角色数据
     * @return 一个角色数据
     */
    @Operation(summary = "一个角色", description = "得到一个角色数据")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "返回一个角色数据(BaseResponse.content:{})",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = BaRole.class))}
            )
    })
    @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE)
    @SsoAop()
    public BaseResponse<BaRole> one(Long id){
        return BaseResponseUtils.buildSuccess(this.sv.selectById(id));
    }
    /**
     * 保存角色
     * @param po 保存角色form表单对象
     * @return 是否成功
     */
    @Operation(summary = "保存角色", description = "提交角色数据(form表单),进行保存")
    @Operation(summary = "添加角色", description = "提交角色数据及权限数据,进行保存")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
@@ -129,134 +95,57 @@
            )
    })
    @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> save(@RequestBody @Valid BaRole po, BindingResult bindingResult){
    public BaseResponse<Boolean> save(@RequestBody @Valid DtoRole po, BindingResult bindingResult){
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        po.id = null ;
        Long count;
        // 获取角色名称级权限列表
        String roleName = Optional.ofNullable(po.getRoleName()).orElse("");
        String permissions = Optional.ofNullable(po.getPermissions()).orElse("");
        Long operator = Optional.ofNullable(po.getOperator()).orElse(0L);
        // 判断角色名称是否重名
        Integer recordCount = Optional.ofNullable(roleSv.getRecordCountByName(roleName)).orElse(0);
        if(recordCount > 0)
            return BaseResponseUtils.buildFail(SystemResultCode.ROLE_NAME_EXIST.getMessage());
        // 添加角色
        BaRole baRole = new BaRole();
        Long roleId = 0L;
        try {
            po.deleted = Deleted.NO ;//默认不删除
            count = this.sv.save(po);
            baRole.setName(roleName);
            baRole.setOperator(operator);
            Date operateTime = new Date();
            baRole.setOperateDt(operateTime);
            baRole.setDeleted(Deleted.NO.getCode());
            roleId = roleSv.addRole(baRole);
        } catch (Exception e) {
            log.error("保存角色异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
        if(count <= 0){
            return BaseResponseUtils.buildFail("数据库存储失败") ;
        }else{
            return BaseResponseUtils.buildSuccess(true) ;
        }
    }
    /**
     * 编辑修改角色
     * @param po 保存角色form表单对象
     * @return 是否成功
     */
    @Operation(summary = "编辑修改角色", description = "提交角色数据(form表单),进行修改")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
    @SsoAop()
    public BaseResponse<Boolean> update(@RequestBody @Valid BaRole po, BindingResult bindingResult){
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        if(po.id == null){
            return BaseResponseUtils.buildFail("无数据实体ID") ;
        }
        int count;
        try {
            po.deleted = null ;//设置为null,不做更新
            count = this.sv.update(po);
        } catch (Exception e) {
            log.error("保存角色异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
        if(count <= 0){
            return BaseResponseUtils.buildFail("数据库存储失败") ;
        }else{
            return BaseResponseUtils.buildSuccess(true) ;
        }
    }
        if(roleId <= 0)
            return BaseResponseUtils.buildFail(SystemResultCode.ADD_ROLE_FAIL.getMessage());
    /**
     * 设置角色权限
     * @param id 角色ID
     * @return 是否成功
     */
    @Operation(summary = "设置角色权限", description = "提交角色ID,及所选择的权限ID集合(数组)")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "setPrivs", consumes = MediaType.APPLICATION_JSON_VALUE)
    @SsoAop()
    public BaseResponse<Boolean> setPrivileges(Long id, Long[] privIds){
        Long[] privIds_lg = null ;
        if(privIds != null && privIds.length > 0){
            privIds_lg = new Long[privIds.length] ;
            int index = 0 ;
            for(Long privId : privIds){
                privIds_lg[index++] = privId ;
            }
        }
        try {
            this.sv.setRoles(id, privIds_lg);
        } catch (Exception e) {
            log.error("保存用户异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        // 添加权限列表
        BaRolePermissions  baRolePermissions = new BaRolePermissions();
        baRolePermissions.setRoleid(roleId);
        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());
        }
        return BaseResponseUtils.buildSuccess(true) ;
    }
    /**
     * 删除角色
     * @param id 角色ID
     * @return 是否成功
     */
    @Operation(summary = "删除角色", description = "提交角色ID,进行逻辑删除")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
    @SsoAop()
    public BaseResponse<Boolean> delete(Long id){
        if(id == null){
            return BaseResponseUtils.buildFail("id不能为空") ;
        }
        int count;
        try {
            count = this.sv.delete(id);
        } catch (Exception e) {
            log.error("保存角色异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
        if(count <= 0){
            return BaseResponseUtils.buildFail("数据库存储失败") ;
        }else{
            return BaseResponseUtils.buildSuccess(true) ;
        }
    }
    /**
     * 角色授权,当角色编号为空时,实际为添加角色及权限列表
     * @param po
     * @param bindingResult
     * @return
     */
    @Operation(summary = "授权", description = "授权")
    @ApiResponses(value = {
            @ApiResponse(
@@ -269,7 +158,7 @@
    @PostMapping(path = "addPermissions", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> permission(@RequestBody  @Valid BaRolePermissions po, BindingResult bindingResult){
    public BaseResponse<Boolean> permission(@RequestBody  @Valid DtoRole po, BindingResult bindingResult){
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
@@ -284,28 +173,125 @@
         *      2. 添加角色、权限记录
         */
        Long roleid = Optional.ofNullable(po.getRoleid()).orElse(0L);
        Long roleId = Optional.ofNullable(po.getRoleid()).orElse(0L);
        String roleName = Optional.ofNullable(po.getRoleName()).orElse("");
        String permissions = Optional.ofNullable(po.getPermissions()).orElse("");
        Long operator = Optional.ofNullable(po.getOperator()).orElse(0L);
        if(roleid == 0 && roleName.length() == 0) {
        if(roleId == 0 && roleName.length() == 0)
            return BaseResponseUtils.buildFail(SystemResultCode.PERMISSION_ERROR.getMessage());
        }
        // 新建角色且授权
        if(roleid == 0) {
        if(roleId == 0) {
            BaRole baRole = new BaRole();
            baRole.setName(roleName);
            roleid = Optional.ofNullable(roleSv.save(baRole)).orElse(0L);
            po.setRoleid(roleid);
            roleSv.addPermissions(po);
            baRole.setOperator(operator);
            Date operateTime = new Date();
            baRole.setOperateDt(operateTime);
            baRole.setDeleted(Deleted.NO.getCode());
            roleId = Optional.ofNullable(roleSv.addRole(baRole)).orElse(0L);
            BaRolePermissions baRolePermissions = new BaRolePermissions();
            baRolePermissions.setRoleid(roleId);
            baRolePermissions.setPermissions(new JSONArray(permissions));
            roleSv.addPermissions(baRolePermissions);
            return BaseResponseUtils.buildSuccess(true) ;
        }
        // 修改角色授权
        roleSv.delPermissionsByRoleId(roleid);
        roleSv.addPermissions(po);
        BaRolePermissions baRolePermissions = new BaRolePermissions();
        baRolePermissions.setRoleid(roleId);
        baRolePermissions.setPermissions(new JSONArray(permissions));
        roleSv.delPermissionsByRoleId(roleId);
        roleSv.addPermissions(baRolePermissions);
        return BaseResponseUtils.buildSuccess(true) ;
    }
    /**
     * 修改角色
     * @param po 保存角色form表单对象
     * @return 是否成功
     */
    @Operation(summary = "修改角色", description = "提交角色数据,进行修改")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
    @SsoAop()
    public BaseResponse<Boolean> update(@RequestBody @Valid BaRole po, BindingResult bindingResult){
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        // 接收角色编号、角色名称、操作人编号
        Long roleId = Optional.ofNullable(po.getId()).orElse(0L);
        String roleName = Optional.ofNullable(po.getName()).orElse("");
        Long operator = Optional.ofNullable(po.getOperator()).orElse(0L);
        // 判断主键是否为空
        if(roleId == 0)
            return BaseResponseUtils.buildFail(SystemResultCode.PLEASE_INPUT_ROLE_ID.getMessage()) ;
        Integer recordCount = 0;
        try {
            po.setName(roleName);
            po.setOperator(operator);
            Date operateTime = new Date();
            po.setOperateDt(operateTime);
            //po.deleted = null ;//设置为null,不做更新
            recordCount = roleSv.updateRole(po);
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
        if(recordCount <= 0)
            return BaseResponseUtils.buildFail("数据库存储失败") ;
        return BaseResponseUtils.buildSuccess(true) ;
    }
    /**
     * 删除角色
     *  逻辑删除角色记录,物理删除角色授权记录
     * @param map
     * @return 是否成功
     */
    @Operation(summary = "删除角色", description = "提交角色ID,进行逻辑删除")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    //@GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
    @PostMapping(path = "delete", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> delete(@RequestBody Map map){
        Long id = Optional.ofNullable(Long.parseLong(map.get("id").toString())).orElse(0L);
        if(id == 0)
            return BaseResponseUtils.buildException(SystemResultCode.PLEASE_INPUT_ROLE_ID.getMessage());
        try {
            // 逻辑删除角色记录,物理删除角色授权记录
            Integer res_role = Optional.ofNullable(roleSv.deleteRoleById(id)).orElse(0);
            Integer res_per = Optional.ofNullable(roleSv.delPermissionsByRoleId(id)).orElse(0);
            if(res_role == 0 || res_per == 0)
                return BaseResponseUtils.buildFail(SystemResultCode.DELETE_ROLE_FAIL.getMessage());
            return BaseResponseUtils.buildSuccess(true);
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java
@@ -1,51 +1,115 @@
package com.dy.pipIrrBase.role;
import com.alibaba.fastjson2.JSONArray;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrBase.user.QueryVo;
import com.dy.pipIrrGlobal.daoBa.BaRoleMapper;
import com.dy.pipIrrGlobal.daoBa.BaRolePermissionsMapper;
import com.dy.pipIrrGlobal.daoBa.BaRolePrivilegeMapper;
import com.dy.pipIrrGlobal.pojoBa.BaRole;
import com.dy.pipIrrGlobal.pojoBa.BaRolePermissions;
import com.dy.pipIrrGlobal.pojoBa.BaRolePrivilege;
import com.dy.pipIrrGlobal.voBa.VoRole;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
 * @author ZhuBaoMin
 * @date 2024-01-10 11:00
 * @LastEditTime 2024-01-10 11:00
 * @Description
 */
@Slf4j
@Service
public class RoleSv {
    private BaRoleMapper dao;
    private BaRolePrivilegeMapper rolePrivDao ;
    //private BaRoleMapper baRoleMapper;
    //private BaRolePrivilegeMapper rolePrivDao ;
    @Autowired
    private void setDao(BaRoleMapper dao){
        this.dao = dao;
    }
    //@Autowired
    //private void setDao(BaRoleMapper dao){
    //    this.dao = dao;
    //}
    //@Autowired
    //private void setRolePrivDao(BaRolePrivilegeMapper dao){
    //    this.rolePrivDao = dao;
    //}
    @Autowired
    private void setRolePrivDao(BaRolePrivilegeMapper dao){
        this.rolePrivDao = dao;
    }
    private BaRoleMapper baRoleMapper;
    @Autowired
    private BaRolePermissionsMapper baRolePermissionsMapper;
    /**
     * 根据指定条件(角色编号、角色名称)获取角色列表
     * 当获取一条记录时,传入roleId即可
     * @param queryVo
     * @return
     */
    public QueryResultVo<List<VoRole>> getRoles(QueryVo queryVo) {
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
        Long itemTotal = baRolePermissionsMapper.getRecordCount(params);
        QueryResultVo<List<VoRole>> rsVo = new QueryResultVo<>() ;
        Integer pageCurr = 0;
        Integer pageSize = 10000;
        rsVo.pageCurr = 1;
        rsVo.pageSize = 10000;
        if(queryVo.pageSize != null && queryVo.pageCurr != null) {
            rsVo.pageSize = queryVo.pageSize ;
            rsVo.pageCurr = queryVo.pageCurr;
            pageSize = queryVo.pageSize ;
            pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString());
        }
        params.put("pageCurr", pageCurr);
        params.put("pageSize", pageSize);
        rsVo.calculateAndSet(itemTotal, 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 所有角色集合
     */
    public QueryResultVo<List<BaRole>> selectAll(){
        QueryResultVo<List<BaRole>> rsVo = new QueryResultVo<>() ;
        rsVo.obj = this.dao.selectAll() ;
        return rsVo ;
    }
    //public QueryResultVo<List<BaRole>> selectAll(){
    //    QueryResultVo<List<BaRole>> rsVo = new QueryResultVo<>() ;
    //    rsVo.obj = this.dao.selectAll() ;
    //    return rsVo ;
    //}
    /**
@@ -53,54 +117,65 @@
     * @param id 角色ID
     * @return 角色实体
     */
    public BaRole selectById(Long id){
        return this.dao.selectById(id) ;
    }
    //public BaRole selectById(Long id){
    //    return this.dao.selectById(id) ;
    //}
    /**
     * 得到一个用户
     * @param vo 查询条件值对象
     //* @param vo 查询条件值对象
     * @return 用户实体
     */
    @SuppressWarnings("unchecked")
    public QueryResultVo<List<BaRole>> selectSome(QueryVo vo){
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ;
        Long itemTotal = this.dao.selectTotal(params) ;
        QueryResultVo<List<BaRole>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = vo.pageSize ;
        rsVo.pageCurr = vo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = this.dao.selectSome(params) ;
        return rsVo ;
    }
    //public QueryResultVo<List<BaRole>> selectSome(QueryVo vo){
    //    Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ;
    //    Long itemTotal = this.dao.selectTotal(params) ;
    //
    //    QueryResultVo<List<BaRole>> rsVo = new QueryResultVo<>() ;
    //    rsVo.pageSize = vo.pageSize ;
    //    rsVo.pageCurr = vo.pageCurr ;
    //    rsVo.calculateAndSet(itemTotal, params);
    //    rsVo.obj = this.dao.selectSome(params) ;
    //
    //    return rsVo ;
    //}
    /**
     * 保存实体
     * @param po 实体
     * @return 影响记录数量
     * 添加角色
     * @param po 角色实体
     * @return 角色ID
     */
    /**
     * 12月20日 朱宝民修改返回值,添加角色后返回主键
     */
    @Transactional
    public Long save(BaRole po){
        //return this.dao.putin(po) ;
        this.dao.putin(po) ;
    public Long addRole(BaRole po){
        baRoleMapper.insert(po);
        return po.getId();
    }
    /**
     * 保存修改实体
     * @param po 实体
     * @return 影响记录数量
     * 根据角色名称查询记录数量,添加角色前判断是否重名
     * @param roleName 角色名称
     * @return 符合条件记录数
     */
    @Transactional
    public int update(BaRole po){
        return this.dao.updateByPrimaryKeySelective(po) ;
    public Integer getRecordCountByName(String roleName) {
        return baRoleMapper.getRecordCountByName(roleName);
    }
    /**
     * 修改角色
     * @param record
     * @return
     */
    public int updateRole(BaRole record) {
        return baRoleMapper.updateByPrimaryKeySelective(record);
    }
    /**
     * 根据roleId逻辑删除角色对象
     * @param roleId 角色编号
     * @return
     */
    public Integer deleteRoleById(Long roleId) {
        return baRoleMapper.deleteRoleById(roleId);
    }
    /**
@@ -109,35 +184,36 @@
     * @param priviIds 选择的权限id集合
     * @return 插入角色与权限关联记录数量
     */
    public int setRoles(Long roleId, Long[] priviIds){
        this.rolePrivDao.deleteByRoleId(roleId) ;
        int count = 0 ;
        if(priviIds != null && priviIds.length > 0){
            for(Long privId : priviIds){
                count += this.rolePrivDao.insertSelective(new BaRolePrivilege(roleId, privId)) ;
            }
        }
        return count ;
    }
    //public int setRoles(Long roleId, Long[] priviIds){
    //    this.rolePrivDao.deleteByRoleId(roleId) ;
    //    int count = 0 ;
    //    if(priviIds != null && priviIds.length > 0){
    //        for(Long privId : priviIds){
    //            count += this.rolePrivDao.insertSelective(new BaRolePrivilege(roleId, privId)) ;
    //        }
    //    }
    //    return count ;
    //}
    /**
     * 保存修改实体
     * @param id 实体ID
     * @return 影响记录数量
     */
    @Transactional
    public int delete(Long id){
        //int count = this.dao.deleteLogicById(id) ;
        //逻辑删除,所以不实际删除其关联的权限
        //if(count > 0){
        //    this.rolePrivDao.deleteByRoleId(id) ;
        //}
        //return count ;
        return this.dao.deleteLogicById(id) ;
    }
    //@Transactional
    //public int delete(Long id){
    //    //int count = this.dao.deleteLogicById(id) ;
    //    //逻辑删除,所以不实际删除其关联的权限
    //    //if(count > 0){
    //    //    this.rolePrivDao.deleteByRoleId(id) ;
    //    //}
    //    //return count ;
    //    return this.dao.deleteLogicById(id) ;
    //}
    /**
     * 添加授权记录
     * @Auth 朱宝民
     * @param po
     * @return
     */
@@ -147,6 +223,7 @@
    /**
     * 依据角色编号删除授权记录
     * @Auth 朱宝民
     * @param roleid
     * @return
     */
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java
@@ -113,7 +113,8 @@
                            schema = @Schema(implementation = BaUser.class))}
            )
    })
    @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE)
    //@GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE)
    @GetMapping(path = "one")
    @SsoAop()
    public BaseResponse<BaUser> one(String id) {
        return BaseResponseUtils.buildSuccess(this.sv.selectById(Long.parseLong(id)));
@@ -227,7 +228,8 @@
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "changePassword", consumes = MediaType.TEXT_PLAIN_VALUE)
    //@GetMapping(path = "changePassword", consumes = MediaType.TEXT_PLAIN_VALUE)
    @GetMapping(path = "changePassword")
    @SsoAop()
    public BaseResponse<Boolean> changePassword(String id, String oldPassword, String newPassword) throws Exception {
        if (id == null) {
@@ -452,7 +454,8 @@
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
    //@GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
    @GetMapping(path = "delete")
    @SsoAop()
    public BaseResponse<Boolean> delete(String id) {
        if (id == null) {
@@ -488,9 +491,9 @@
    })
    @GetMapping("/getUserInfos/{userId}")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoUserInfo>>> getUserInfos(@PathVariable("userId") Long userId) {
    public BaseResponse<QueryResultVo<VoUserInfo>> getUserInfos(@PathVariable("userId") Long userId) {
        try {
            List<VoUserInfo> res = this.sv.getUserInfos(userId);
            VoUserInfo res = this.sv.getUserInfos(userId);
            System.out.println("   :" + res);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java
@@ -1,6 +1,9 @@
package com.dy.pipIrrBase.user;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoBa.BaUserMapper;
import com.dy.pipIrrGlobal.daoBa.BaUserRoleMapper;
@@ -13,9 +16,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.*;
@Slf4j
@Service
@@ -168,7 +169,40 @@
     * @param userId 用户编号
     * @return 用户信息列表
     */
    public List<VoUserInfo> getUserInfos(Long userId) {
        return dao.getUserInfos(userId);
    public VoUserInfo getUserInfos(Long userId) {
        VoUserInfo voUserInfo = new VoUserInfo();
        String permission = "";
        Map map = Optional.ofNullable(dao.getUserInfoById(userId)).orElse(new HashMap());
        if(map.size() > 0) {
            voUserInfo.setUserId(userId);
            voUserInfo.setUserName(map.get("userName").toString());
        }
        List list_roleIds = new ArrayList();
        List list_roleNames = new ArrayList();
        List list_permissions = new ArrayList();
        List<Map<String, Object>> list = Optional.ofNullable(urDao.getPermissionsByUserId(userId)).orElse(new ArrayList<>());
        if(list.size() > 0) {
            JSONArray array= JSONArray.parseArray(JSON.toJSONString(list));
            for (int i = 0; i < array.size(); i++) {
                JSONObject job = array.getJSONObject(i);
                list_roleIds.add(job.getLong("roleId"));
                list_roleNames.add(job.getString("roleName"));
                String permissions = Optional.ofNullable(job.getString("permissions")).orElse("");
                if(permissions.length() > 0) {
                    permissions = permissions.substring(1, permissions.length() - 1);
                    permissions= permissions.replace(String.valueOf(" "), "");
                    permission = permission + permissions + ",";
                }
            }
            voUserInfo.setRoleIds(list_roleIds);
            voUserInfo.setRoleNames(list_roleNames);
            permission = permission.substring(0, permission.length()-1);
            list_permissions.add(permission);
            voUserInfo.setPermissions(list_permissions);
        }
        return voUserInfo;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java
@@ -68,7 +68,11 @@
    public BaseResponse<QueryResultVo<List<VoDivide>>> getDivides(QueryVo vo){
        try {
            QueryResultVo<List<VoDivide>> res = divideSv.getDivides(vo);
            return BaseResponseUtils.buildSuccess(res);
            if(res.itemTotal != null && res.itemTotal > 0) {
                return BaseResponseUtils.buildSuccess(res);
            }else {
                return BaseResponseUtils.buildFail(ProjectResultCode.NO_DIVIDES.getMessage());
            }
        } catch (Exception e) {
            log.error("获取开卡记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
@@ -94,7 +98,11 @@
    public BaseResponse<PrDivide> getOneDivide(@PathVariable("id") Long id){
        try {
            PrDivide res = divideSv.getOneDivide(id);
            return BaseResponseUtils.buildSuccess(res);
            if(res != null) {
                return BaseResponseUtils.buildSuccess(res);
            }else {
                return BaseResponseUtils.buildFail(ProjectResultCode.NO_DIVIDES.getMessage());
            }
        } catch (Exception e) {
            log.error("查询农户异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
@@ -153,7 +161,7 @@
    /**
     * 根据分水房ID逻辑删除分水房
     * @param id
     * @param map
     * @return
     */
    @Operation(summary = "删除一个分水房", description = "删除一个分水房数据")
@@ -166,14 +174,19 @@
            )
    })
    @GetMapping(path = "/delone/{id}")
    //@GetMapping(path = "/delone/{id}")
    @PostMapping(path = "delete", consumes = MediaType.APPLICATION_JSON_VALUE)
    @SsoAop()
    public BaseResponse<Boolean> deleteDivideById(@PathVariable("id") Long id){
    public BaseResponse<Boolean> deleteDivideById(@RequestBody Map map){
        Long id = Optional.ofNullable(Long.parseLong(map.get("id").toString())).orElse(0L);
        if(id == 0)
            return BaseResponseUtils.buildException(ProjectResultCode.DELETE_DIVIDE_FAIL.getMessage());
        try {
            Integer res = Optional.ofNullable(divideSv.deleteDivideById(id)).orElse(0);
            if(res == 0) {
                return BaseResponseUtils.buildFail("分水房删除失败");
            }
            if(res == 0)
                return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_DIVIDE_FAIL.getMessage());
            return BaseResponseUtils.buildSuccess(true);
        } catch (Exception e) {
            log.error("删除分水房异常", e);
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java
@@ -17,6 +17,8 @@
     * 分水房
     */
    DIVIDE_FAIL(10001, "分水房添加失败"),
    DELETE_DIVIDE_FAIL(10001, "分水房删除失败"),
    NO_DIVIDES(10001, "无符合条件的分水房记录"),
    /**
     * 取水口