【新增、修改】1、新增 学生、教师关联关系;2、修改 用户表属性,权限属性
This commit is contained in:
@@ -36,13 +36,17 @@ public class ExamSpecialtyController{
|
|||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获取专业列表")
|
@Operation(summary = "获取专业列表")
|
||||||
public CommonResult<List<SpecialtyQueryVo>> getDeptList(SpecialtListReqVo reqVO) {
|
public CommonResult<List<SpecialtyQueryVo>> getSpecialtyList(SpecialtListReqVo reqVO) {
|
||||||
List<SpecialtyQueryVo> list = examSpecialtyService.selectExamSpecialtyList(reqVO);
|
List<SpecialtyQueryVo> list = examSpecialtyService.selectExamSpecialtyList(reqVO);
|
||||||
return success(BeanUtils.toBean(list, SpecialtyQueryVo.class));
|
return success(BeanUtils.toBean(list, SpecialtyQueryVo.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/part")
|
||||||
|
@Operation(summary = "获取专业列表(不包含题型)")
|
||||||
|
public CommonResult<List<SpecialtyQueryVo>> getSpecialtyPart() {
|
||||||
|
List<SpecialtyQueryVo> list = examSpecialtyService.selectExamSpecialtyPart();
|
||||||
|
return success(BeanUtils.toBean(list, SpecialtyQueryVo.class));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 获取全部数据详细信息
|
* 获取全部数据详细信息
|
||||||
*/
|
*/
|
||||||
|
@@ -40,6 +40,13 @@ public interface ExamSpecialtyMapper extends BaseMapperX<ExamSpecialty>
|
|||||||
*/
|
*/
|
||||||
public List<SpecialtyQueryVo> selectExamSpecialtyListVo(SpecialtListReqVo reqVo);
|
public List<SpecialtyQueryVo> selectExamSpecialtyListVo(SpecialtListReqVo reqVo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部分数据信息
|
||||||
|
*
|
||||||
|
* @return 数据集合
|
||||||
|
*/
|
||||||
|
public List<SpecialtyQueryVo> selectExamSpecialtyPart();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据信息列表
|
* 查询数据信息列表
|
||||||
*
|
*
|
||||||
@@ -71,4 +78,6 @@ public interface ExamSpecialtyMapper extends BaseMapperX<ExamSpecialty>
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteExamSpecialtyBySpIds(Long[] spIds);
|
public int deleteExamSpecialtyBySpIds(Long[] spIds);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,13 @@ public interface ExamSpecialtyService
|
|||||||
*/
|
*/
|
||||||
public List<SpecialtyQueryVo> selectExamSpecialtyList(SpecialtListReqVo reqVO);
|
public List<SpecialtyQueryVo> selectExamSpecialtyList(SpecialtListReqVo reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部分数据信息
|
||||||
|
*
|
||||||
|
* @return 全部信息集合
|
||||||
|
*/
|
||||||
|
public List<SpecialtyQueryVo> selectExamSpecialtyPart();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主键查询
|
* 根据主键查询
|
||||||
*
|
*
|
||||||
|
@@ -46,6 +46,11 @@ public class ExamSpecialtyServiceImpl implements ExamSpecialtyService {
|
|||||||
return examSpecialtyMapper.selectExamSpecialtyListVo(reqVo);
|
return examSpecialtyMapper.selectExamSpecialtyListVo(reqVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SpecialtyQueryVo> selectExamSpecialtyPart() {
|
||||||
|
return examSpecialtyMapper.selectExamSpecialtyPart();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主键列表查询
|
* 根据主键列表查询
|
||||||
*
|
*
|
||||||
|
@@ -28,6 +28,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectExamSpecialtyPart" resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
|
||||||
|
select sp_id as id, sp_name as name, parent_id, status, create_time
|
||||||
|
FROM exam_specialty
|
||||||
|
WHERE
|
||||||
|
(
|
||||||
|
LENGTH(ancestors) - LENGTH(REPLACE(ancestors, ',', ''))
|
||||||
|
) + 1 <= 2 and status = 0 and deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectExamSpecialtyList" resultType="ExamSpecialty">
|
<select id="selectExamSpecialtyList" resultType="ExamSpecialty">
|
||||||
<include refid="selectExamSpecialtyVo"/>
|
<include refid="selectExamSpecialtyVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
@@ -166,4 +166,10 @@ public interface ErrorCodeConstants {
|
|||||||
// ========== 站内信发送 1-002-028-000 ==========
|
// ========== 站内信发送 1-002-028-000 ==========
|
||||||
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "模板参数({})缺失");
|
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "模板参数({})缺失");
|
||||||
|
|
||||||
|
// ========== 学生相关 1-002-029-000 ==========
|
||||||
|
ErrorCode STUDENT_NOT_EXISTS = new ErrorCode(1_002_029_000, "没有学生信息");
|
||||||
|
ErrorCode CLASS_NOT_EXISTS = new ErrorCode(1_002_029_001, "没有学生班级信息");
|
||||||
|
ErrorCode STUDENT_USERNAME_LOGIN = new ErrorCode(1_002_029_002, "学生账号无法登陆!");
|
||||||
|
ErrorCode STUDENT_USERNAME_NOTLOGIN = new ErrorCode(1_002_029_003, "非学生账号无法登陆!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -125,6 +125,12 @@
|
|||||||
<groupId>org.dromara.hutool</groupId>
|
<groupId>org.dromara.hutool</groupId>
|
||||||
<artifactId>hutool-extra</artifactId> <!-- 邮件 -->
|
<artifactId>hutool-extra</artifactId> <!-- 邮件 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>pc.exam.gg</groupId>
|
||||||
|
<artifactId>exam-module-exam-biz</artifactId>
|
||||||
|
<version>2.4.2-SNAPSHOT</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@@ -35,9 +35,13 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static pc.exam.pp.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static pc.exam.pp.framework.common.pojo.CommonResult.error;
|
||||||
import static pc.exam.pp.framework.common.pojo.CommonResult.success;
|
import static pc.exam.pp.framework.common.pojo.CommonResult.success;
|
||||||
import static pc.exam.pp.framework.common.util.collection.CollectionUtils.convertSet;
|
import static pc.exam.pp.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
import static pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
import static pc.exam.pp.module.system.enums.ErrorCodeConstants.STUDENT_USERNAME_LOGIN;
|
||||||
|
import static pc.exam.pp.module.system.enums.ErrorCodeConstants.STUDENT_USERNAME_NOTLOGIN;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 认证")
|
@Tag(name = "管理后台 - 认证")
|
||||||
@RestController
|
@RestController
|
||||||
@@ -66,6 +70,15 @@ public class AuthController {
|
|||||||
@PermitAll
|
@PermitAll
|
||||||
@Operation(summary = "使用账号密码登录")
|
@Operation(summary = "使用账号密码登录")
|
||||||
public CommonResult<AuthLoginRespVO> login(@RequestBody @Valid AuthLoginReqVO reqVO) {
|
public CommonResult<AuthLoginRespVO> login(@RequestBody @Valid AuthLoginReqVO reqVO) {
|
||||||
|
// 判断账号类型
|
||||||
|
AdminUserDO adminUserDO = userService.getUserByUsername(reqVO.getUsername());
|
||||||
|
// 登陆非学生端,0,1
|
||||||
|
if (Integer.parseInt(reqVO.getUserType()) <= 1) {
|
||||||
|
if (Integer.parseInt(adminUserDO.getUserType()) == 2) return error(STUDENT_USERNAME_LOGIN);
|
||||||
|
}
|
||||||
|
if (Integer.parseInt(reqVO.getUserType()) == 2) {
|
||||||
|
if (Integer.parseInt(adminUserDO.getUserType()) <= 1) return error(STUDENT_USERNAME_NOTLOGIN);
|
||||||
|
}
|
||||||
return success(authService.login(reqVO));
|
return success(authService.login(reqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,6 +41,9 @@ public class AuthLoginReqVO extends CaptchaVerificationReqVO {
|
|||||||
@Schema(description = "授权码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
@Schema(description = "授权码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
private String socialCode;
|
private String socialCode;
|
||||||
|
|
||||||
|
@Schema(description = "用户类型")
|
||||||
|
private String userType;
|
||||||
|
|
||||||
@Schema(description = "state", requiredMode = Schema.RequiredMode.REQUIRED, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
|
@Schema(description = "state", requiredMode = Schema.RequiredMode.REQUIRED, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
|
||||||
private String socialState;
|
private String socialState;
|
||||||
|
|
||||||
|
@@ -43,6 +43,13 @@ public class PermissionController {
|
|||||||
return success(permissionService.getRoleMenuListByRoleId(roleId));
|
return success(permissionService.getRoleMenuListByRoleId(roleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获得教师拥有的专业编号")
|
||||||
|
@Parameter(name = "teacherId", description = "专业编号", required = true)
|
||||||
|
@GetMapping("/list-teacher-specialty")
|
||||||
|
public CommonResult<Set<Long>> getTeaacherSpecoaltyList(Long teacherId) {
|
||||||
|
return success(permissionService.getSpecialtyListByTeacherId(teacherId));
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/assign-role-menu")
|
@PostMapping("/assign-role-menu")
|
||||||
@Operation(summary = "赋予角色菜单")
|
@Operation(summary = "赋予角色菜单")
|
||||||
@PreAuthorize("@ss.hasPermission('system:permission:assign-role-menu')")
|
@PreAuthorize("@ss.hasPermission('system:permission:assign-role-menu')")
|
||||||
|
@@ -7,6 +7,8 @@ import pc.exam.pp.framework.common.pojo.CommonResult;
|
|||||||
import pc.exam.pp.framework.common.pojo.PageParam;
|
import pc.exam.pp.framework.common.pojo.PageParam;
|
||||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||||
import pc.exam.pp.framework.excel.core.util.ExcelUtils;
|
import pc.exam.pp.framework.excel.core.util.ExcelUtils;
|
||||||
|
import pc.exam.pp.module.exam.dal.dataobject.classs.ClassDO;
|
||||||
|
import pc.exam.pp.module.exam.service.classs.ClassService;
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.*;
|
import pc.exam.pp.module.system.controller.admin.user.vo.user.*;
|
||||||
import pc.exam.pp.module.system.convert.user.UserConvert;
|
import pc.exam.pp.module.system.convert.user.UserConvert;
|
||||||
import pc.exam.pp.module.system.dal.dataobject.dept.DeptDO;
|
import pc.exam.pp.module.system.dal.dataobject.dept.DeptDO;
|
||||||
@@ -44,6 +46,8 @@ public class UserController {
|
|||||||
@Resource
|
@Resource
|
||||||
private AdminUserService userService;
|
private AdminUserService userService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private ClassService classService;
|
||||||
|
@Resource
|
||||||
private DeptService deptService;
|
private DeptService deptService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@@ -54,6 +58,20 @@ public class UserController {
|
|||||||
return success(id);
|
return success(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/createStudent")
|
||||||
|
@Operation(summary = "新增用户学生用户")
|
||||||
|
public CommonResult<Long> createUserStudent(@Valid @RequestBody UserSaveReqVO reqVO) {
|
||||||
|
Long id = userService.createUserStudent(reqVO);
|
||||||
|
return success(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/createTeacher")
|
||||||
|
@Operation(summary = "新增用户教师用户")
|
||||||
|
public CommonResult<Long> createUserTeacher(@Valid @RequestBody UserSaveReqVO reqVO) {
|
||||||
|
Long id = userService.createUserTeacher(reqVO);
|
||||||
|
return success(id);
|
||||||
|
}
|
||||||
|
|
||||||
@PutMapping("update")
|
@PutMapping("update")
|
||||||
@Operation(summary = "修改用户")
|
@Operation(summary = "修改用户")
|
||||||
@PreAuthorize("@ss.hasPermission('system:user:update')")
|
@PreAuthorize("@ss.hasPermission('system:user:update')")
|
||||||
@@ -62,6 +80,21 @@ public class UserController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("updateStudent")
|
||||||
|
@Operation(summary = "修改用户 学生")
|
||||||
|
public CommonResult<Boolean> updateStudent(@Valid @RequestBody UserSaveReqVO reqVO) {
|
||||||
|
userService.updateStudent(reqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("updateTeacher")
|
||||||
|
@Operation(summary = "修改用户 教师")
|
||||||
|
public CommonResult<Boolean> updateTeacher(@Valid @RequestBody UserSaveReqVO reqVO) {
|
||||||
|
userService.updateTeacher(reqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除用户")
|
@Operation(summary = "删除用户")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@@ -103,6 +136,22 @@ public class UserController {
|
|||||||
pageResult.getTotal()));
|
pageResult.getTotal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/studentpage")
|
||||||
|
@Operation(summary = "获得学生分页列表")
|
||||||
|
public CommonResult<PageResult<UserRespVO>> getStudentPage(@Valid UserPageReqVO pageReqVO) {
|
||||||
|
// 获得用户分页列表
|
||||||
|
PageResult<AdminUserDO> pageResult = userService.getStudentPage(pageReqVO);
|
||||||
|
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||||
|
return success(new PageResult<>(pageResult.getTotal()));
|
||||||
|
}
|
||||||
|
// 拼接数据 班级数据
|
||||||
|
// 拼接数据
|
||||||
|
Map<Long, ClassDO> classDOMap = classService.getClassMap(
|
||||||
|
convertList(pageResult.getList(), AdminUserDO::getClassId));
|
||||||
|
return success(new PageResult<>(UserConvert.INSTANCE.convertClassList(pageResult.getList(), classDOMap),
|
||||||
|
pageResult.getTotal()));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping({"/list-all-simple", "/simple-list"})
|
@GetMapping({"/list-all-simple", "/simple-list"})
|
||||||
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
|
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
|
||||||
public CommonResult<List<UserSimpleRespVO>> getSimpleUserList() {
|
public CommonResult<List<UserSimpleRespVO>> getSimpleUserList() {
|
||||||
@@ -124,8 +173,22 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
// 拼接数据
|
// 拼接数据
|
||||||
DeptDO dept = deptService.getDept(user.getDeptId());
|
DeptDO dept = deptService.getDept(user.getDeptId());
|
||||||
|
// 学生-拼接班级数据
|
||||||
|
if (user.getUserType().equals("2")) {
|
||||||
|
ClassDO classDO = classService.getClass(user.getClassId());
|
||||||
|
return success(UserConvert.INSTANCE.convertClass(user, dept, classDO));
|
||||||
|
}
|
||||||
return success(UserConvert.INSTANCE.convert(user, dept));
|
return success(UserConvert.INSTANCE.convert(user, dept));
|
||||||
}
|
}
|
||||||
|
@GetMapping("/getByThId")
|
||||||
|
@Operation(summary = "通过教师ID获取所有学生数据")
|
||||||
|
public CommonResult<List<UserRespVO>> getUserById(@RequestParam("id") Long id) {
|
||||||
|
List<UserRespVO> user = userService.getUserById(id);
|
||||||
|
if (user == null) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
|
return success(user);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
@Operation(summary = "导出用户")
|
@Operation(summary = "导出用户")
|
||||||
|
@@ -38,4 +38,10 @@ public class UserPageReqVO extends PageParam {
|
|||||||
@Schema(description = "角色编号", example = "1024")
|
@Schema(description = "角色编号", example = "1024")
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
|
@Schema(description = "类型")
|
||||||
|
private String userType;
|
||||||
|
|
||||||
|
@Schema(description = "班级")
|
||||||
|
private String className;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,11 +28,16 @@ public class UserRespVO{
|
|||||||
@ExcelProperty("用户昵称")
|
@ExcelProperty("用户昵称")
|
||||||
private String nickname;
|
private String nickname;
|
||||||
|
|
||||||
|
@Schema(description = "班级名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||||
|
@ExcelProperty("班级名称")
|
||||||
|
private String className;
|
||||||
|
|
||||||
@Schema(description = "备注", example = "我是一个用户")
|
@Schema(description = "备注", example = "我是一个用户")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Schema(description = "部门ID", example = "我是一个用户")
|
@Schema(description = "部门ID", example = "我是一个用户")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
@Schema(description = "部门名称", example = "IT 部")
|
@Schema(description = "部门名称", example = "IT 部")
|
||||||
@ExcelProperty("部门名称")
|
@ExcelProperty("部门名称")
|
||||||
private String deptName;
|
private String deptName;
|
||||||
@@ -40,6 +45,9 @@ public class UserRespVO{
|
|||||||
@Schema(description = "岗位编号数组", example = "1")
|
@Schema(description = "岗位编号数组", example = "1")
|
||||||
private Set<Long> postIds;
|
private Set<Long> postIds;
|
||||||
|
|
||||||
|
@Schema(description = "班级编号数组", example = "1")
|
||||||
|
private Set<Long> classIds;
|
||||||
|
|
||||||
@Schema(description = "用户邮箱", example = "exam@iocoder.cn")
|
@Schema(description = "用户邮箱", example = "exam@iocoder.cn")
|
||||||
@ExcelProperty("用户邮箱")
|
@ExcelProperty("用户邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
@@ -41,10 +41,22 @@ public class UserSaveReqVO {
|
|||||||
@DiffLogField(name = "部门", function = DeptParseFunction.NAME)
|
@DiffLogField(name = "部门", function = DeptParseFunction.NAME)
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
|
@Schema(description = "班级编号", example = "我是一个用户")
|
||||||
|
@DiffLogField(name = "班级", function = DeptParseFunction.NAME)
|
||||||
|
private String className;
|
||||||
|
|
||||||
@Schema(description = "岗位编号数组", example = "1")
|
@Schema(description = "岗位编号数组", example = "1")
|
||||||
@DiffLogField(name = "岗位", function = PostParseFunction.NAME)
|
@DiffLogField(name = "岗位", function = PostParseFunction.NAME)
|
||||||
private Set<Long> postIds;
|
private Set<Long> postIds;
|
||||||
|
|
||||||
|
@Schema(description = "班级编号数组", example = "1")
|
||||||
|
@DiffLogField(name = "班级", function = PostParseFunction.NAME)
|
||||||
|
private Set<Long> classIds;
|
||||||
|
|
||||||
|
@Schema(description = "专业编号数组", example = "1")
|
||||||
|
@DiffLogField(name = "专业", function = PostParseFunction.NAME)
|
||||||
|
private Set<Long> specialtyIds;
|
||||||
|
|
||||||
@Schema(description = "用户邮箱", example = "exam@iocoder.cn")
|
@Schema(description = "用户邮箱", example = "exam@iocoder.cn")
|
||||||
@Email(message = "邮箱格式不正确")
|
@Email(message = "邮箱格式不正确")
|
||||||
@Size(max = 50, message = "邮箱长度不能超过 50 个字符")
|
@Size(max = 50, message = "邮箱长度不能超过 50 个字符")
|
||||||
@@ -56,6 +68,9 @@ public class UserSaveReqVO {
|
|||||||
@DiffLogField(name = "手机号码")
|
@DiffLogField(name = "手机号码")
|
||||||
private String mobile;
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "用户类型", example = "1")
|
||||||
|
private String userType;
|
||||||
|
|
||||||
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
||||||
@DiffLogField(name = "用户性别", function = SexParseFunction.NAME)
|
@DiffLogField(name = "用户性别", function = SexParseFunction.NAME)
|
||||||
private Integer sex;
|
private Integer sex;
|
||||||
|
@@ -3,6 +3,7 @@ package pc.exam.pp.module.system.convert.user;
|
|||||||
import pc.exam.pp.framework.common.util.collection.CollectionUtils;
|
import pc.exam.pp.framework.common.util.collection.CollectionUtils;
|
||||||
import pc.exam.pp.framework.common.util.collection.MapUtils;
|
import pc.exam.pp.framework.common.util.collection.MapUtils;
|
||||||
import pc.exam.pp.framework.common.util.object.BeanUtils;
|
import pc.exam.pp.framework.common.util.object.BeanUtils;
|
||||||
|
import pc.exam.pp.module.exam.dal.dataobject.classs.ClassDO;
|
||||||
import pc.exam.pp.module.system.controller.admin.dept.vo.dept.DeptSimpleRespVO;
|
import pc.exam.pp.module.system.controller.admin.dept.vo.dept.DeptSimpleRespVO;
|
||||||
import pc.exam.pp.module.system.controller.admin.dept.vo.post.PostSimpleRespVO;
|
import pc.exam.pp.module.system.controller.admin.dept.vo.post.PostSimpleRespVO;
|
||||||
import pc.exam.pp.module.system.controller.admin.permission.vo.role.RoleSimpleRespVO;
|
import pc.exam.pp.module.system.controller.admin.permission.vo.role.RoleSimpleRespVO;
|
||||||
@@ -29,6 +30,10 @@ public interface UserConvert {
|
|||||||
return CollectionUtils.convertList(list, user -> convert(user, deptMap.get(user.getDeptId())));
|
return CollectionUtils.convertList(list, user -> convert(user, deptMap.get(user.getDeptId())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<UserRespVO> convertClassList(List<AdminUserDO> list, Map<Long, ClassDO> classDOMap) {
|
||||||
|
return CollectionUtils.convertList(list, user -> convertOneClass(user, classDOMap.get(user.getClassId())));
|
||||||
|
}
|
||||||
|
|
||||||
default UserRespVO convert(AdminUserDO user, DeptDO dept) {
|
default UserRespVO convert(AdminUserDO user, DeptDO dept) {
|
||||||
UserRespVO userVO = BeanUtils.toBean(user, UserRespVO.class);
|
UserRespVO userVO = BeanUtils.toBean(user, UserRespVO.class);
|
||||||
if (dept != null) {
|
if (dept != null) {
|
||||||
@@ -36,6 +41,20 @@ public interface UserConvert {
|
|||||||
}
|
}
|
||||||
return userVO;
|
return userVO;
|
||||||
}
|
}
|
||||||
|
default UserRespVO convertOneClass(AdminUserDO user, ClassDO classDO) {
|
||||||
|
UserRespVO userVO = BeanUtils.toBean(user, UserRespVO.class);
|
||||||
|
userVO.setClassName(classDO.getName());
|
||||||
|
return userVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
default UserRespVO convertClass(AdminUserDO user, DeptDO dept, ClassDO classDO) {
|
||||||
|
UserRespVO userVO = BeanUtils.toBean(user, UserRespVO.class);
|
||||||
|
userVO.setClassName(classDO.getName());
|
||||||
|
if (dept != null) {
|
||||||
|
userVO.setDeptName(dept.getName());
|
||||||
|
}
|
||||||
|
return userVO;
|
||||||
|
}
|
||||||
|
|
||||||
default List<UserSimpleRespVO> convertSimpleList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap) {
|
default List<UserSimpleRespVO> convertSimpleList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap) {
|
||||||
return CollectionUtils.convertList(list, user -> {
|
return CollectionUtils.convertList(list, user -> {
|
||||||
|
@@ -55,11 +55,33 @@ public class AdminUserDO extends TenantBaseDO {
|
|||||||
* 部门 ID
|
* 部门 ID
|
||||||
*/
|
*/
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
/**
|
||||||
|
* 班级 ID
|
||||||
|
*/
|
||||||
|
private Long classId;
|
||||||
/**
|
/**
|
||||||
* 岗位编号数组
|
* 岗位编号数组
|
||||||
*/
|
*/
|
||||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private Set<Long> postIds;
|
private Set<Long> postIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 班级编号数组
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
|
private Set<Long> classIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 专业编号数组
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
|
private Set<Long> specialtyIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户类型
|
||||||
|
*/
|
||||||
|
private String userType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户邮箱
|
* 用户邮箱
|
||||||
*/
|
*/
|
||||||
@@ -93,4 +115,6 @@ public class AdminUserDO extends TenantBaseDO {
|
|||||||
*/
|
*/
|
||||||
private LocalDateTime loginDate;
|
private LocalDateTime loginDate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,40 @@
|
|||||||
|
package pc.exam.pp.module.system.dal.dataobject.user;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import pc.exam.pp.module.exam.dal.dataobject.classs.ClassDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教师班级关联
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@TableName("system_teacher_class")
|
||||||
|
@KeySequence("system_teacher_class_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class TeacherClassDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自增主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户 ID
|
||||||
|
*
|
||||||
|
* 关联 {@link AdminUserDO#getId()}
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 角色 ID
|
||||||
|
*
|
||||||
|
* 关联 {@link ClassDO#getId()}
|
||||||
|
*/
|
||||||
|
private Long classId;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
package pc.exam.pp.module.system.dal.dataobject.user;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import pc.exam.pp.module.exam.dal.dataobject.classs.ClassDO;
|
||||||
|
import pc.exam.pp.module.exam.dal.dataobject.specialty.ExamSpecialty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教师专业关联
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@TableName("system_teacher_specialty")
|
||||||
|
@KeySequence("system_teacher_specialty_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class TeacherSpecialtyDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自增主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户 ID
|
||||||
|
*
|
||||||
|
* 关联 {@link AdminUserDO#getId()}
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 角色 ID
|
||||||
|
*
|
||||||
|
* 关联 {@link ExamSpecialty#getSpId()}
|
||||||
|
*/
|
||||||
|
private Long specialtyId;
|
||||||
|
|
||||||
|
}
|
@@ -1,9 +1,15 @@
|
|||||||
package pc.exam.pp.module.system.dal.mysql.user;
|
package pc.exam.pp.module.system.dal.mysql.user;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||||
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
|
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import pc.exam.pp.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||||
|
import pc.exam.pp.module.exam.controller.admin.student.vo.StudentPageReqVO;
|
||||||
|
import pc.exam.pp.module.exam.dal.dataobject.student.StudentClassDO;
|
||||||
|
import pc.exam.pp.module.exam.dal.dataobject.student.StudentDO;
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||||
|
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserRespVO;
|
||||||
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
|
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@@ -29,6 +35,20 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
|||||||
return selectPage(reqVO, new LambdaQueryWrapperX<AdminUserDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<AdminUserDO>()
|
||||||
.likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername())
|
.likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername())
|
||||||
.likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile())
|
.likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile())
|
||||||
|
.eq(AdminUserDO::getUserType, reqVO.getUserType())
|
||||||
|
.eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus())
|
||||||
|
.betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.inIfPresent(AdminUserDO::getDeptId, deptIds)
|
||||||
|
.inIfPresent(AdminUserDO::getId, userIds)
|
||||||
|
.orderByDesc(AdminUserDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default PageResult<AdminUserDO> selectStuPage(UserPageReqVO reqVO, Collection<Long> deptIds, Collection<Long> userIds, Long classId) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<AdminUserDO>()
|
||||||
|
.likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername())
|
||||||
|
.likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile())
|
||||||
|
.eq(AdminUserDO::getUserType, reqVO.getUserType())
|
||||||
|
.eqIfPresent(AdminUserDO::getClassId, classId)
|
||||||
.eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus())
|
.eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus())
|
||||||
.betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.inIfPresent(AdminUserDO::getDeptId, deptIds)
|
.inIfPresent(AdminUserDO::getDeptId, deptIds)
|
||||||
@@ -48,4 +68,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
|||||||
return selectList(AdminUserDO::getDeptId, deptIds);
|
return selectList(AdminUserDO::getDeptId, deptIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<UserRespVO> selectUserByIdList(@Param("id") Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,24 @@
|
|||||||
|
package pc.exam.pp.module.system.dal.mysql.user;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import pc.exam.pp.module.system.dal.dataobject.dept.UserPostDO;
|
||||||
|
import pc.exam.pp.module.system.dal.dataobject.user.TeacherClassDO;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TeacherClassMapper extends BaseMapperX<TeacherClassDO> {
|
||||||
|
|
||||||
|
default List<TeacherClassDO> selectListByUserId(Long userId) {
|
||||||
|
return selectList(TeacherClassDO::getUserId, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
default void deleteByUserIdAndTeacherId(Long userId, Collection<Long> classIds) {
|
||||||
|
delete(new LambdaQueryWrapperX<TeacherClassDO>()
|
||||||
|
.eq(TeacherClassDO::getUserId, userId)
|
||||||
|
.in(TeacherClassDO::getClassId, classIds));
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,29 @@
|
|||||||
|
package pc.exam.pp.module.system.dal.mysql.user;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import pc.exam.pp.module.system.dal.dataobject.permission.RoleMenuDO;
|
||||||
|
import pc.exam.pp.module.system.dal.dataobject.user.TeacherClassDO;
|
||||||
|
import pc.exam.pp.module.system.dal.dataobject.user.TeacherSpecialtyDO;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TeacherSpecialtyMapper extends BaseMapperX<TeacherSpecialtyDO> {
|
||||||
|
|
||||||
|
default List<TeacherSpecialtyDO> selectListByTeacherId(Collection<Long> teacherIds) {
|
||||||
|
return selectList(TeacherSpecialtyDO::getUserId, teacherIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<TeacherSpecialtyDO> selectListByUserId(Long userId) {
|
||||||
|
return selectList(TeacherSpecialtyDO::getUserId, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
default void deleteByUserIdAndSpecialtyId(Long userId, Collection<Long> specialtyIds) {
|
||||||
|
delete(new LambdaQueryWrapperX<TeacherSpecialtyDO>()
|
||||||
|
.eq(TeacherSpecialtyDO::getUserId, userId)
|
||||||
|
.in(TeacherSpecialtyDO::getSpecialtyId, specialtyIds));
|
||||||
|
}
|
||||||
|
}
|
@@ -67,6 +67,16 @@ public interface PermissionService {
|
|||||||
return getRoleMenuListByRoleId(singleton(roleId));
|
return getRoleMenuListByRoleId(singleton(roleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得教师拥有的专业编号集合
|
||||||
|
*
|
||||||
|
* @param teacherId 教师ID
|
||||||
|
* @return 专业编号集合
|
||||||
|
*/
|
||||||
|
default Set<Long> getSpecialtyListByTeacherId(Long teacherId) {
|
||||||
|
return getSpecialtyListByTeacherId(singleton(teacherId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得角色们拥有的菜单编号集合
|
* 获得角色们拥有的菜单编号集合
|
||||||
*
|
*
|
||||||
@@ -75,6 +85,14 @@ public interface PermissionService {
|
|||||||
*/
|
*/
|
||||||
Set<Long> getRoleMenuListByRoleId(Collection<Long> roleIds);
|
Set<Long> getRoleMenuListByRoleId(Collection<Long> roleIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得教师们拥有的专业编号集合
|
||||||
|
*
|
||||||
|
* @param teacherIds 专业编号数组
|
||||||
|
* @return 专业编号集合
|
||||||
|
*/
|
||||||
|
Set<Long> getSpecialtyListByTeacherId(Collection<Long> teacherIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得拥有指定菜单的角色编号数组,从缓存中获取
|
* 获得拥有指定菜单的角色编号数组,从缓存中获取
|
||||||
*
|
*
|
||||||
|
@@ -12,8 +12,10 @@ import pc.exam.pp.module.system.dal.dataobject.permission.MenuDO;
|
|||||||
import pc.exam.pp.module.system.dal.dataobject.permission.RoleDO;
|
import pc.exam.pp.module.system.dal.dataobject.permission.RoleDO;
|
||||||
import pc.exam.pp.module.system.dal.dataobject.permission.RoleMenuDO;
|
import pc.exam.pp.module.system.dal.dataobject.permission.RoleMenuDO;
|
||||||
import pc.exam.pp.module.system.dal.dataobject.permission.UserRoleDO;
|
import pc.exam.pp.module.system.dal.dataobject.permission.UserRoleDO;
|
||||||
|
import pc.exam.pp.module.system.dal.dataobject.user.TeacherSpecialtyDO;
|
||||||
import pc.exam.pp.module.system.dal.mysql.permission.RoleMenuMapper;
|
import pc.exam.pp.module.system.dal.mysql.permission.RoleMenuMapper;
|
||||||
import pc.exam.pp.module.system.dal.mysql.permission.UserRoleMapper;
|
import pc.exam.pp.module.system.dal.mysql.permission.UserRoleMapper;
|
||||||
|
import pc.exam.pp.module.system.dal.mysql.user.TeacherSpecialtyMapper;
|
||||||
import pc.exam.pp.module.system.dal.redis.RedisKeyConstants;
|
import pc.exam.pp.module.system.dal.redis.RedisKeyConstants;
|
||||||
import pc.exam.pp.module.system.enums.permission.DataScopeEnum;
|
import pc.exam.pp.module.system.enums.permission.DataScopeEnum;
|
||||||
import pc.exam.pp.module.system.service.dept.DeptService;
|
import pc.exam.pp.module.system.service.dept.DeptService;
|
||||||
@@ -48,6 +50,8 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
@Resource
|
@Resource
|
||||||
private RoleMenuMapper roleMenuMapper;
|
private RoleMenuMapper roleMenuMapper;
|
||||||
@Resource
|
@Resource
|
||||||
|
private TeacherSpecialtyMapper teacherSpecialtyMapper;
|
||||||
|
@Resource
|
||||||
private UserRoleMapper userRoleMapper;
|
private UserRoleMapper userRoleMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -193,6 +197,21 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
// 如果是非管理员的情况下,获得拥有的菜单编号
|
// 如果是非管理员的情况下,获得拥有的菜单编号
|
||||||
return convertSet(roleMenuMapper.selectListByRoleId(roleIds), RoleMenuDO::getMenuId);
|
return convertSet(roleMenuMapper.selectListByRoleId(roleIds), RoleMenuDO::getMenuId);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public Set<Long> getSpecialtyListByTeacherId(Collection<Long> teacherIds) {
|
||||||
|
if (CollUtil.isEmpty(teacherIds)) {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果是管理员的情况下,获取全部菜单编号
|
||||||
|
// if (roleService.hasAnySuperAdmin(teacherIds)) {
|
||||||
|
// return convertSet(menuService.getMenuList(), MenuDO::getId);
|
||||||
|
// }
|
||||||
|
// userService.getUserList(teacherIds);
|
||||||
|
// 如果是非管理员的情况下,获得拥有的菜单编号
|
||||||
|
return convertSet(teacherSpecialtyMapper.selectListByTeacherId(teacherIds), TeacherSpecialtyDO::getSpecialtyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(value = RedisKeyConstants.MENU_ROLE_ID_LIST, key = "#menuId")
|
@Cacheable(value = RedisKeyConstants.MENU_ROLE_ID_LIST, key = "#menuId")
|
||||||
|
@@ -230,6 +230,7 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validateRoleList(Collection<Long> ids) {
|
public void validateRoleList(Collection<Long> ids) {
|
||||||
if (CollUtil.isEmpty(ids)) {
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
@@ -6,10 +6,7 @@ import pc.exam.pp.framework.common.util.collection.CollectionUtils;
|
|||||||
import pc.exam.pp.module.system.controller.admin.auth.vo.AuthRegisterReqVO;
|
import pc.exam.pp.module.system.controller.admin.auth.vo.AuthRegisterReqVO;
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
|
import pc.exam.pp.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
|
import pc.exam.pp.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserImportExcelVO;
|
import pc.exam.pp.module.system.controller.admin.user.vo.user.*;
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserImportRespVO;
|
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
|
||||||
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
|
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
@@ -33,6 +30,22 @@ public interface AdminUserService {
|
|||||||
* @return 用户编号
|
* @return 用户编号
|
||||||
*/
|
*/
|
||||||
Long createUser(@Valid UserSaveReqVO createReqVO);
|
Long createUser(@Valid UserSaveReqVO createReqVO);
|
||||||
|
/**
|
||||||
|
* 创建用户 学生
|
||||||
|
*
|
||||||
|
* @param createReqVO 用户信息 学生
|
||||||
|
* @return 用户编号 学生
|
||||||
|
*/
|
||||||
|
Long createUserStudent(@Valid UserSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户 教师
|
||||||
|
*
|
||||||
|
* @param createReqVO 用户信息 学生
|
||||||
|
* @return 用户编号 学生
|
||||||
|
*/
|
||||||
|
Long createUserTeacher(@Valid UserSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册用户
|
* 注册用户
|
||||||
@@ -49,6 +62,19 @@ public interface AdminUserService {
|
|||||||
*/
|
*/
|
||||||
void updateUser(@Valid UserSaveReqVO updateReqVO);
|
void updateUser(@Valid UserSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户 学生
|
||||||
|
*
|
||||||
|
* @param updateReqVO 用户信息
|
||||||
|
*/
|
||||||
|
void updateStudent(@Valid UserSaveReqVO updateReqVO);
|
||||||
|
/**
|
||||||
|
* 修改用户 教师
|
||||||
|
*
|
||||||
|
* @param updateReqVO 教师信息
|
||||||
|
*/
|
||||||
|
void updateTeacher(@Valid UserSaveReqVO updateReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新用户的最后登陆信息
|
* 更新用户的最后登陆信息
|
||||||
*
|
*
|
||||||
@@ -128,6 +154,14 @@ public interface AdminUserService {
|
|||||||
*/
|
*/
|
||||||
PageResult<AdminUserDO> getUserPage(UserPageReqVO reqVO);
|
PageResult<AdminUserDO> getUserPage(UserPageReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得学生分页列表
|
||||||
|
*
|
||||||
|
* @param reqVO 分页条件
|
||||||
|
* @return 分页列表
|
||||||
|
*/
|
||||||
|
PageResult<AdminUserDO> getStudentPage(UserPageReqVO reqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户 ID 查询用户
|
* 通过用户 ID 查询用户
|
||||||
*
|
*
|
||||||
@@ -136,6 +170,13 @@ public interface AdminUserService {
|
|||||||
*/
|
*/
|
||||||
AdminUserDO getUser(Long id);
|
AdminUserDO getUser(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过教师 ID 查询学生列表
|
||||||
|
*
|
||||||
|
* @param id 教师 ID
|
||||||
|
* @return 学生列表
|
||||||
|
*/
|
||||||
|
List<UserRespVO> getUserById(Long id);
|
||||||
/**
|
/**
|
||||||
* 获得指定部门的用户数组
|
* 获得指定部门的用户数组
|
||||||
*
|
*
|
||||||
|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import org.bouncycastle.jcajce.provider.symmetric.TEA;
|
||||||
import pc.exam.pp.framework.common.enums.CommonStatusEnum;
|
import pc.exam.pp.framework.common.enums.CommonStatusEnum;
|
||||||
import pc.exam.pp.framework.common.exception.ServiceException;
|
import pc.exam.pp.framework.common.exception.ServiceException;
|
||||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||||
@@ -11,20 +12,25 @@ import pc.exam.pp.framework.common.util.collection.CollectionUtils;
|
|||||||
import pc.exam.pp.framework.common.util.object.BeanUtils;
|
import pc.exam.pp.framework.common.util.object.BeanUtils;
|
||||||
import pc.exam.pp.framework.common.util.validation.ValidationUtils;
|
import pc.exam.pp.framework.common.util.validation.ValidationUtils;
|
||||||
import pc.exam.pp.framework.datapermission.core.util.DataPermissionUtils;
|
import pc.exam.pp.framework.datapermission.core.util.DataPermissionUtils;
|
||||||
|
import pc.exam.pp.module.exam.controller.admin.classs.vo.ClassSaveReqVO;
|
||||||
|
import pc.exam.pp.module.exam.dal.dataobject.classs.ClassDO;
|
||||||
|
import pc.exam.pp.module.exam.dal.mysql.classs.ClassMapper;
|
||||||
|
import pc.exam.pp.module.exam.service.classs.ClassService;
|
||||||
import pc.exam.pp.module.infra.api.config.ConfigApi;
|
import pc.exam.pp.module.infra.api.config.ConfigApi;
|
||||||
import pc.exam.pp.module.infra.api.file.FileApi;
|
import pc.exam.pp.module.infra.api.file.FileApi;
|
||||||
import pc.exam.pp.module.system.controller.admin.auth.vo.AuthRegisterReqVO;
|
import pc.exam.pp.module.system.controller.admin.auth.vo.AuthRegisterReqVO;
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
|
import pc.exam.pp.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
|
import pc.exam.pp.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserImportExcelVO;
|
import pc.exam.pp.module.system.controller.admin.user.vo.user.*;
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserImportRespVO;
|
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
|
||||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
|
||||||
import pc.exam.pp.module.system.dal.dataobject.dept.DeptDO;
|
import pc.exam.pp.module.system.dal.dataobject.dept.DeptDO;
|
||||||
import pc.exam.pp.module.system.dal.dataobject.dept.UserPostDO;
|
import pc.exam.pp.module.system.dal.dataobject.dept.UserPostDO;
|
||||||
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
|
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import pc.exam.pp.module.system.dal.dataobject.user.TeacherClassDO;
|
||||||
|
import pc.exam.pp.module.system.dal.dataobject.user.TeacherSpecialtyDO;
|
||||||
import pc.exam.pp.module.system.dal.mysql.dept.UserPostMapper;
|
import pc.exam.pp.module.system.dal.mysql.dept.UserPostMapper;
|
||||||
import pc.exam.pp.module.system.dal.mysql.user.AdminUserMapper;
|
import pc.exam.pp.module.system.dal.mysql.user.AdminUserMapper;
|
||||||
|
import pc.exam.pp.module.system.dal.mysql.user.TeacherClassMapper;
|
||||||
|
import pc.exam.pp.module.system.dal.mysql.user.TeacherSpecialtyMapper;
|
||||||
import pc.exam.pp.module.system.service.dept.DeptService;
|
import pc.exam.pp.module.system.service.dept.DeptService;
|
||||||
import pc.exam.pp.module.system.service.dept.PostService;
|
import pc.exam.pp.module.system.service.dept.PostService;
|
||||||
import pc.exam.pp.module.system.service.permission.PermissionService;
|
import pc.exam.pp.module.system.service.permission.PermissionService;
|
||||||
@@ -64,6 +70,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
@Resource
|
@Resource
|
||||||
private AdminUserMapper userMapper;
|
private AdminUserMapper userMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ClassMapper classMapper;
|
||||||
|
@Resource
|
||||||
|
private ClassService classService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DeptService deptService;
|
private DeptService deptService;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -78,6 +89,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserPostMapper userPostMapper;
|
private UserPostMapper userPostMapper;
|
||||||
|
@Resource
|
||||||
|
private TeacherClassMapper teacherClassMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TeacherSpecialtyMapper teacherSpecialtyMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FileApi fileApi;
|
private FileApi fileApi;
|
||||||
@@ -114,6 +130,92 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
LogRecordContext.putVariable("user", user);
|
LogRecordContext.putVariable("user", user);
|
||||||
return user.getId();
|
return user.getId();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_CREATE_SUB_TYPE, bizNo = "{{#user.id}}",
|
||||||
|
success = SYSTEM_USER_CREATE_SUCCESS)
|
||||||
|
public Long createUserStudent(UserSaveReqVO createReqVO) {
|
||||||
|
// 1.1 校验账户配合
|
||||||
|
tenantService.handleTenantInfo(tenant -> {
|
||||||
|
long count = userMapper.selectCount();
|
||||||
|
if (count >= tenant.getAccountCount()) {
|
||||||
|
throw exception(USER_COUNT_MAX, tenant.getAccountCount());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 1.2 校验正确性
|
||||||
|
validateUserForCreateOrUpdate(null, createReqVO.getUsername(),
|
||||||
|
createReqVO.getMobile(), createReqVO.getEmail(), createReqVO.getDeptId(), createReqVO.getPostIds());
|
||||||
|
|
||||||
|
// 2.1 插入用户
|
||||||
|
AdminUserDO user = BeanUtils.toBean(createReqVO, AdminUserDO.class);
|
||||||
|
// 1.3 根据班级名称查询班级是否存在,如存在返回班级ID,如不存在创建并返回班级ID
|
||||||
|
ClassDO classDO = classMapper.getClassNameOne(createReqVO.getClassName());
|
||||||
|
if (classDO == null) {
|
||||||
|
// 如果没有查询出来需要创建数据
|
||||||
|
ClassSaveReqVO classSaveReqVO = new ClassSaveReqVO();
|
||||||
|
classSaveReqVO.setName(createReqVO.getClassName());
|
||||||
|
user.setClassId(classService.createClass(classSaveReqVO));
|
||||||
|
} else {
|
||||||
|
// 查询出数据后进行赋值
|
||||||
|
user.setClassId(classDO.getId());
|
||||||
|
}
|
||||||
|
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||||
|
user.setPassword(encodePassword(createReqVO.getPassword())); // 加密密码s
|
||||||
|
userMapper.insert(user);
|
||||||
|
// 2.2 插入关联岗位
|
||||||
|
if (CollectionUtil.isNotEmpty(user.getPostIds())) {
|
||||||
|
userPostMapper.insertBatch(convertList(user.getPostIds(),
|
||||||
|
postId -> new UserPostDO().setUserId(user.getId()).setPostId(postId)));
|
||||||
|
}
|
||||||
|
// 3. 记录操作日志上下文
|
||||||
|
LogRecordContext.putVariable("user", user);
|
||||||
|
return user.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_CREATE_SUB_TYPE, bizNo = "{{#user.id}}",
|
||||||
|
success = SYSTEM_USER_CREATE_SUCCESS)
|
||||||
|
public Long createUserTeacher(UserSaveReqVO createReqVO) {
|
||||||
|
// 1.1 校验账户配合
|
||||||
|
tenantService.handleTenantInfo(tenant -> {
|
||||||
|
long count = userMapper.selectCount();
|
||||||
|
if (count >= tenant.getAccountCount()) {
|
||||||
|
throw exception(USER_COUNT_MAX, tenant.getAccountCount());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 1.2 校验正确性
|
||||||
|
validateUserForCreateOrUpdate(null, createReqVO.getUsername(),
|
||||||
|
createReqVO.getMobile(), createReqVO.getEmail(), createReqVO.getDeptId(), createReqVO.getPostIds());
|
||||||
|
|
||||||
|
// 2.1 插入用户
|
||||||
|
AdminUserDO user = BeanUtils.toBean(createReqVO, AdminUserDO.class);
|
||||||
|
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||||
|
user.setPassword(encodePassword(createReqVO.getPassword())); // 加密密码s
|
||||||
|
userMapper.insert(user);
|
||||||
|
// 2.2 插入关联岗位
|
||||||
|
if (CollectionUtil.isNotEmpty(user.getPostIds())) {
|
||||||
|
userPostMapper.insertBatch(convertList(user.getPostIds(),
|
||||||
|
postId -> new UserPostDO().setUserId(user.getId()).setPostId(postId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2.3 插入关联班级
|
||||||
|
if (CollectionUtil.isNotEmpty(user.getClassIds())) {
|
||||||
|
teacherClassMapper.insertBatch(convertList(user.getClassIds(),
|
||||||
|
classId -> new TeacherClassDO().setUserId(user.getId()).setClassId(classId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2.4 插入关联专业
|
||||||
|
if (CollectionUtil.isNotEmpty(user.getSpecialtyIds())) {
|
||||||
|
teacherSpecialtyMapper.insertBatch(convertList(user.getSpecialtyIds(),
|
||||||
|
specialtyId -> new TeacherSpecialtyDO().setUserId(user.getId()).setSpecialtyId(specialtyId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 记录操作日志上下文
|
||||||
|
LogRecordContext.putVariable("user", user);
|
||||||
|
return user.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long registerUser(AuthRegisterReqVO registerReqVO) {
|
public Long registerUser(AuthRegisterReqVO registerReqVO) {
|
||||||
@@ -135,6 +237,64 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
return user.getId();
|
return user.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}",
|
||||||
|
success = SYSTEM_USER_UPDATE_SUCCESS)
|
||||||
|
public void updateTeacher(UserSaveReqVO updateReqVO) {
|
||||||
|
updateReqVO.setPassword(null); // 特殊:此处不更新密码
|
||||||
|
// 1. 校验正确性
|
||||||
|
AdminUserDO oldUser = validateUserForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getUsername(),
|
||||||
|
updateReqVO.getMobile(), updateReqVO.getEmail(), updateReqVO.getDeptId(), updateReqVO.getPostIds());
|
||||||
|
|
||||||
|
// 2.1 更新用户
|
||||||
|
AdminUserDO updateObj = BeanUtils.toBean(updateReqVO, AdminUserDO.class);
|
||||||
|
userMapper.updateById(updateObj);
|
||||||
|
// 2.2 更新岗位
|
||||||
|
updateUserPost(updateReqVO, updateObj);
|
||||||
|
// 2.3 更新专业
|
||||||
|
updateTeacherSpecialty(updateReqVO, updateObj);
|
||||||
|
// 2.4 更新班级
|
||||||
|
updateTeacherClass(updateReqVO, updateObj);
|
||||||
|
|
||||||
|
// 3. 记录操作日志上下文
|
||||||
|
LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldUser, UserSaveReqVO.class));
|
||||||
|
LogRecordContext.putVariable("teacher", oldUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}",
|
||||||
|
success = SYSTEM_USER_UPDATE_SUCCESS)
|
||||||
|
public void updateStudent(UserSaveReqVO updateReqVO) {
|
||||||
|
updateReqVO.setPassword(null); // 特殊:此处不更新密码
|
||||||
|
// 1. 校验正确性
|
||||||
|
AdminUserDO oldUser = validateUserForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getUsername(),
|
||||||
|
updateReqVO.getMobile(), updateReqVO.getEmail(), updateReqVO.getDeptId(), updateReqVO.getPostIds());
|
||||||
|
|
||||||
|
// 1.3 根据班级名称查询班级是否存在,如存在返回班级ID,如不存在创建并返回班级ID
|
||||||
|
AdminUserDO updateObj = BeanUtils.toBean(updateReqVO, AdminUserDO.class);
|
||||||
|
ClassDO classDO = classMapper.getClassNameOne(updateReqVO.getClassName());
|
||||||
|
if (classDO == null) {
|
||||||
|
// 如果没有查询出来需要创建数据
|
||||||
|
ClassSaveReqVO classSaveReqVO = new ClassSaveReqVO();
|
||||||
|
classSaveReqVO.setName(updateReqVO.getClassName());
|
||||||
|
updateObj.setClassId(classService.createClass(classSaveReqVO));
|
||||||
|
} else {
|
||||||
|
// 查询出数据后进行赋值
|
||||||
|
updateObj.setClassId(classDO.getId());
|
||||||
|
}
|
||||||
|
// 2.1 更新用户
|
||||||
|
userMapper.updateById(updateObj);
|
||||||
|
// 2.2 更新岗位
|
||||||
|
updateUserPost(updateReqVO, updateObj);
|
||||||
|
// 3. 记录操作日志上下文
|
||||||
|
LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldUser, UserSaveReqVO.class));
|
||||||
|
LogRecordContext.putVariable("student", oldUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}",
|
@LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}",
|
||||||
@@ -156,6 +316,42 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
LogRecordContext.putVariable("user", oldUser);
|
LogRecordContext.putVariable("user", oldUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateTeacherClass(UserSaveReqVO reqVO, AdminUserDO updateObj) {
|
||||||
|
Long userId = reqVO.getId();
|
||||||
|
Set<Long> dbClassIds = convertSet(teacherClassMapper.selectListByUserId(userId), TeacherClassDO::getClassId);
|
||||||
|
// 计算新增和删除的岗位编号
|
||||||
|
Set<Long> classsIds = CollUtil.emptyIfNull(updateObj.getClassIds());
|
||||||
|
Collection<Long> createClassIds = CollUtil.subtract(classsIds, dbClassIds);
|
||||||
|
Collection<Long> deleteClassIds = CollUtil.subtract(dbClassIds, classsIds);
|
||||||
|
|
||||||
|
// 执行新增和删除。对于已经授权的班级,不用做任何处理
|
||||||
|
if (!CollectionUtil.isEmpty(createClassIds)) {
|
||||||
|
teacherClassMapper.insertBatch(convertList(createClassIds,
|
||||||
|
classId -> new TeacherClassDO().setUserId(userId).setClassId(classId)));
|
||||||
|
}
|
||||||
|
if (!CollectionUtil.isEmpty(deleteClassIds)) {
|
||||||
|
teacherClassMapper.deleteByUserIdAndTeacherId(userId, deleteClassIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTeacherSpecialty (UserSaveReqVO reqVO, AdminUserDO updateObj) {
|
||||||
|
Long userId = reqVO.getId();
|
||||||
|
Set<Long> dbSpecialtyIds = convertSet(teacherSpecialtyMapper.selectListByUserId(userId), TeacherSpecialtyDO::getSpecialtyId);
|
||||||
|
// 计算新增和删除的岗位编号
|
||||||
|
Set<Long> specialtyIds = CollUtil.emptyIfNull(updateObj.getSpecialtyIds());
|
||||||
|
Collection<Long> createSpecialtyIds = CollUtil.subtract(specialtyIds, dbSpecialtyIds);
|
||||||
|
Collection<Long> deleteSpecialtyIds = CollUtil.subtract(dbSpecialtyIds, specialtyIds);
|
||||||
|
|
||||||
|
// 执行新增和删除。对于已经授权的班级,不用做任何处理
|
||||||
|
if (!CollectionUtil.isEmpty(createSpecialtyIds)) {
|
||||||
|
teacherSpecialtyMapper.insertBatch(convertList(createSpecialtyIds,
|
||||||
|
specialtyId -> new TeacherSpecialtyDO().setUserId(userId).setSpecialtyId(specialtyId)));
|
||||||
|
}
|
||||||
|
if (!CollectionUtil.isEmpty(deleteSpecialtyIds)) {
|
||||||
|
teacherSpecialtyMapper.deleteByUserIdAndSpecialtyId(userId, deleteSpecialtyIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateUserPost(UserSaveReqVO reqVO, AdminUserDO updateObj) {
|
private void updateUserPost(UserSaveReqVO reqVO, AdminUserDO updateObj) {
|
||||||
Long userId = reqVO.getId();
|
Long userId = reqVO.getId();
|
||||||
Set<Long> dbPostIds = convertSet(userPostMapper.selectListByUserId(userId), UserPostDO::getPostId);
|
Set<Long> dbPostIds = convertSet(userPostMapper.selectListByUserId(userId), UserPostDO::getPostId);
|
||||||
@@ -279,10 +475,27 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
return userMapper.selectPage(reqVO, getDeptCondition(reqVO.getDeptId()), userIds);
|
return userMapper.selectPage(reqVO, getDeptCondition(reqVO.getDeptId()), userIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<AdminUserDO> getStudentPage(UserPageReqVO reqVO) {
|
||||||
|
Long classId = null;
|
||||||
|
// 如果有角色编号,查询角色对应的用户编号
|
||||||
|
Set<Long> userIds = reqVO.getRoleId() != null ?
|
||||||
|
permissionService.getUserRoleIdListByRoleId(singleton(reqVO.getRoleId())) : null;
|
||||||
|
|
||||||
|
// 获取班级ID
|
||||||
|
ClassDO classDO = classMapper.getClassNameOne(reqVO.getClassName());
|
||||||
|
// 分页查询
|
||||||
|
return userMapper.selectStuPage(reqVO, getDeptCondition(reqVO.getDeptId()), userIds, classDO != null ? classDO.getId() : null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AdminUserDO getUser(Long id) {
|
public AdminUserDO getUser(Long id) {
|
||||||
return userMapper.selectById(id);
|
return userMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<UserRespVO> getUserById(Long id) {
|
||||||
|
return userMapper.selectUserByIdList(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AdminUserDO> getUserListByDeptIds(Collection<Long> deptIds) {
|
public List<AdminUserDO> getUserListByDeptIds(Collection<Long> deptIds) {
|
||||||
|
@@ -0,0 +1,24 @@
|
|||||||
|
<?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="pc.exam.pp.module.system.dal.mysql.user.AdminUserMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
<select id="selectUserByIdList" resultType="pc.exam.pp.module.system.controller.admin.user.vo.user.UserRespVO">
|
||||||
|
SELECT
|
||||||
|
su.username,
|
||||||
|
su.nickname,
|
||||||
|
ec.`name` AS className,
|
||||||
|
su.remark
|
||||||
|
FROM
|
||||||
|
system_users su
|
||||||
|
LEFT JOIN system_teacher_class stc ON stc.class_id = su.class_id
|
||||||
|
LEFT JOIN exam_class ec ON ec.id = su.class_id
|
||||||
|
WHERE stc.user_id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
@@ -44,22 +44,22 @@ spring:
|
|||||||
primary: master
|
primary: master
|
||||||
datasource:
|
datasource:
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
url: jdbc:mysql://47.101.60.131:3306/pc-exam?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||||
username: root
|
username: pc-exam
|
||||||
password: 123456
|
password: YGsyBWH3KdGpz8C7
|
||||||
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
|
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
|
||||||
lazy: true # 开启懒加载,保证启动速度
|
lazy: true # 开启懒加载,保证启动速度
|
||||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
url: jdbc:mysql://47.101.60.131:3306/pc-exam?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
||||||
username: root
|
username: pc-exam
|
||||||
password: 123456
|
password: YGsyBWH3KdGpz8C7
|
||||||
|
|
||||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
host: 400-infra.server.iocoder.cn # 地址
|
host: 47.101.60.131 # 地址
|
||||||
port: 6379 # 端口
|
port: 6379 # 端口
|
||||||
database: 1 # 数据库索引
|
database: 0 # 数据库索引
|
||||||
# password: 123456 # 密码,建议生产环境开启
|
password: sadjklasnfasd # 密码,建议生产环境开启
|
||||||
|
|
||||||
--- #################### 定时任务相关配置 ####################
|
--- #################### 定时任务相关配置 ####################
|
||||||
|
|
||||||
@@ -101,10 +101,10 @@ rocketmq:
|
|||||||
spring:
|
spring:
|
||||||
# RabbitMQ 配置项,对应 RabbitProperties 配置类
|
# RabbitMQ 配置项,对应 RabbitProperties 配置类
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
host: 127.0.0.1 # RabbitMQ 服务的地址
|
host: 47.101.60.131 # RabbitMQ 服务的地址
|
||||||
port: 5672 # RabbitMQ 服务的端口
|
port: 5672 # RabbitMQ 服务的端口
|
||||||
username: guest # RabbitMQ 服务的账号
|
username: admin # RabbitMQ 服务的账号
|
||||||
password: guest # RabbitMQ 服务的密码
|
password: KkbxwDnD # RabbitMQ 服务的密码
|
||||||
# Kafka 配置项,对应 KafkaProperties 配置类
|
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||||
kafka:
|
kafka:
|
||||||
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||||
|
@@ -63,9 +63,15 @@ flowable:
|
|||||||
check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
|
check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
|
||||||
history-level: audit # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数
|
history-level: audit # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数
|
||||||
|
|
||||||
|
mybatis:
|
||||||
|
# 搜索指定包别名
|
||||||
|
type-aliases-package: pc.exam.pp.module.**.dal.dataobject
|
||||||
|
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||||
|
mapper-locations: classpath*:mapper/**/*Mapper.xml
|
||||||
|
|
||||||
# MyBatis Plus 的配置项
|
# MyBatis Plus 的配置项
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
mapper-locations: "classpath:/mapper/**/**/*.xml"
|
mapper-locations: classpath*:mapper/**/*Mapper.xml
|
||||||
configuration:
|
configuration:
|
||||||
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
||||||
global-config:
|
global-config:
|
||||||
|
Reference in New Issue
Block a user