parent
17917a834b
commit
a39f94ee27
12
core/pom.xml
12
core/pom.xml
|
@ -156,6 +156,18 @@
|
|||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>1.4.1.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.sip</groupId>
|
||||
<artifactId>jain-sip-ri</artifactId>
|
||||
<version>1.3.0-91</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.sip</groupId>
|
||||
<artifactId>jain-sip-ri</artifactId>
|
||||
<version>1.3.0-91</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -19,12 +19,19 @@ public class Message implements Serializable {
|
|||
public static final String PROJECT_ID_IS_NOT_EXIST = "项目id不存在";
|
||||
public static final String TURBINE_ID_IS_NOT_EXIST = "机组id不存在";
|
||||
public static final String PART_ID_IS_NOT_EXIST = "部件id不存在";
|
||||
public static final String IMAGE_SOURCE_ID_NOT_EXIST_OR_ILLEGAL = "部件id不存在";
|
||||
public static final String IMAGE_SOURCE_ID_NOT_EXIST_OR_ILLEGAL = "部件id不存在或者不合法";
|
||||
public static final String USER_ID_NOT_EXIST = "用户id不存在";
|
||||
public static final String USER_ID_NOT_EXIST_OR_ILLEGAL = "用户id不存在或者不合法";
|
||||
public static final String ACCOUNT_EXIST = "用户账号已经存在,请重新输入";
|
||||
public static final String MOBILE_EXIST = "手机号码已经存在,请重新输入";
|
||||
public static final String EMAIL_EXIST = "邮箱已经存在,请重新输入";
|
||||
public static final String DEPT_PARENT_NOT_EXISTS = "父级部门不存在";
|
||||
public static final String DEPT_ID_NOT_EXISTS = "部门id不存在";
|
||||
public static final String POST_ID_NOT_EXISTS = "岗位id不存在";
|
||||
public static final String IDENTITY_CARD_EXIST = "身份证已经存在,请重新输入";
|
||||
public static final String DEPT_PARENT_NOT_EXIST = "父级部门不存在";
|
||||
public static final String DEPT_ID_NOT_EXIST = "部门id不存在";
|
||||
public static final String POST_ID_NOT_EXIST = "岗位id不存在";
|
||||
public static final String POST_ID_NOT_EXIST_OR_ILLEGAL = "岗位id不存在或者不合法";
|
||||
public static final String ROLE_ID_NOT_EXIST = "角色id不存在";
|
||||
public static final String ROLE_ID_NOT_EXIST_OR_ILLEGAL = "角色id不存在或者不合法";
|
||||
public static final String MENU_ID_NOT_EXIST = "菜单id不存在";
|
||||
public static final String MENU_ID_NOT_EXIST_OR_ILLEGAL = "菜单id不存在或者不合法";
|
||||
}
|
||||
|
|
|
@ -53,5 +53,15 @@ public interface Converts {
|
|||
|
||||
PostResp toPostResp(PostEntity entity);
|
||||
|
||||
RoleResp toRoleResp(RoleEntity entity);
|
||||
|
||||
List<RoleResp> toRoleResp(List<RoleEntity> list);
|
||||
|
||||
RoleEntity toRoleEntity(RoleReq req);
|
||||
|
||||
MenuEntity toMenuEntity(MenuReq req);
|
||||
|
||||
MenuResp toMenuResp(MenuEntity entity);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,6 @@ public class MenuEntity extends AuditableEntity implements Serializable {
|
|||
@TableField("visible")
|
||||
private String visible;
|
||||
|
||||
|
||||
|
||||
@ExcelProperty("权限标识")
|
||||
@ApiModelProperty("权限标识")
|
||||
@TableField("perms")
|
||||
|
|
|
@ -48,9 +48,15 @@ public class RoleEntity extends AuditableEntity implements Serializable {
|
|||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@ExcelProperty("备注")
|
||||
@ApiModelProperty("备注")
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("删除标志(0代表存在 1代表删除)")
|
||||
@ApiModelProperty("删除标志(0代表存在 1代表删除)")
|
||||
@TableField("del_flag")
|
||||
private Integer delFlag;
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
|
|
@ -65,6 +65,10 @@ public class UserEntity extends AuditableEntity implements Serializable {
|
|||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("所属部门")
|
||||
@TableField("dept_id")
|
||||
private String deptId;
|
||||
|
||||
@ExcelProperty("身份证")
|
||||
@ApiModelProperty("身份证")
|
||||
@TableField("identity_card")
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.dite.znpt.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.dite.znpt.domain.AuditableEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/5/15 23:33
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("user_post")
|
||||
@ApiModel(value="UserPostEntity对象", description="用户和岗位信息表")
|
||||
public class UserPostEntity extends AuditableEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -4046474045225600954L;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
@TableField("user_id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("岗位id")
|
||||
@TableField("post_id")
|
||||
private String postId;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.dite.znpt.util.ValidationGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 12:31
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("菜单信息请求实体")
|
||||
public class MenuReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -7141367511437222477L;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "菜单名称不能为空")
|
||||
@Size(max = 10, message = "菜单名称不能超过10个字符")
|
||||
@ApiModelProperty("菜单名称")
|
||||
private String menuName;
|
||||
|
||||
@ApiModelProperty("父级菜单id")
|
||||
private String parentId;
|
||||
|
||||
@ApiModelProperty("显示顺序")
|
||||
private Integer orderNum;
|
||||
|
||||
@Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 100, message = "请求地址不能超过100个字符")
|
||||
@ApiModelProperty("请求地址")
|
||||
private String url;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "菜单类型不能为空")
|
||||
@ApiModelProperty("菜单类型")
|
||||
private String menuType;
|
||||
|
||||
@ApiModelProperty("显示状态")
|
||||
private String visible;
|
||||
|
||||
@Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 50, message = "备注不能超过50个字符")
|
||||
@ApiModelProperty("参数")
|
||||
private String perms;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 12:31
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("菜单信息响应实体")
|
||||
public class MenuResp implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -153724438320680595L;
|
||||
|
||||
@ApiModelProperty("菜单id")
|
||||
private String menuId;
|
||||
|
||||
@ApiModelProperty("菜单名称")
|
||||
private String menuName;
|
||||
|
||||
@ApiModelProperty("父级菜单id")
|
||||
private String parentId;
|
||||
|
||||
@ApiModelProperty("显示顺序")
|
||||
private String orderNum;
|
||||
|
||||
@ApiModelProperty("请求地址")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty("菜单类型")
|
||||
private String menuType;
|
||||
|
||||
@ApiModelProperty("显示状态")
|
||||
private String visible;
|
||||
|
||||
@ApiModelProperty("参数")
|
||||
private String perms;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.dite.znpt.util.ValidationGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 17:33
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("角色菜单绑定请求实体")
|
||||
public class RoleMenuReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -7759529835730562338L;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "角色id不能为空")
|
||||
@ApiModelProperty(value = "角色id", required = true)
|
||||
private String roleId;
|
||||
|
||||
@NotEmpty(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "菜单id不能为空")
|
||||
@ApiModelProperty(value = "菜单id", required = true)
|
||||
private List<String> menuIds;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.dite.znpt.util.ValidationGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 12:29
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("角色信息请求实体")
|
||||
public class RoleReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -4581059117664119614L;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "角色名称不能为空")
|
||||
@Size(max = 30, message = "角色名称不能超过30个字符")
|
||||
@ApiModelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.Insert.class}, message = "角色权限字符不能为空")
|
||||
@Size(groups = {ValidationGroup.Insert.class}, max = 20, message = "角色权限字符不能超过20个字符")
|
||||
@ApiModelProperty("角色权限字符")
|
||||
private String roleKey;
|
||||
|
||||
@ApiModelProperty("状态")
|
||||
private Integer status;
|
||||
|
||||
@Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 200, message = "备注不能超过200个字符")
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 12:26
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("角色信息响应实体")
|
||||
public class RoleResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -144489103121775926L;
|
||||
|
||||
@ApiModelProperty("角色id")
|
||||
private String roleId;
|
||||
|
||||
@ApiModelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
@ApiModelProperty("角色权限字符")
|
||||
private String roleKey;
|
||||
|
||||
@ApiModelProperty("状态")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
|
@ -23,6 +23,12 @@ public class UserListReq implements Serializable {
|
|||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("所属部门id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty("岗位id")
|
||||
private String postId;
|
||||
|
||||
@ApiModelProperty("手机号码")
|
||||
private String mobile;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -26,38 +27,34 @@ public class UserListResp implements Serializable {
|
|||
@ApiModelProperty("账号")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty("头像地址")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty("1正常0禁用")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("所属部门名称")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty("岗位名称")
|
||||
private String postName;
|
||||
|
||||
@ApiModelProperty("身份证")
|
||||
private String identityCard;
|
||||
|
||||
@ApiModelProperty("性别")
|
||||
private String gender;
|
||||
|
||||
@ApiModelProperty("手机号码")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty("邮箱")
|
||||
private String email;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("入职日期")
|
||||
private LocalDate hiredate;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("出生日期")
|
||||
private LocalDate birthdate;
|
||||
|
||||
@ApiModelProperty("学历")
|
||||
private String education;
|
||||
|
||||
@ApiModelProperty("专业方向")
|
||||
private String majorField;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import javax.validation.constraints.*;
|
|||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
|
@ -38,6 +39,12 @@ public class UserReq implements Serializable {
|
|||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("所属部门")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty("岗位")
|
||||
private List<String> postIds;
|
||||
|
||||
@Pattern(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, regexp = "^$|\\d(?:\\d{15}|\\d{17})$", message = "身份证号码格式不正确")
|
||||
@ApiModelProperty("身份证")
|
||||
private String identityCard;
|
||||
|
|
|
@ -25,6 +25,12 @@ public class UserResp extends UserReq implements Serializable{
|
|||
@ApiModelProperty("账号")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty("所属部门")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty("岗位,多个岗位英文逗号隔开")
|
||||
private String postName;
|
||||
|
||||
@ApiModelProperty("学历描述")
|
||||
private String educationLabel;
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.dite.znpt.util.ValidationGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 17:41
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("用户角色绑定请求实体")
|
||||
public class UserRoleReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -1334908025320245685L;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "用户id不能为空")
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
|
||||
@NotEmpty(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "角色id不能为空")
|
||||
@ApiModelProperty("角色id")
|
||||
private List<String> roleIds;
|
||||
}
|
|
@ -46,7 +46,7 @@ public enum EducationEnum {
|
|||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> list(){
|
||||
public static List<JSONObject> listAll(){
|
||||
List<JSONObject> list = new ArrayList<>(EducationEnum.values().length);
|
||||
for (EducationEnum e : EducationEnum.values() ) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
|
|
@ -39,7 +39,7 @@ public enum GenderEnum {
|
|||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> list(){
|
||||
public static List<JSONObject> listAll(){
|
||||
List<JSONObject> list = new ArrayList<>(GenderEnum.values().length);
|
||||
for (GenderEnum e : GenderEnum.values() ) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.dite.znpt.enums;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 14:44
|
||||
* @description
|
||||
*/
|
||||
@Getter
|
||||
public enum MenuTypeEnum {
|
||||
|
||||
DEFECT("catalog", "目录"),
|
||||
TYPICAL("route", "菜单"),
|
||||
OTHER("button", "按钮");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
MenuTypeEnum(String code, String desc){
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static MenuTypeEnum getByCode(String code){
|
||||
for (MenuTypeEnum e : MenuTypeEnum.values() ) {
|
||||
if(e.code.equals(code)){
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code){
|
||||
MenuTypeEnum e = getByCode(code);
|
||||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> listAll(){
|
||||
List<JSONObject> list = new ArrayList<>(MenuTypeEnum.values().length);
|
||||
for (MenuTypeEnum e : MenuTypeEnum.values() ) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set(e.code, e.desc);
|
||||
list.add(jsonObject);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.dite.znpt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.DeptEntity;
|
||||
import com.dite.znpt.domain.entity.MenuEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 10:16
|
||||
* @description
|
||||
*/
|
||||
public interface MenuMapper extends BaseMapper<MenuEntity> {
|
||||
/**
|
||||
* @Author Bear.G
|
||||
* @Date 2025/5/20/周二 15:49
|
||||
* @description 向上递归查询菜单树
|
||||
* @param menuName
|
||||
* @return
|
||||
**/
|
||||
List<MenuEntity> upwardRecursionSelect(@Param("menuName") String menuName);
|
||||
|
||||
/**
|
||||
* @Author Bear.G
|
||||
* @Date 2025/5/20/周二 15:49
|
||||
* @description 向下递归查询菜单树
|
||||
* @param menuId
|
||||
* @return
|
||||
**/
|
||||
List<MenuEntity> downwardRecursionSelect(@Param("menuId") String menuId);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.dite.znpt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.RoleEntity;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 10:16
|
||||
* @description
|
||||
*/
|
||||
public interface RoleMapper extends BaseMapper<RoleEntity> {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.dite.znpt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.RoleMenuEntity;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 10:17
|
||||
* @description
|
||||
*/
|
||||
public interface RoleMenuMapper extends BaseMapper<RoleMenuEntity> {
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.dite.znpt.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.UserEntity;
|
||||
import com.dite.znpt.domain.vo.UserListReq;
|
||||
import com.dite.znpt.domain.vo.UserListResp;
|
||||
import com.dite.znpt.domain.vo.UserResp;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -13,6 +14,6 @@ import java.util.List;
|
|||
* @Description: 用户信息表数据库访问层
|
||||
*/
|
||||
public interface UserMapper extends BaseMapper<UserEntity> {
|
||||
List<UserResp> queryBySelective(UserListReq req);
|
||||
List<UserListResp> queryBySelective(UserListReq req);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.dite.znpt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.UserPostEntity;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 10:15
|
||||
* @description
|
||||
*/
|
||||
public interface UserPostMapper extends BaseMapper<UserPostEntity> {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.dite.znpt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.UserRoleEntity;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 10:16
|
||||
* @description
|
||||
*/
|
||||
public interface UserRoleMapper extends BaseMapper<UserRoleEntity> {
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.MenuEntity;
|
||||
import com.dite.znpt.domain.vo.MenuReq;
|
||||
import com.dite.znpt.domain.vo.MenuResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 10:24
|
||||
* @description
|
||||
*/
|
||||
public interface MenuService extends IService<MenuEntity> {
|
||||
|
||||
List<Tree<String>> tree(String menuName);
|
||||
MenuResp detail(String menuId);
|
||||
void save(MenuReq req);
|
||||
void update(String menuId, MenuReq req);
|
||||
void deleteById(String menuId);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.RoleMenuEntity;
|
||||
import com.dite.znpt.domain.vo.RoleMenuReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 16:01
|
||||
* @description
|
||||
*/
|
||||
public interface RoleMenuService extends IService<RoleMenuEntity> {
|
||||
|
||||
void bindRoleMenu(RoleMenuReq req);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.RoleEntity;
|
||||
import com.dite.znpt.domain.vo.RoleReq;
|
||||
import com.dite.znpt.domain.vo.RoleResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 10:24
|
||||
* @description
|
||||
*/
|
||||
public interface RoleService extends IService<RoleEntity> {
|
||||
|
||||
List<RoleResp> page(String roleName);
|
||||
|
||||
List<RoleResp> list(String roleName);
|
||||
|
||||
void save(RoleReq req);
|
||||
|
||||
void update(String roleId, RoleReq req);
|
||||
|
||||
void deleteById(String id);
|
||||
|
||||
RoleResp detail(String roleId);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.UserPostEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 15:39
|
||||
* @description
|
||||
*/
|
||||
public interface UserPostService extends IService<UserPostEntity> {
|
||||
void bindUserPost(String userId, List<String> postIds);
|
||||
void bindPostUser(String postId, List<String> userIds);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.UserRoleEntity;
|
||||
import com.dite.znpt.domain.vo.UserRoleReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 15:33
|
||||
* @description
|
||||
*/
|
||||
public interface UserRoleService extends IService<UserRoleEntity> {
|
||||
|
||||
void bindUserRole(UserRoleReq req);
|
||||
|
||||
void bindRoleUser(String roleId, List<String> userIds);
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.dite.znpt.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.UserEntity;
|
||||
import com.dite.znpt.domain.vo.UserListReq;
|
||||
import com.dite.znpt.domain.vo.UserListResp;
|
||||
import com.dite.znpt.domain.vo.UserReq;
|
||||
import com.dite.znpt.domain.vo.UserResp;
|
||||
|
||||
|
@ -23,7 +24,7 @@ public interface UserService extends IService<UserEntity> {
|
|||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
List<UserResp> page(UserListReq req);
|
||||
List<UserListResp> page(UserListReq req);
|
||||
/**
|
||||
* 功能描述:查询用户信息列表
|
||||
*
|
||||
|
@ -32,7 +33,7 @@ public interface UserService extends IService<UserEntity> {
|
|||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
List<UserResp> list(UserListReq req);
|
||||
List<UserListResp> list(UserListReq req);
|
||||
|
||||
/**
|
||||
* 功能描述:查询用户信息详情
|
||||
|
|
|
@ -107,7 +107,7 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
|
|||
List<ImageEntity> imageEntityList = imageService.batchSaveByImageSimpleReq(imageSimpleReqList);
|
||||
Map<String, ImageEntity> imageMap = imageEntityList.stream().collect(Collectors.toMap(k->k.getPartId().concat(StrUtil.COLON).concat(k.getImagePath()), Function.identity()));
|
||||
List<DefectEntity> defectEntityList = new ArrayList<>();
|
||||
list.stream().forEach(req -> {
|
||||
list.forEach(req -> {
|
||||
String key = req.getPartId().concat(StrUtil.COLON).concat(req.getImagePath());
|
||||
if(imageMap.containsKey(key)){
|
||||
DefectEntity defectEntity = Converts.INSTANCE.toDefectEntity(req);
|
||||
|
|
|
@ -57,7 +57,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, DeptEntity> impleme
|
|||
public DeptResp detail(String deptId) {
|
||||
DeptEntity entity = this.getById(deptId);
|
||||
if (null == entity || !entity.getDelFlag().equals(Constants.DEL_FLAG_0)){
|
||||
throw new ServiceException(Message.DEPT_ID_NOT_EXISTS);
|
||||
throw new ServiceException(Message.DEPT_ID_NOT_EXIST);
|
||||
}
|
||||
return Converts.INSTANCE.toDeptResp(entity);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, DeptEntity> impleme
|
|||
public void update(String deptId, DeptReq req) {
|
||||
DeptEntity originalEntity = this.getById(deptId);
|
||||
if (null == originalEntity || !originalEntity.getDelFlag().equals(Constants.DEL_FLAG_0)){
|
||||
throw new ServiceException(Message.DEPT_ID_NOT_EXISTS);
|
||||
throw new ServiceException(Message.DEPT_ID_NOT_EXIST);
|
||||
}
|
||||
DeptEntity entity = dealDept(req);
|
||||
entity.setDeptId(deptId);
|
||||
|
@ -91,7 +91,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, DeptEntity> impleme
|
|||
if(StrUtil.isNotBlank(req.getParentId())){
|
||||
DeptEntity parent = this.getById(req.getParentId());
|
||||
if(null == parent || !parent.getDelFlag().equals(Constants.DEL_FLAG_0)){
|
||||
throw new ServiceException(Message.DEPT_PARENT_NOT_EXISTS);
|
||||
throw new ServiceException(Message.DEPT_PARENT_NOT_EXIST);
|
||||
}
|
||||
entity.setAncestors(parent.getAncestors() + StrUtil.COMMA + parent.getDeptId());
|
||||
entity.setDeptFullName(parent.getDeptFullName() + StrUtil.SLASH + entity.getDeptName());
|
||||
|
@ -108,7 +108,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, DeptEntity> impleme
|
|||
public void deleteById(String deptId) {
|
||||
DeptEntity entity = this.getById(deptId);
|
||||
if (null == entity || !entity.getDelFlag().equals(Constants.DEL_FLAG_0)){
|
||||
throw new ServiceException(Message.DEPT_ID_NOT_EXISTS);
|
||||
throw new ServiceException(Message.DEPT_ID_NOT_EXIST);
|
||||
}
|
||||
entity.setDelFlag(Constants.DEL_FLAG_1);
|
||||
this.updateById(entity);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ImageCollectServiceImpl extends ServiceImpl<ImageCollectMapper, Ima
|
|||
List<ImageEntity> imageList = Converts.INSTANCE.toImageEntity(req.getImageList());
|
||||
String permPathPrefix = permPath.concat(ImageSourceEnum.COLLECT.getCode()).concat(FileUtil.FILE_SEPARATOR).concat(partId).concat(FileUtil.FILE_SEPARATOR).concat(dateStr).concat(FileUtil.FILE_SEPARATOR);
|
||||
String temPathPrefix = tempPath.concat(ImageSourceEnum.COLLECT.getCode()).concat(FileUtil.FILE_SEPARATOR).concat(partId).concat(FileUtil.FILE_SEPARATOR);
|
||||
imageList.stream().forEach(image -> {
|
||||
imageList.forEach(image -> {
|
||||
image.setPartId(partId);
|
||||
image.setCollectId(imageCollect.getCollectId());
|
||||
String path = permPathPrefix + image.getImageName();
|
||||
|
|
|
@ -84,7 +84,7 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
|||
List<ImageEntity> imageList = new ArrayList<>();
|
||||
List<String> partIds = list.stream().map(ImageSimpleReq::getPartId).collect(Collectors.toList());
|
||||
Map<String, PartEntity> partIdMap= partService.listByIds(partIds).stream().collect(Collectors.toMap(PartEntity::getPartId, Function.identity()));
|
||||
list.stream().forEach(req -> {
|
||||
list.forEach(req -> {
|
||||
if(partIdMap.containsKey(req.getPartId())){
|
||||
String path_prefix = permPath.concat(StrUtil.BACKSLASH).concat(req.getImageSource()).concat(StrUtil.BACKSLASH).concat(req.getPartId()).concat(StrUtil.BACKSLASH);
|
||||
String temp_path_prefix = tempPath.concat(StrUtil.BACKSLASH).concat(req.getImageSource()).concat(StrUtil.BACKSLASH).concat(req.getPartId()).concat(StrUtil.BACKSLASH);
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.DeptEntity;
|
||||
import com.dite.znpt.domain.entity.MenuEntity;
|
||||
import com.dite.znpt.domain.vo.MenuReq;
|
||||
import com.dite.znpt.domain.vo.MenuResp;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.MenuMapper;
|
||||
import com.dite.znpt.service.MenuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 10:27
|
||||
* @description
|
||||
*/
|
||||
@Service
|
||||
public class MenuServiceImpl extends ServiceImpl<MenuMapper, MenuEntity> implements MenuService {
|
||||
|
||||
@Override
|
||||
public List<Tree<String>> tree(String menuName) {
|
||||
List<MenuEntity> menuList = StrUtil.isBlank(menuName) ? this.baseMapper.downwardRecursionSelect(null) : this.baseMapper.upwardRecursionSelect(menuName);
|
||||
//配置
|
||||
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
|
||||
treeNodeConfig.setIdKey("menuId");
|
||||
treeNodeConfig.setNameKey("menuName");
|
||||
treeNodeConfig.setParentIdKey("parentId");
|
||||
treeNodeConfig.setWeightKey("orderNum");
|
||||
//转换器
|
||||
return TreeUtil.build(menuList, "0", treeNodeConfig,
|
||||
(treeNode, tree) -> {
|
||||
tree.setId(treeNode.getMenuId());
|
||||
tree.setParentId(treeNode.getParentId());
|
||||
tree.setName(treeNode.getMenuName());
|
||||
tree.putExtra("menuType",treeNode.getMenuType());
|
||||
tree.putExtra("visible",treeNode.getVisible());
|
||||
tree.putExtra("orderNum",treeNode.getOrderNum());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MenuResp detail(String menuId) {
|
||||
return Converts.INSTANCE.toMenuResp(this.getById(menuId));
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void save(MenuReq req) {
|
||||
MenuEntity entity = Converts.INSTANCE.toMenuEntity(req);
|
||||
entity.setParentId(StrUtil.isBlank(req.getParentId()) ? "0" : req.getParentId());
|
||||
entity.setVisible(StrUtil.isBlank(req.getVisible()) ? "0" : req.getVisible());
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void update(String menuId, MenuReq req) {
|
||||
if(null == this.getById(menuId)){
|
||||
throw new ServiceException(Message.MENU_ID_NOT_EXIST);
|
||||
}
|
||||
MenuEntity entity = Converts.INSTANCE.toMenuEntity(req);
|
||||
entity.setMenuId(menuId);
|
||||
if(StrUtil.isBlank(entity.getParentId())){
|
||||
entity.setParentId("0");
|
||||
}
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deleteById(String menuId) {
|
||||
this.removeById(menuId);
|
||||
}
|
||||
}
|
|
@ -1,20 +1,28 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Constants;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.PostEntity;
|
||||
import com.dite.znpt.domain.entity.UserEntity;
|
||||
import com.dite.znpt.domain.entity.UserPostEntity;
|
||||
import com.dite.znpt.domain.vo.PostReq;
|
||||
import com.dite.znpt.domain.vo.PostResp;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.PostMapper;
|
||||
import com.dite.znpt.mapper.UserPostMapper;
|
||||
import com.dite.znpt.service.PostService;
|
||||
import com.dite.znpt.service.UserService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -24,6 +32,10 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
public class PostServiceImpl extends ServiceImpl<PostMapper, PostEntity> implements PostService {
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private UserPostMapper userPostMapper;
|
||||
|
||||
@Override
|
||||
public List<PostResp> page(String postName) {
|
||||
|
@ -52,7 +64,7 @@ public class PostServiceImpl extends ServiceImpl<PostMapper, PostEntity> impleme
|
|||
@Override
|
||||
public void update(String postId, PostReq req) {
|
||||
if(null == this.getById(postId)){
|
||||
throw new ServiceException(Message.POST_ID_NOT_EXISTS);
|
||||
throw new ServiceException(Message.POST_ID_NOT_EXIST);
|
||||
}
|
||||
PostEntity entity = Converts.INSTANCE.toPostEntity(req);
|
||||
entity.setPostId(postId);
|
||||
|
@ -63,7 +75,7 @@ public class PostServiceImpl extends ServiceImpl<PostMapper, PostEntity> impleme
|
|||
@Override
|
||||
public void deleteById(String postId) {
|
||||
if(null == this.getById(postId)){
|
||||
throw new ServiceException(Message.POST_ID_NOT_EXISTS);
|
||||
throw new ServiceException(Message.POST_ID_NOT_EXIST);
|
||||
}
|
||||
this.removeById(postId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Constants;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.MenuEntity;
|
||||
import com.dite.znpt.domain.entity.RoleEntity;
|
||||
import com.dite.znpt.domain.entity.RoleMenuEntity;
|
||||
import com.dite.znpt.domain.vo.RoleMenuReq;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.RoleMenuMapper;
|
||||
import com.dite.znpt.service.MenuService;
|
||||
import com.dite.znpt.service.RoleMenuService;
|
||||
import com.dite.znpt.service.RoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 16:02
|
||||
* @description
|
||||
*/
|
||||
@Service
|
||||
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenuEntity> implements RoleMenuService {
|
||||
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void bindRoleMenu(RoleMenuReq req) {
|
||||
RoleEntity role = roleService.getById(req.getRoleId());
|
||||
if (role == null || !Constants.DEL_FLAG_0.equals(role.getDelFlag())) {
|
||||
throw new ServiceException(Message.ROLE_ID_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
List<MenuEntity> menuList = menuService.listByIds(req.getMenuIds());
|
||||
if(CollUtil.isEmpty(menuList) || menuList.size() != req.getMenuIds().size()){
|
||||
throw new ServiceException(Message.MENU_ID_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
this.remove(Wrappers.lambdaQuery(RoleMenuEntity.class).eq(RoleMenuEntity::getRoleId, req.getRoleId()));
|
||||
List<RoleMenuEntity> roleMenuList =new ArrayList<>(req.getMenuIds().size());
|
||||
for (String menuId : req.getMenuIds()) {
|
||||
RoleMenuEntity roleMenu = new RoleMenuEntity();
|
||||
roleMenu.setRoleId(req.getRoleId());
|
||||
roleMenu.setMenuId(menuId);
|
||||
roleMenuList.add(roleMenu);
|
||||
}
|
||||
this.saveBatch(roleMenuList);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Constants;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.RoleEntity;
|
||||
import com.dite.znpt.domain.vo.RoleReq;
|
||||
import com.dite.znpt.domain.vo.RoleResp;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.RoleMapper;
|
||||
import com.dite.znpt.service.RoleService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 10:25
|
||||
* @description
|
||||
*/
|
||||
@Service
|
||||
public class RoleServiceImpl extends ServiceImpl<RoleMapper, RoleEntity> implements RoleService {
|
||||
|
||||
@Override
|
||||
public List<RoleResp> page(String roleName) {
|
||||
PageUtil.startPage();
|
||||
return this.list(roleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RoleResp> list(String roleName) {
|
||||
List<RoleEntity> list = this.list(
|
||||
Wrappers.lambdaQuery(RoleEntity.class)
|
||||
.eq(RoleEntity::getDelFlag, Constants.DEL_FLAG_0)
|
||||
.like(StrUtil.isNotBlank(roleName), RoleEntity::getRoleName, roleName)
|
||||
);
|
||||
return Converts.INSTANCE.toRoleResp(list);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void save(RoleReq req) {
|
||||
RoleEntity entity = Converts.INSTANCE.toRoleEntity(req);
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void update(String roleId, RoleReq req) {
|
||||
RoleEntity originEntity = this.getById(roleId);
|
||||
if(null == originEntity || !Constants.DEL_FLAG_0.equals(originEntity.getDelFlag())) {
|
||||
throw new ServiceException(Message.ROLE_ID_NOT_EXIST);
|
||||
}
|
||||
RoleEntity entity = Converts.INSTANCE.toRoleEntity(req);
|
||||
entity.setRoleId(roleId);
|
||||
entity.setRoleKey(null);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deleteById(String roleId) {
|
||||
RoleEntity entity = this.getById(roleId);
|
||||
if(null == entity || !Constants.DEL_FLAG_0.equals(entity.getDelFlag())) {
|
||||
throw new ServiceException(Message.ROLE_ID_NOT_EXIST);
|
||||
}
|
||||
entity.setDelFlag(Constants.DEL_FLAG_1);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleResp detail(String roleId) {
|
||||
return Converts.INSTANCE.toRoleResp(this.getById(roleId));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Constants;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.domain.entity.PostEntity;
|
||||
import com.dite.znpt.domain.entity.UserEntity;
|
||||
import com.dite.znpt.domain.entity.UserPostEntity;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.UserPostMapper;
|
||||
import com.dite.znpt.service.PostService;
|
||||
import com.dite.znpt.service.UserPostService;
|
||||
import com.dite.znpt.service.UserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 15:40
|
||||
* @description
|
||||
*/
|
||||
@Service
|
||||
public class UserPostServiceImpl extends ServiceImpl<UserPostMapper, UserPostEntity> implements UserPostService {
|
||||
|
||||
@Resource
|
||||
private PostService postService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void bindUserPost(String userId, List<String> postIds) {
|
||||
List<PostEntity> postList = postService.listByIds(postIds);
|
||||
if(CollUtil.isEmpty(postList) || postList.size() != postIds.size()){
|
||||
throw new ServiceException(Message.POST_ID_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
UserEntity user = userService.getById(userId);
|
||||
if(null == user || Constants.DEL_FLAG_1.equals(user.getDelFlag())){
|
||||
throw new ServiceException(Message.USER_ID_NOT_EXIST);
|
||||
}
|
||||
this.remove(Wrappers.lambdaQuery(UserPostEntity.class).eq(UserPostEntity::getUserId, userId));
|
||||
List<UserPostEntity> userPostList = new ArrayList<>();
|
||||
postIds.forEach(postId -> {
|
||||
UserPostEntity userPostEntity = new UserPostEntity();
|
||||
userPostEntity.setUserId(userId);
|
||||
userPostEntity.setPostId(postId);
|
||||
userPostList.add(userPostEntity);
|
||||
});
|
||||
this.saveBatch(userPostList);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void bindPostUser(String postId, List<String> userIds) {
|
||||
PostEntity post = postService.getById(postId);
|
||||
if(null == post || !Constants.STATUS_0.equals(post.getStatus())){
|
||||
throw new ServiceException(Message.POST_ID_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
List<UserEntity> userList = userService.listByIds(userIds).stream().filter(userEntity -> !Constants.DEL_FLAG_1.equals(userEntity.getDelFlag())).toList();
|
||||
if(CollUtil.isEmpty(userList) || userIds.size() != userList.size()){
|
||||
throw new ServiceException(Message.USER_ID_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
this.remove(Wrappers.lambdaQuery(UserPostEntity.class).eq(UserPostEntity::getPostId, postId));
|
||||
List<UserPostEntity> userPostList = new ArrayList<>();
|
||||
userIds.forEach(userId -> {
|
||||
UserPostEntity userPostEntity = new UserPostEntity();
|
||||
userPostEntity.setUserId(userId);
|
||||
userPostEntity.setPostId(postId);
|
||||
userPostList.add(userPostEntity);
|
||||
});
|
||||
this.saveBatch(userPostList);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Constants;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.domain.entity.RoleEntity;
|
||||
import com.dite.znpt.domain.entity.UserEntity;
|
||||
import com.dite.znpt.domain.entity.UserRoleEntity;
|
||||
import com.dite.znpt.domain.vo.UserRoleReq;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.UserRoleMapper;
|
||||
import com.dite.znpt.service.RoleService;
|
||||
import com.dite.znpt.service.UserRoleService;
|
||||
import com.dite.znpt.service.UserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 15:33
|
||||
* @description
|
||||
*/
|
||||
@Service
|
||||
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRoleEntity> implements UserRoleService {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void bindUserRole(UserRoleReq req) {
|
||||
UserEntity user = userService.getById(req.getUserId());
|
||||
if(null == user || !Constants.DEL_FLAG_0.equals(user.getDelFlag())){
|
||||
throw new ServiceException(Message.USER_ID_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
List<RoleEntity> roleList = roleService.listByIds(req.getRoleIds()).stream().filter(role -> Constants.DEL_FLAG_0.equals(role.getDelFlag())).toList();
|
||||
if(CollUtil.isEmpty(roleList) || req.getRoleIds().size() != roleList.size()){
|
||||
throw new ServiceException(Message.ROLE_ID_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
List<UserRoleEntity> userRoleList = new ArrayList<>();
|
||||
req.getRoleIds().forEach(roleId -> {
|
||||
UserRoleEntity userRole = new UserRoleEntity();
|
||||
userRole.setUserId(req.getUserId());
|
||||
userRole.setRoleId(roleId);
|
||||
userRoleList.add(userRole);
|
||||
});
|
||||
this.saveBatch(userRoleList);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void bindRoleUser(String roleId, List<String> userIds) {
|
||||
RoleEntity role = roleService.getById(roleId);
|
||||
if(role == null || !Constants.DEL_FLAG_0.equals(role.getDelFlag())){
|
||||
throw new ServiceException(Message.ROLE_ID_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
List<UserEntity> userList = userService.listByIds(userIds).stream().filter(user -> Constants.DEL_FLAG_0.equals(user.getDelFlag())).toList();
|
||||
if(CollUtil.isEmpty(userList) || userIds.size()!= userList.size()){
|
||||
throw new ServiceException(Message.USER_ID_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
List<UserRoleEntity> userRoleList = new ArrayList<>();
|
||||
userIds.forEach(userId -> {
|
||||
UserRoleEntity userRole = new UserRoleEntity();
|
||||
userRole.setUserId(userId);
|
||||
userRole.setRoleId(roleId);
|
||||
userRoleList.add(userRole);
|
||||
});
|
||||
this.saveBatch(userRoleList);
|
||||
}
|
||||
}
|
|
@ -2,31 +2,38 @@ package com.dite.znpt.service.impl;
|
|||
|
||||
import cn.dev33.satoken.secure.SaBase64Util;
|
||||
import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Constants;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.PostEntity;
|
||||
import com.dite.znpt.domain.entity.UserEntity;
|
||||
import com.dite.znpt.domain.entity.UserPostEntity;
|
||||
import com.dite.znpt.domain.vo.UserListReq;
|
||||
import com.dite.znpt.domain.vo.UserListResp;
|
||||
import com.dite.znpt.domain.vo.UserReq;
|
||||
import com.dite.znpt.domain.vo.UserResp;
|
||||
import com.dite.znpt.enums.EducationEnum;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.service.UserService;
|
||||
import com.dite.znpt.mapper.UserMapper;
|
||||
import com.dite.znpt.service.DeptService;
|
||||
import com.dite.znpt.service.PostService;
|
||||
import com.dite.znpt.service.UserPostService;
|
||||
import com.dite.znpt.service.UserService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import com.dite.znpt.util.PasswordUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
|
@ -43,6 +50,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
|
|||
@Value("${password.enable-default:true}")
|
||||
private Boolean enableDefaultPassword;
|
||||
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
|
||||
@Resource
|
||||
private PostService postService;
|
||||
|
||||
@Resource
|
||||
private UserPostService userPostService;
|
||||
|
||||
/**
|
||||
* 功能描述:分页查询用户信息列表
|
||||
*
|
||||
|
@ -52,7 +68,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
|
|||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public List<UserResp> page(UserListReq req) {
|
||||
public List<UserListResp> page(UserListReq req) {
|
||||
PageUtil.startPage();
|
||||
return this.list(req);
|
||||
}
|
||||
|
@ -66,13 +82,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
|
|||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public List<UserResp> list(UserListReq req) {
|
||||
PageUtil.startPage();
|
||||
List<UserResp> userRespList= this.baseMapper.queryBySelective(req);
|
||||
userRespList.forEach(resp -> {
|
||||
resp.setEducationLabel(EducationEnum.getDescByCode(resp.getEducation()));
|
||||
});
|
||||
return userRespList;
|
||||
public List<UserListResp> list(UserListReq req) {
|
||||
return this.baseMapper.queryBySelective(req);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,7 +97,18 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
|
|||
@Override
|
||||
public UserResp detail(String userId) {
|
||||
UserEntity entity = this.getById(userId);
|
||||
return Converts.INSTANCE.toUserResp(entity);
|
||||
UserResp userResp= Converts.INSTANCE.toUserResp(entity);
|
||||
if(StrUtil.isNotBlank(userResp.getDeptId())){
|
||||
userResp.setUserId(deptService.getById(userResp.getDeptId()).getDeptName());
|
||||
}
|
||||
List<UserPostEntity> userPostList = userPostService.list(Wrappers.lambdaQuery(UserPostEntity.class).eq(UserPostEntity::getUserId, userId));
|
||||
if(CollUtil.isNotEmpty(userPostList)){
|
||||
String postName = postService.listByIds(
|
||||
userPostList.stream().map(UserPostEntity::getPostId).toList()
|
||||
).stream().map(PostEntity::getPostName).collect(Collectors.joining(StrUtil.COMMA));
|
||||
userResp.setPostName(postName);
|
||||
}
|
||||
return userResp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,6 +128,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
|
|||
String password = enableDefaultPassword ? defaultPassword : PasswordUtil.generatePassword();
|
||||
entity.setPassword(SaSecureUtil.md5(req.getAccount().concat(password).concat(salt)));
|
||||
this.save(entity);
|
||||
if(CollUtil.isNotEmpty(req.getPostIds())){
|
||||
userPostService.bindUserPost(entity.getUserId(), req.getPostIds());
|
||||
}
|
||||
return SaBase64Util.encode(password);
|
||||
}
|
||||
|
||||
|
@ -128,27 +153,39 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
|
|||
entity.setUserId(userId);
|
||||
entity.setAccount(null);
|
||||
validate(req, originalEntity);
|
||||
if(CollUtil.isNotEmpty(req.getPostIds())){
|
||||
userPostService.bindUserPost(userId, req.getPostIds());
|
||||
}
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
|
||||
private void validate(UserReq req, UserEntity originalEntity){
|
||||
if(StrUtil.isNotBlank(req.getDeptId()) && deptService.getById(req.getDeptId()) == null){
|
||||
throw new ServiceException(Message.DEPT_ID_NOT_EXIST);
|
||||
}
|
||||
LambdaQueryWrapper<UserEntity> accountWrapper = Wrappers.lambdaQuery(UserEntity.class).eq(UserEntity::getAccount, req.getAccount()).eq(UserEntity::getDelFlag, Constants.DEL_FLAG_0);
|
||||
if(this.getOne(accountWrapper) != null && originalEntity == null){
|
||||
throw new ServiceException(Message.ACCOUNT_EXIST);
|
||||
}
|
||||
if(originalEntity == null || !originalEntity.getMobile().equals(req.getMobile())){
|
||||
if(originalEntity == null || (StrUtil.isNotBlank(req.getMobile()) && !originalEntity.getMobile().equals(req.getMobile()))){
|
||||
LambdaQueryWrapper<UserEntity> mobileWrapper = Wrappers.lambdaQuery(UserEntity.class).eq(StrUtil.isNotBlank(req.getMobile()), UserEntity::getMobile, req.getMobile()).eq(UserEntity::getDelFlag, Constants.DEL_FLAG_0);
|
||||
if(this.getOne(mobileWrapper) != null){
|
||||
throw new ServiceException(Message.MOBILE_EXIST);
|
||||
}
|
||||
}
|
||||
if(originalEntity == null || !originalEntity.getEmail().equals(req.getEmail())){
|
||||
LambdaQueryWrapper<UserEntity> emailWrapper = Wrappers.lambdaQuery(UserEntity.class).eq(StrUtil.isNotBlank(req.getEmail()), UserEntity::getEmail, req.getMobile()).eq(UserEntity::getDelFlag, Constants.DEL_FLAG_0);
|
||||
if(originalEntity == null || (StrUtil.isNotBlank(req.getEmail()) && !originalEntity.getEmail().equals(req.getEmail()))){
|
||||
LambdaQueryWrapper<UserEntity> emailWrapper = Wrappers.lambdaQuery(UserEntity.class).eq(StrUtil.isNotBlank(req.getEmail()), UserEntity::getEmail, req.getEmail()).eq(UserEntity::getDelFlag, Constants.DEL_FLAG_0);
|
||||
if(this.getOne(emailWrapper) != null){
|
||||
throw new ServiceException(Message.EMAIL_EXIST);
|
||||
}
|
||||
}
|
||||
if(originalEntity == null || (StrUtil.isNotBlank(req.getIdentityCard()) && !originalEntity.getIdentityCard().equals(req.getIdentityCard()))){
|
||||
LambdaQueryWrapper<UserEntity> emailWrapper = Wrappers.lambdaQuery(UserEntity.class).eq(StrUtil.isNotBlank(req.getIdentityCard()), UserEntity::getIdentityCard, req.getIdentityCard()).eq(UserEntity::getDelFlag, Constants.DEL_FLAG_0);
|
||||
if(this.getOne(emailWrapper) != null){
|
||||
throw new ServiceException(Message.IDENTITY_CARD_EXIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
</choose>
|
||||
UNION ALL
|
||||
SELECT d.* FROM dept d INNER JOIN DeptPath dp ON d.dept_id = dp.parent_id WHERE d.del_flag = '0'
|
||||
)
|
||||
SELECT DISTINCT * FROM DeptPath;
|
||||
)SELECT DISTINCT * FROM DeptPath;
|
||||
</select>
|
||||
|
||||
<select id="downwardRecursionSelect" resultType="com.dite.znpt.domain.entity.DeptEntity">
|
||||
|
@ -33,8 +32,7 @@
|
|||
</choose>
|
||||
UNION ALL
|
||||
SELECT d.* FROM dept d INNER JOIN SubDepts sd ON d.parent_id = sd.dept_id WHERE d.del_flag = '0'
|
||||
)
|
||||
SELECT * FROM SubDepts;
|
||||
) SELECT * FROM SubDepts;
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?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.dite.znpt.mapper.MenuMapper">
|
||||
|
||||
|
||||
<select id="upwardRecursionSelect" resultType="com.dite.znpt.domain.entity.MenuEntity">
|
||||
WITH RECURSIVE MenuPath AS (
|
||||
SELECT * FROM menu
|
||||
<where>
|
||||
<choose>
|
||||
<when test="menuName != null and menuName != ''">
|
||||
AND menu_name LIKE concat('%',#{menuName}, '%') -- 起始菜单
|
||||
</when>
|
||||
<otherwise>
|
||||
AND parent_id = '0' -- 起始菜单
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
UNION ALL
|
||||
SELECT m.* FROM menu m INNER JOIN MenuPath mp ON m.menu_id = mp.parent_id
|
||||
) SELECT DISTINCT * FROM MenuPath;
|
||||
</select>
|
||||
|
||||
<select id="downwardRecursionSelect" resultType="com.dite.znpt.domain.entity.MenuEntity">
|
||||
WITH RECURSIVE SubMenus AS (
|
||||
SELECT * FROM menu
|
||||
<where>
|
||||
<choose>
|
||||
<when test="menuId != null and menuId != ''">
|
||||
AND menu_id = #{menuId} -- 起始菜单ID
|
||||
</when>
|
||||
<otherwise>
|
||||
AND parent_id = '0' -- 起始菜单
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
UNION ALL
|
||||
SELECT d.* FROM menu d INNER JOIN SubMenus sd ON d.parent_id = sd.menu_id
|
||||
) SELECT * FROM SubMenus;
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.RoleMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.RoleMenuMapper">
|
||||
|
||||
</mapper>
|
|
@ -7,27 +7,37 @@
|
|||
a.password, a.status
|
||||
</sql>
|
||||
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.UserResp">
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.UserListResp">
|
||||
SELECT
|
||||
u.user_id, u.account, u.avatar, u.status, u.name, u.identity_card, u.gender, u.mobile, u.email, u.hiredate, u.birthdate, u.education, major_field
|
||||
u.user_id, u.account, u.status, u.name, d.dept_name, u.identity_card, u.mobile, u.email, u.hiredate, u.birthdate, GROUP_CONCAT(p.post_name) AS post_name
|
||||
FROM user u
|
||||
LEFT JOIN dept d ON u.dept_id = d.dept_id
|
||||
LEFT JOIN user_post up ON u.user_id = up.user_id
|
||||
LEFT JOIN post p ON up.post_id = p.post_id
|
||||
<where>
|
||||
<if test="account != null and account != ''">
|
||||
AND a.account LIKE concat ('%', #{account}, '%')
|
||||
AND u.account LIKE concat ('%', #{account}, '%')
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND a.name LIKE concat ('%', #{name}, '%')
|
||||
AND u.name LIKE concat ('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="mobile != null and mobile != ''">
|
||||
AND a.mobile LIKE concat ('%', #{mobile}, '%')
|
||||
AND u.mobile LIKE concat ('%', #{mobile}, '%')
|
||||
</if>
|
||||
<if test="email != null and email != ''">
|
||||
AND a.email LIKE concat ('%', #{email}, '%')
|
||||
AND u.email LIKE concat ('%', #{email}, '%')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != ''">
|
||||
AND d.dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="postId != null and postId != ''">
|
||||
AND p.post_id = #{postId}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND a.status = #{status}
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY u.user_id, u.account, u.status, u.name, d.dept_name, u.identity_card, u.mobile, u.email, u.hiredate, u.birthdate
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.UserPostMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.UserRoleMapper">
|
||||
|
||||
</mapper>
|
|
@ -45,11 +45,13 @@ public class CommonController {
|
|||
public Result listDefectType(){
|
||||
return Result.ok(DefectTypeEnum.listAll());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询图像类型", httpMethod = "GET")
|
||||
@GetMapping("/list/image-type")
|
||||
public Result listImageType(){
|
||||
return Result.ok(ImageTypeEnum.listAll());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询项目状态", httpMethod = "GET")
|
||||
@GetMapping("/list/project-status")
|
||||
public Result listProjectStatus(){
|
||||
|
@ -95,12 +97,13 @@ public class CommonController {
|
|||
@ApiOperation(value = "查询学历", httpMethod = "GET")
|
||||
@GetMapping("/list/education")
|
||||
public Result listEducation(){
|
||||
return Result.ok(EducationEnum.list());
|
||||
return Result.ok(EducationEnum.listAll());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询性别", httpMethod = "GET")
|
||||
@GetMapping("/list/gender")
|
||||
public Result listGender(){
|
||||
return Result.ok(GenderEnum.list());
|
||||
return Result.ok(GenderEnum.listAll());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "上传图片", httpMethod = "POST")
|
||||
|
@ -138,4 +141,11 @@ public class CommonController {
|
|||
return Result.ok(imageService.batchUploadCommonImage(imageSource, workReq, files));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询菜单类型", httpMethod = "GET")
|
||||
@GetMapping("/list/menu-type")
|
||||
public Result listMenuType(){
|
||||
return Result.ok(MenuTypeEnum.listAll());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package com.dite.znpt.web.controller;
|
||||
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.vo.MenuReq;
|
||||
import com.dite.znpt.domain.vo.MenuResp;
|
||||
import com.dite.znpt.service.MenuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 15:01
|
||||
* @description
|
||||
*/
|
||||
@Api(tags = "菜单信息")
|
||||
@RestController
|
||||
@RequestMapping("/menu")
|
||||
public class MenuController {
|
||||
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
|
||||
@ApiOperation(value = "查询菜单树", httpMethod = "GET")
|
||||
@GetMapping("/tree")
|
||||
public Result tree (@RequestParam(name = "menuName", required = false) String menuName) {
|
||||
return Result.ok(menuService.tree(menuName));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询菜单详情", httpMethod = "GET")
|
||||
@GetMapping("/detail/{menuId}")
|
||||
public Result<MenuResp> detail(@PathVariable String menuId) {
|
||||
return Result.ok(menuService.detail(menuId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增菜单", httpMethod = "POST")
|
||||
@PostMapping
|
||||
public Result add(@RequestBody MenuReq req) {
|
||||
menuService.save(req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改菜单", httpMethod = "PUT")
|
||||
@PutMapping("/{menuId}")
|
||||
public Result update(@PathVariable String menuId, @RequestBody MenuReq req) {
|
||||
menuService.update(menuId, req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除菜单", httpMethod = "DELETE")
|
||||
@DeleteMapping("/{menuId}")
|
||||
public Result delete(@PathVariable String menuId) {
|
||||
menuService.deleteById(menuId);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.dite.znpt.web.controller;
|
||||
|
||||
import com.dite.znpt.domain.PageResult;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.vo.RoleMenuReq;
|
||||
import com.dite.znpt.domain.vo.RoleReq;
|
||||
import com.dite.znpt.domain.vo.RoleResp;
|
||||
import com.dite.znpt.service.RoleMenuService;
|
||||
import com.dite.znpt.service.RoleService;
|
||||
import com.dite.znpt.service.UserRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/21/周三 15:00
|
||||
* @description
|
||||
*/
|
||||
@Api(tags = "角色信息")
|
||||
@RestController
|
||||
@RequestMapping("/role")
|
||||
public class RoleController {
|
||||
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
|
||||
@Resource
|
||||
private RoleMenuService roleMenuService;
|
||||
|
||||
@ApiOperation(value = "分页查询角色信息列表", httpMethod = "GET")
|
||||
@GetMapping("/page")
|
||||
public PageResult<RoleResp> page(@RequestParam(value = "roleName", required = false) String roleName){
|
||||
return PageResult.ok(roleService.page(roleName));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询角色信息列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public Result<List<RoleResp>> list(@RequestParam(value = "roleName", required = false) String roleName){
|
||||
return Result.ok(roleService.list(roleName));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询角色信息详情", httpMethod = "GET")
|
||||
@GetMapping("/detail/{roleId}")
|
||||
public Result<RoleResp> detail(@PathVariable String roleId){
|
||||
return Result.ok(roleService.detail(roleId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增角色信息", httpMethod = "POST")
|
||||
@PostMapping
|
||||
public Result add(@RequestBody RoleReq req){
|
||||
roleService.save(req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改角色信息", httpMethod = "PUT")
|
||||
@PutMapping("/{roleId}")
|
||||
public Result edit(@PathVariable String roleId, @RequestBody RoleReq req){
|
||||
roleService.update(roleId, req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除角色信息", httpMethod = "DELETE")
|
||||
@DeleteMapping("/{roleId}")
|
||||
public Result delete(@PathVariable String roleId){
|
||||
roleService.deleteById(roleId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "绑定菜单", httpMethod = "PUT")
|
||||
@PutMapping("/bind-menu")
|
||||
public Result bindMenu(@Validated @RequestBody RoleMenuReq req){
|
||||
roleMenuService.bindRoleMenu(req);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
|
@ -1,25 +1,19 @@
|
|||
package com.dite.znpt.web.controller;
|
||||
|
||||
|
||||
import com.dite.znpt.domain.vo.UserListReq;
|
||||
import com.dite.znpt.domain.vo.UserReq;
|
||||
import com.dite.znpt.domain.vo.UserResp;
|
||||
import com.dite.znpt.domain.entity.UserEntity;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import com.dite.znpt.service.RoleService;
|
||||
import com.dite.znpt.service.UserRoleService;
|
||||
import com.dite.znpt.service.UserService;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.PageResult;
|
||||
import com.dite.znpt.util.ValidationGroup;
|
||||
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
|
||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
||||
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -32,16 +26,18 @@ import java.util.List;
|
|||
public class UserController {
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private UserRoleService userRoleService;
|
||||
|
||||
@ApiOperation(value = "分页查询用户信息列表", httpMethod = "GET")
|
||||
@GetMapping("/page")
|
||||
public PageResult<UserResp> page(UserListReq req) {
|
||||
public PageResult<UserListResp> page(UserListReq req) {
|
||||
return PageResult.ok(userService.page(req));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询用户信息列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public PageResult<UserResp> list(UserListReq req) {
|
||||
public PageResult<UserListResp> list(UserListReq req) {
|
||||
return PageResult.ok(userService.list(req));
|
||||
}
|
||||
|
||||
|
@ -64,33 +60,18 @@ public class UserController {
|
|||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "绑定角色", httpMethod = "PUT")
|
||||
@PutMapping("/bind-role")
|
||||
public Result bindRole(@Validated @RequestBody UserRoleReq req){
|
||||
userRoleService.bindUserRole(req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除用户信息", httpMethod = "DELETE")
|
||||
@DeleteMapping("/{userId}")
|
||||
public Result<Object> remove(@PathVariable String userId) {
|
||||
userService.deleteById(userId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出用户信息-需求待明确", httpMethod = "GET")
|
||||
@GetMapping("/export")
|
||||
@ResponseExcel(name = "用户信息")
|
||||
public List<UserResp> export(UserListReq req) {
|
||||
// return userService.selectList(req);
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入用户信息-需求待明确", httpMethod = "POST")
|
||||
@PostMapping("/import")
|
||||
public Result<Object> importData(@RequestExcel List<UserEntity> dataList, BindingResult bindingResult) {
|
||||
// JSR 303 校验通用校验获取失败的数据
|
||||
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
|
||||
// if (errorMessageList != null && !errorMessageList.isEmpty()) {
|
||||
// return Result.error(Constants.SERVICE_EXCEPTION, "导入失败");
|
||||
// }
|
||||
// return Result.okM("导入"+dataList.size()+"条数据");
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue