From c6f0df8b187a76fb68cd978e32d9948701019139 Mon Sep 17 00:00:00 2001 From: DU Date: Fri, 8 Jan 2021 18:00:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E4=BD=8D=E9=83=A8=E9=97=A8=E6=88=90?= =?UTF-8?q?=E5=91=98=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86=E5=85=B3=E8=81=94?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=80=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/20210108-dukang.sql | 94 ++++ .../joylink/rtss/constants/CompanyEnum.java | 35 ++ .../rtss/controller/CompanyController.java | 159 +++++- .../controller/publish/LessonController.java | 20 +- .../rtss/controller/user/UserController.java | 36 +- .../rtss/dao/CompanyDepartmentDAO.java | 12 + .../joylink/rtss/dao/CompanyPositionDAO.java | 12 + .../club/joylink/rtss/dao/CompanyUserDAO.java | 18 + .../joylink/rtss/dao/DepartmentExamDAO.java | 26 + .../joylink/rtss/dao/DepartmentLessonDAO.java | 33 ++ .../joylink/rtss/dao/DepartmentUserDAO.java | 22 + .../club/joylink/rtss/dao/SysUserDAO.java | 4 +- .../joylink/rtss/dao/UserCompanyRelDAO.java | 15 - .../rtss/entity/CompanyDepartment.java | 104 ++++ .../rtss/entity/CompanyDepartmentExample.java | 472 ++++++++++++++++ .../joylink/rtss/entity/CompanyPosition.java | 88 +++ .../rtss/entity/CompanyPositionExample.java | 412 ++++++++++++++ .../club/joylink/rtss/entity/CompanyUser.java | 91 +++ .../rtss/entity/CompanyUserExample.java | 402 ++++++++++++++ .../joylink/rtss/entity/DepartmentExam.java | 69 +++ .../rtss/entity/DepartmentExamExample.java | 342 ++++++++++++ .../joylink/rtss/entity/DepartmentLesson.java | 75 +++ .../rtss/entity/DepartmentLessonExample.java | 342 ++++++++++++ ...serCompanyRel.java => DepartmentUser.java} | 42 +- ...xample.java => DepartmentUserExample.java} | 112 +++- .../joylink/rtss/services/CompanyService.java | 519 ++++++++++++++---- .../joylink/rtss/services/ExamService.java | 37 +- .../rtss/services/ICompanyService.java | 103 +++- .../rtss/services/ISysUserService.java | 15 +- .../joylink/rtss/services/LessonService.java | 32 +- .../rtss/services/MapSystemService.java | 52 +- .../joylink/rtss/services/SysUserService.java | 153 ++++-- ....java => DepartUserStaticServiceImpl.java} | 150 ++--- ....java => IDepartUserStatisticService.java} | 38 +- .../java/club/joylink/rtss/vo/UserVO.java | 15 + .../rtss/vo/client/ExamDefinitionVO.java | 10 +- .../client/company/CompanyDepartUserVO.java | 35 ++ .../client/{ => company}/CompanyQueryVO.java | 4 +- .../vo/client/company/CompanyUserQueryVO.java | 22 + .../rtss/vo/client/company/CompanyUserVO.java | 49 ++ .../vo/client/{ => company}/CompanyVO.java | 13 +- .../rtss/vo/client/company/DepartmentVO.java | 105 ++++ .../client/company/ImportCompanyUserVO.java | 23 + .../rtss/vo/client/company/PositionVO.java | 48 ++ .../vo/client/company/UserDepartRelVO.java | 62 +++ .../rtss/vo/client/company/UserDepartVO.java | 15 + .../mybatis/mapper/CompanyDepartmentDAO.xml | 198 +++++++ .../mybatis/mapper/CompanyPositionDAO.xml | 181 ++++++ .../mybatis/mapper/CompanyUserDAO.xml | 161 ++++++ .../mybatis/mapper/DepartmentExamDAO.xml | 148 +++++ .../mybatis/mapper/DepartmentLessonDAO.xml | 148 +++++ ...ompanyRelDAO.xml => DepartmentUserDAO.xml} | 149 +++-- .../resources/mybatis/mapper/SysUserDAO.xml | 44 +- 53 files changed, 5077 insertions(+), 489 deletions(-) create mode 100644 sql/20210108-dukang.sql create mode 100644 src/main/java/club/joylink/rtss/constants/CompanyEnum.java create mode 100644 src/main/java/club/joylink/rtss/dao/CompanyDepartmentDAO.java create mode 100644 src/main/java/club/joylink/rtss/dao/CompanyPositionDAO.java create mode 100644 src/main/java/club/joylink/rtss/dao/CompanyUserDAO.java create mode 100644 src/main/java/club/joylink/rtss/dao/DepartmentExamDAO.java create mode 100644 src/main/java/club/joylink/rtss/dao/DepartmentLessonDAO.java create mode 100644 src/main/java/club/joylink/rtss/dao/DepartmentUserDAO.java delete mode 100644 src/main/java/club/joylink/rtss/dao/UserCompanyRelDAO.java create mode 100644 src/main/java/club/joylink/rtss/entity/CompanyDepartment.java create mode 100644 src/main/java/club/joylink/rtss/entity/CompanyDepartmentExample.java create mode 100644 src/main/java/club/joylink/rtss/entity/CompanyPosition.java create mode 100644 src/main/java/club/joylink/rtss/entity/CompanyPositionExample.java create mode 100644 src/main/java/club/joylink/rtss/entity/CompanyUser.java create mode 100644 src/main/java/club/joylink/rtss/entity/CompanyUserExample.java create mode 100644 src/main/java/club/joylink/rtss/entity/DepartmentExam.java create mode 100644 src/main/java/club/joylink/rtss/entity/DepartmentExamExample.java create mode 100644 src/main/java/club/joylink/rtss/entity/DepartmentLesson.java create mode 100644 src/main/java/club/joylink/rtss/entity/DepartmentLessonExample.java rename src/main/java/club/joylink/rtss/entity/{UserCompanyRel.java => DepartmentUser.java} (73%) rename src/main/java/club/joylink/rtss/entity/{UserCompanyRelExample.java => DepartmentUserExample.java} (80%) rename src/main/java/club/joylink/rtss/services/student/{ClassStudentUserServiceImpl.java => DepartUserStaticServiceImpl.java} (74%) rename src/main/java/club/joylink/rtss/services/student/{IClassStudentUserService.java => IDepartUserStatisticService.java} (57%) create mode 100644 src/main/java/club/joylink/rtss/vo/client/company/CompanyDepartUserVO.java rename src/main/java/club/joylink/rtss/vo/client/{ => company}/CompanyQueryVO.java (60%) create mode 100644 src/main/java/club/joylink/rtss/vo/client/company/CompanyUserQueryVO.java create mode 100644 src/main/java/club/joylink/rtss/vo/client/company/CompanyUserVO.java rename src/main/java/club/joylink/rtss/vo/client/{ => company}/CompanyVO.java (83%) create mode 100644 src/main/java/club/joylink/rtss/vo/client/company/DepartmentVO.java create mode 100644 src/main/java/club/joylink/rtss/vo/client/company/ImportCompanyUserVO.java create mode 100644 src/main/java/club/joylink/rtss/vo/client/company/PositionVO.java create mode 100644 src/main/java/club/joylink/rtss/vo/client/company/UserDepartRelVO.java create mode 100644 src/main/java/club/joylink/rtss/vo/client/company/UserDepartVO.java create mode 100644 src/main/resources/mybatis/mapper/CompanyDepartmentDAO.xml create mode 100644 src/main/resources/mybatis/mapper/CompanyPositionDAO.xml create mode 100644 src/main/resources/mybatis/mapper/CompanyUserDAO.xml create mode 100644 src/main/resources/mybatis/mapper/DepartmentExamDAO.xml create mode 100644 src/main/resources/mybatis/mapper/DepartmentLessonDAO.xml rename src/main/resources/mybatis/mapper/{UserCompanyRelDAO.xml => DepartmentUserDAO.xml} (58%) diff --git a/sql/20210108-dukang.sql b/sql/20210108-dukang.sql new file mode 100644 index 000000000..9fc03b720 --- /dev/null +++ b/sql/20210108-dukang.sql @@ -0,0 +1,94 @@ +-- 更改表 +ALTER TABLE `sys_user` + DROP COLUMN `company_id`; +-- 新建表 +CREATE TABLE `company_department` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(32) NOT NULL COMMENT '部门名称' COLLATE 'utf8_general_ci', + `company_id` INT(11) NOT NULL COMMENT '单位id', + `parent_id` INT(11) NULL DEFAULT NULL COMMENT '父级id', + PRIMARY KEY (`id`), + INDEX `FK_company_department_company` (`company_id`), + INDEX `FK_company_department_company_department` (`parent_id`), + CONSTRAINT `FK_company_department_company` FOREIGN KEY (`company_id`) REFERENCES `company` (`id`) ON DELETE CASCADE, + CONSTRAINT `FK_company_department_company_department` FOREIGN KEY (`parent_id`) REFERENCES `company_department` (`id`) ON DELETE SET NULL +) +COMMENT='单位部门信息' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; +CREATE TABLE `company_position` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(32) NOT NULL COMMENT '职位名称' COLLATE 'utf8_general_ci', + `company_id` INT(11) NOT NULL COMMENT '单位id', + PRIMARY KEY (`id`), + INDEX `FK_company_position_company` (`company_id`), + CONSTRAINT `FK_company_position_company` FOREIGN KEY (`company_id`) REFERENCES `company` (`id`) ON DELETE CASCADE +) +COMMENT='单位职位信息' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; +CREATE TABLE `company_user` ( + `company_id` INT(11) NOT NULL COMMENT '公司id', + `user_id` BIGINT(20) NOT NULL COMMENT '用户id', + `admin` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '公司管理员', + UNIQUE INDEX `user_id` (`user_id`), + INDEX `FK_company_user_company` (`company_id`), + CONSTRAINT `FK_company_user_company` FOREIGN KEY (`company_id`) REFERENCES `company` (`id`) ON DELETE CASCADE, + CONSTRAINT `FK_company_user_sys_user` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`id`) ON DELETE CASCADE +) +COMMENT='单位用户关系' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; +CREATE TABLE `department_user` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT, + `user_id` BIGINT(20) NOT NULL COMMENT '用户id', + `department_id` INT(11) NOT NULL COMMENT '部门id', + `position_id` INT(11) NULL DEFAULT NULL COMMENT '职位id', + `manager` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '部门管理员', + `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + INDEX `FK_department_user_company_position` (`position_id`), + INDEX `FK_department_user_sys_user` (`user_id`), + INDEX `FK_department_user_company_department` (`department_id`), + CONSTRAINT `FK_department_user_company_department` FOREIGN KEY (`department_id`) REFERENCES `company_department` (`id`) ON DELETE CASCADE, + CONSTRAINT `FK_department_user_company_position` FOREIGN KEY (`position_id`) REFERENCES `company_position` (`id`) ON DELETE SET NULL, + CONSTRAINT `FK_department_user_sys_user` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`id`) ON DELETE CASCADE +) +COMMENT='用户、部门关联表' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; +CREATE TABLE `department_lesson` ( + `lesson_id` BIGINT(20) NOT NULL COMMENT '课程id', + `department_id` INT(11) NOT NULL COMMENT '班级id', + INDEX `lesson_id` (`lesson_id`), + INDEX `department_lesson_ibfk_1` (`department_id`), + CONSTRAINT `department_lesson_ibfk_1` FOREIGN KEY (`department_id`) REFERENCES `company_department` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, + CONSTRAINT `department_lesson_ibfk_2` FOREIGN KEY (`lesson_id`) REFERENCES `ls_lesson` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE +) +COMMENT='班级课程表' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; +CREATE TABLE `department_exam` ( + `exam_id` BIGINT(20) NOT NULL, + `department_id` INT(11) NOT NULL, + INDEX `exam_id` (`exam_id`), + INDEX `department_exam_ibfk_2` (`department_id`), + CONSTRAINT `department_exam_ibfk_1` FOREIGN KEY (`exam_id`) REFERENCES `exam_definition` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, + CONSTRAINT `department_exam_ibfk_2` FOREIGN KEY (`department_id`) REFERENCES `company_department` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE +) +COMMENT='学生的试卷和班级关系' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; + + + + + + diff --git a/src/main/java/club/joylink/rtss/constants/CompanyEnum.java b/src/main/java/club/joylink/rtss/constants/CompanyEnum.java new file mode 100644 index 000000000..e243aca1d --- /dev/null +++ b/src/main/java/club/joylink/rtss/constants/CompanyEnum.java @@ -0,0 +1,35 @@ +//package club.joylink.rtss.constants; +// +//import lombok.Getter; +// +///**单位类型枚举*/ +//@Getter +//public enum CompanyEnum { +// +// School{ +// @Override +// public Position getAdmin() { +// return Position.Teacher; +// } +// +// @Override +// public boolean isAdmin(String positionName) { +// return Position.Teacher ==Position.valueOf(positionName) ; +// } +// +// @Override +// public Position getStaff() { +// return Position.Student; +// } +// }; +// +// /**单位职位类型枚举*/ +// @Getter +// public enum Position{ +// Teacher,Student +// } +// public abstract Position getAdmin(); +// public abstract boolean isAdmin(String positionName); +// public abstract Position getStaff(); +// +//} diff --git a/src/main/java/club/joylink/rtss/controller/CompanyController.java b/src/main/java/club/joylink/rtss/controller/CompanyController.java index 073eed7bf..d33374345 100644 --- a/src/main/java/club/joylink/rtss/controller/CompanyController.java +++ b/src/main/java/club/joylink/rtss/controller/CompanyController.java @@ -4,9 +4,8 @@ import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.services.ICompanyService; import club.joylink.rtss.vo.UserVO; -import club.joylink.rtss.vo.client.CompanyQueryVO; -import club.joylink.rtss.vo.client.CompanyVO; import club.joylink.rtss.vo.client.PageVO; +import club.joylink.rtss.vo.client.company.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -16,7 +15,7 @@ import springfox.documentation.annotations.ApiIgnore; import java.util.List; -@Api(tags = {"公司单位管理接口"}) +@Api(tags = {"单位成员管理接口"}) @RestController @RequestMapping("/api/company") public class CompanyController { @@ -27,52 +26,178 @@ public class CompanyController { @ApiOperation(value = "添加公司信息") @PostMapping public CompanyVO create(@RequestBody @Validated CompanyVO company) { - CompanyVO vo = this.iCompanyService.create(company); + CompanyVO vo = iCompanyService.create(company); return vo; } @ApiOperation(value = "获取公司列表") @GetMapping public List queryAll() { - List list = this.iCompanyService.queryOrganizations(); + List list = iCompanyService.queryOrganizations(); return list; } @ApiOperation(value = "分页获取公司列表") @GetMapping("paging") public PageVO pagingQueryAll(CompanyQueryVO queryVO) { - PageVO list = this.iCompanyService.queryPageOrganizations(queryVO); + PageVO list = iCompanyService.queryPageOrganizations(queryVO); return list; } @ApiOperation(value = "删除公司信息") @DeleteMapping("{id}") public void delete( @PathVariable Integer id) { - this.iCompanyService.deleteCompanyById(id); + iCompanyService.deleteCompanyById(id); } @ApiOperation(value = "查询公司信息") @GetMapping("{id}") public CompanyVO get( @PathVariable Integer id) { - return this.iCompanyService.getCompanyById(id); + return iCompanyService.getCompanyById(id); } @ApiOperation(value = "更新公司信息") @PutMapping("{id}") public CompanyVO updateCompany(@PathVariable Integer id, @RequestBody @Validated CompanyVO company) { - return this.iCompanyService.updateCompany(id, company); + return iCompanyService.updateCompany(id, company); } - @Role({RoleEnum.Admin, RoleEnum.SuperAdmin}) - @ApiOperation("添加公司管理者") - @PutMapping("/{companyId}/addManager") - public void addManager(@PathVariable Integer companyId, @RequestBody List userIds, @RequestAttribute @ApiIgnore UserVO user) { - iCompanyService.addManager(companyId, userIds, user); - } +// @Role({RoleEnum.Admin, RoleEnum.SuperAdmin}) +// @ApiOperation("添加公司管理者") +// @PutMapping("/{companyId}/addManager") +// public void addManager(@PathVariable Integer companyId, @RequestBody List userIds, @RequestAttribute @ApiIgnore UserVO user) { +// iCompanyService.addManager(companyId, userIds, user); +// } +// +// @Role({RoleEnum.Admin, RoleEnum.SuperAdmin}) +// @ApiOperation("取消公司管理者") +// @PutMapping("/{companyId}/removeManager") +// public void addManager(@PathVariable Integer companyId, @RequestBody List userIds, @RequestAttribute @ApiIgnore UserVO user) { +// iCompanyService.removeManager(companyId, userIds, user); +// } @ApiOperation(value = "微信小程用户绑定单位") @PutMapping(path = "/bind/company") - public void userBindCompany(Long userId, Integer companyId) { - this.iCompanyService.userBindCompany(userId, companyId); + public void userScanCodeBindCompany(Long userId, Integer companyId) { + iCompanyService.userScanCodeBindCompany(userId, companyId); } + + @ApiOperation(value = "添加部门信息") + @PostMapping(path = "/dept") + public DepartmentVO createDepart(@RequestBody @Validated DepartmentVO departmentVO) { + DepartmentVO vo = iCompanyService.createDepart(departmentVO); + return vo; + } + + @ApiOperation(value = "获取单位部门树") + @GetMapping(path = "{companyId}/dept/tree") + public List queryCompanyDepartTree(@PathVariable Integer companyId) { + List list = iCompanyService.getCompanyDepartTree(companyId); + return list; + } + + @ApiOperation(value = "获取单位所有部门") + @GetMapping(path = "{companyId}/dept") + public List queryCompanyDepart(@PathVariable Integer companyId) { + List list =iCompanyService.getCompanyAllDepart(companyId); + return list; + } + + @ApiOperation(value = "获取部门及其子树") + @GetMapping(path = "{companyId}/dept/{deptId}/tree") + public DepartmentVO queryDepartTree(@PathVariable Integer deptId, @PathVariable Integer companyId) { + return iCompanyService.getDepartTree(companyId, deptId); + } + + @ApiOperation(value = "获取部门及其子部门") + @GetMapping(path = "{companyId}/dept/{deptId}") + public List queryDepart(@PathVariable Integer deptId, @PathVariable Integer companyId) { + return iCompanyService.getDepartAndChild(companyId, deptId); + } + + @ApiOperation(value = "删除部门信息") + @DeleteMapping("/dept/{deptId}") + public void deleteDepart( @PathVariable Integer deptId) { + iCompanyService.deleteDepartById(deptId); + } + + @ApiOperation(value = "查询部门信息") + @GetMapping("/dept/{deptId}") + public DepartmentVO getDepart( @PathVariable Integer deptId) { + return iCompanyService.getDepartById(deptId); + } + + @ApiOperation(value = "更新部门信息") + @PutMapping("/dept/{id}") + public void updateDepartInfo(@PathVariable Integer id, @RequestBody @Validated DepartmentVO departmentVO) { + iCompanyService.updateDepartInfo(id, departmentVO); + } + +// @ApiOperation(value = "添加职位信息") +// @PostMapping(path = "/position") +// public PositionVO createPosition(@RequestBody @Validated PositionVO positionVO) { +// PositionVO vo = iCompanyService.createPosition(positionVO); +// return vo; +// } +// +// @ApiOperation(value = "更新职位信息") +// @PutMapping("/position/{id}") +// public void updatePositionInfo(@PathVariable Integer id, @RequestBody @Validated PositionVO positionVO) { +// iCompanyService.updatePositionInfo(id, positionVO); +// } +// +// @ApiOperation(value = "删除职位信息") +// @DeleteMapping("/position/{id}") +// public void deletePosition( @PathVariable Integer id) { +// iCompanyService.deletePositionById(id); +// } +// +// @ApiOperation(value = "查询职位信息") +// @GetMapping("/position/{id}") +// public PositionVO getPositionById( @PathVariable Integer id) { +// return iCompanyService.getPositionById(id); +// } +// +// @ApiOperation(value = "查询单位所属的职位信息") +// @GetMapping("{companyId}/position") +// public List getPositionsByCompanyId(@PathVariable Integer companyId) { +// return iCompanyService.getPositionsByCompanyId(companyId); +// } + + @ApiOperation(value = "添加单位成员关系信息") + @PostMapping("refUserInfo") + public void addCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @RequestBody UserDepartRelVO userDepartRelVO) { + iCompanyService.addDepartUserInfo(user,userDepartRelVO); + } + + @ApiOperation(value = "更新单位成员关系信息") + @PutMapping("refUserInfo") + public void updateCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @RequestBody UserDepartRelVO userDepartRelVO) { + iCompanyService.updateDepartUserInfo(user,userDepartRelVO); + } + + @ApiOperation(value = "取消单位的部门成员关系") + @DeleteMapping("departUserInfo") + public void deleteCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @RequestBody UserDepartRelVO userDepartRelVO) { + iCompanyService.deleteDepartUserInfo(user,userDepartRelVO); + } + + @ApiOperation(value = "分页获取单位部门成员信息") + @GetMapping("/dept/{deptId}/departUserInfo") + public PageVO getCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @PathVariable Integer deptId, CompanyUserQueryVO companyUserQueryVO) { + return iCompanyService.getCompanyDepartUserInfoList(user,deptId,companyUserQueryVO); + } + + @ApiOperation(value = "导入单位成员信息") + @PostMapping("{companyId}/departUserInfo/import") + public void importCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @PathVariable Integer companyId, @RequestBody ImportCompanyUserVO importCompanyUserVO) { + iCompanyService.importCompanyUserInfo(user,companyId,importCompanyUserVO); + } + + @ApiOperation(value = "获取单位用户的部门信息") + @GetMapping("{companyId}/userDeparts") + public List getUserCompanyDeparts(@RequestAttribute @ApiIgnore UserVO user, @PathVariable Integer companyId) { + return iCompanyService.getUserCompanyDeparts(user,companyId); + } + } diff --git a/src/main/java/club/joylink/rtss/controller/publish/LessonController.java b/src/main/java/club/joylink/rtss/controller/publish/LessonController.java index 086317566..9a82f5ab8 100644 --- a/src/main/java/club/joylink/rtss/controller/publish/LessonController.java +++ b/src/main/java/club/joylink/rtss/controller/publish/LessonController.java @@ -2,14 +2,14 @@ package club.joylink.rtss.controller.publish; import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.controller.advice.Role; +import club.joylink.rtss.services.ICompanyService; import club.joylink.rtss.services.ILessonService; -import club.joylink.rtss.services.student.IClassStudentUserService; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.LessonQueryVO; import club.joylink.rtss.vo.client.LessonTreeVO; import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.PageVO; -import club.joylink.rtss.vo.client.student.StudentClassVO; +import club.joylink.rtss.vo.client.company.DepartmentVO; import club.joylink.rtss.vo.client.validGroup.LessonUpdateNameAndRemarksCheck; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -28,7 +28,7 @@ public class LessonController { private ILessonService iLessonService; @Autowired - private IClassStudentUserService iClassStudentUserService; + private ICompanyService iCompanyService; @Autowired public LessonController(ILessonService iLessonService) { @@ -53,16 +53,16 @@ public class LessonController { return this.iLessonService.queryValidLessons(lessonQueryVO); } - @ApiOperation(value = "根据班级获取关联课程列表") - @GetMapping(path = "/class/{classId}") - public List queryLessons(@PathVariable Integer classId) { - return this.iClassStudentUserService.getLessonByClass(classId); + @ApiOperation(value = "根据部门获取关联课程列表") + @GetMapping(path = "/depart/{departId}") + public List queryLessons(@PathVariable Integer departId) { + return this.iCompanyService.getLessonsByDepart(departId); } @ApiOperation(value = "根据课程获取关联班级信息列表") - @GetMapping(path = "/{lessonId}/classes") - public List queryClassByLesson(@PathVariable Long lessonId) { - return this.iClassStudentUserService.getClassesByLesson(lessonId); + @GetMapping(path = "/{lessonId}/departs") + public List queryClassByLesson(@PathVariable Long lessonId) { + return this.iCompanyService.getDepartsByLesson(lessonId); } @ApiOperation(value = "获取课程列表") diff --git a/src/main/java/club/joylink/rtss/controller/user/UserController.java b/src/main/java/club/joylink/rtss/controller/user/UserController.java index 7399a7c07..da0bc88ac 100644 --- a/src/main/java/club/joylink/rtss/controller/user/UserController.java +++ b/src/main/java/club/joylink/rtss/controller/user/UserController.java @@ -4,14 +4,12 @@ import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.services.ISysUserService; import club.joylink.rtss.services.local.UserGenerateService; -import club.joylink.rtss.services.student.IClassStudentUserService; +import club.joylink.rtss.services.student.IDepartUserStatisticService; import club.joylink.rtss.vo.UserQueryVO; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.UserConfigVO; import club.joylink.rtss.vo.client.student.ExportStudentInfo; -import club.joylink.rtss.vo.client.student.ImportStudentInfo; -import club.joylink.rtss.vo.client.student.StudentClassVO; import club.joylink.rtss.vo.client.student.StudentInfoExportParam; import club.joylink.rtss.vo.client.user.WeChatBindStatusVO; import club.joylink.rtss.vo.user.UserGenerateConfigVO; @@ -37,7 +35,7 @@ public class UserController { private UserGenerateService userGenerateService; @Autowired - private IClassStudentUserService iClassStudentUserService; + private IDepartUserStatisticService iDepartUserStatisticService; @ApiOperation(value = "更新用户配置") @PostMapping(path = "/config") @@ -111,23 +109,23 @@ public class UserController { return this.iSysUserService.fuzzyQueryPagedUser(fuzzyParam); } - @ApiOperation(value="贵州装备制造导入学生信息接口") - @PostMapping(path="/project/{projectCode}/import/student") - public void importStudents(@PathVariable String projectCode, @Validated @RequestBody ImportStudentInfo importStudentInfo, @RequestAttribute @ApiIgnore UserVO user){ - this.iClassStudentUserService.importStudentInfos(projectCode, importStudentInfo, user); +// @ApiOperation(value="贵州装备制造导入学生信息接口") +// @PostMapping(path="/project/{projectCode}/import/student") +// public void importStudents(@PathVariable String projectCode, @Validated @RequestBody ImportStudentInfo importStudentInfo, @RequestAttribute @ApiIgnore UserVO user){ +// this.iClassStudentUserService.importStudentInfos(projectCode, importStudentInfo, user); +// } + + @ApiOperation(value="导出部门学生信息及成绩接口") + @PutMapping(path="/scores") + public List getStudentSores( @Validated @RequestBody StudentInfoExportParam infoExportParam){ + return this.iDepartUserStatisticService.studentInfoStatistics(infoExportParam); } - @ApiOperation(value="贵州装备制造导出学生信息及成绩接口") - @PutMapping(path="/project/{projectCode}/export/student") - public List importStudents(@PathVariable String projectCode, @Validated @RequestBody StudentInfoExportParam infoExportParam){ - return this.iClassStudentUserService.studentInfoStatistics(infoExportParam); - } - - @ApiOperation(value="贵州装备制造查询对应的班级") - @GetMapping(path="/project/{projectCode}/classes") - public List getClasses(@PathVariable String projectCode){ - return this.iClassStudentUserService.getClassesByProjectCode(projectCode); - } +// @ApiOperation(value="贵州装备制造查询对应的班级") +// @GetMapping(path="/project/{projectCode}/classes") +// public List getClasses(@PathVariable String projectCode){ +// return this.iClassStudentUserService.getClassesByProjectCode(projectCode); +// } @ApiOperation("查询销售人员") @GetMapping("/seller") diff --git a/src/main/java/club/joylink/rtss/dao/CompanyDepartmentDAO.java b/src/main/java/club/joylink/rtss/dao/CompanyDepartmentDAO.java new file mode 100644 index 000000000..6276695d4 --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/CompanyDepartmentDAO.java @@ -0,0 +1,12 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.CompanyDepartment; +import club.joylink.rtss.entity.CompanyDepartmentExample; +import org.springframework.stereotype.Repository; + +/** + * CompanyDepartmentDAO继承基类 + */ +@Repository +public interface CompanyDepartmentDAO extends MyBatisBaseDao { +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/dao/CompanyPositionDAO.java b/src/main/java/club/joylink/rtss/dao/CompanyPositionDAO.java new file mode 100644 index 000000000..7a00d1f4e --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/CompanyPositionDAO.java @@ -0,0 +1,12 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.CompanyPosition; +import club.joylink.rtss.entity.CompanyPositionExample; +import org.springframework.stereotype.Repository; + +/** + * CompanyPositionDAO继承基类 + */ +@Repository +public interface CompanyPositionDAO extends MyBatisBaseDao { +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/dao/CompanyUserDAO.java b/src/main/java/club/joylink/rtss/dao/CompanyUserDAO.java new file mode 100644 index 000000000..6ee818ada --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/CompanyUserDAO.java @@ -0,0 +1,18 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.CompanyUser; +import club.joylink.rtss.entity.CompanyUserExample; +import club.joylink.rtss.entity.RaceQuestionMocksLikes; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * CompanyUserDAO继承基类 + */ +@Repository +public interface CompanyUserDAO extends MyBatisBaseDao { + +} diff --git a/src/main/java/club/joylink/rtss/dao/DepartmentExamDAO.java b/src/main/java/club/joylink/rtss/dao/DepartmentExamDAO.java new file mode 100644 index 000000000..e87b222c4 --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/DepartmentExamDAO.java @@ -0,0 +1,26 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.CompanyDepartment; +import club.joylink.rtss.entity.DepartmentExam; +import club.joylink.rtss.entity.DepartmentExamExample; +import club.joylink.rtss.entity.StudentClass; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * DepartmentExamDAO继承基类 + */ +@Repository +public interface DepartmentExamDAO extends MyBatisBaseDao { + + @Select("") + List getDepartsByExamId(@Param("examId") Long examId); +} diff --git a/src/main/java/club/joylink/rtss/dao/DepartmentLessonDAO.java b/src/main/java/club/joylink/rtss/dao/DepartmentLessonDAO.java new file mode 100644 index 000000000..00fa2ca00 --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/DepartmentLessonDAO.java @@ -0,0 +1,33 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.CompanyDepartment; +import club.joylink.rtss.entity.DepartmentLesson; +import club.joylink.rtss.entity.DepartmentLessonExample; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * DepartmentLessonDAO继承基类 + */ +@Repository +public interface DepartmentLessonDAO extends MyBatisBaseDao { + @Select("") + List getDeparts(@Param("lessonId") Long lessonId); + + @Select("") + List getClassNames(@Param("lessonId") Long lessonId); +} diff --git a/src/main/java/club/joylink/rtss/dao/DepartmentUserDAO.java b/src/main/java/club/joylink/rtss/dao/DepartmentUserDAO.java new file mode 100644 index 000000000..663ff192e --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/DepartmentUserDAO.java @@ -0,0 +1,22 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.DepartmentUser; +import club.joylink.rtss.entity.DepartmentUserExample; +import club.joylink.rtss.vo.client.company.CompanyDepartUserVO; +import club.joylink.rtss.vo.client.company.CompanyUserQueryVO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * DepartmentUserDAO继承基类 + */ +@Repository +public interface DepartmentUserDAO extends MyBatisBaseDao { + + + List getCompanyDepartUsers(CompanyUserQueryVO companyUserQueryVO); + + List getUserCompanyDeparts(@Param("companyId") Integer companyId,@Param("userId") Long userId); +} diff --git a/src/main/java/club/joylink/rtss/dao/SysUserDAO.java b/src/main/java/club/joylink/rtss/dao/SysUserDAO.java index cf068da2d..96b15a0af 100644 --- a/src/main/java/club/joylink/rtss/dao/SysUserDAO.java +++ b/src/main/java/club/joylink/rtss/dao/SysUserDAO.java @@ -47,7 +47,9 @@ public interface SysUserDAO extends MyBatisBaseDao") List statisticsDailyRegister(@Param("beginDate") LocalDate beginDate, @Param("endDate") LocalDate endDate); - List pagedQueryWithCompany(UserQueryVO queryVO); + List queryUsersWithCompany(UserQueryVO queryVO); + UserVO queryUserWithCompany(@Param("userId") Long userId); + UserVO queryCompanyUserByAccount(@Param("account") String account,@Param("companyId") Integer companyId); // @Results(value = { // @Result(column = "id", property = "id"), diff --git a/src/main/java/club/joylink/rtss/dao/UserCompanyRelDAO.java b/src/main/java/club/joylink/rtss/dao/UserCompanyRelDAO.java deleted file mode 100644 index cee5ad22a..000000000 --- a/src/main/java/club/joylink/rtss/dao/UserCompanyRelDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -package club.joylink.rtss.dao; - -import club.joylink.rtss.entity.UserCompanyRel; -import club.joylink.rtss.entity.UserCompanyRelExample; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * UserCompanyRelDAO继承基类 - */ -@Repository -public interface UserCompanyRelDAO extends MyBatisBaseDao { - void batchUpdate(List ucrList); -} diff --git a/src/main/java/club/joylink/rtss/entity/CompanyDepartment.java b/src/main/java/club/joylink/rtss/entity/CompanyDepartment.java new file mode 100644 index 000000000..9a3ab28b3 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyDepartment.java @@ -0,0 +1,104 @@ +package club.joylink.rtss.entity; + +import java.io.Serializable; + +/** + * company_department + * @author + */ +public class CompanyDepartment implements Serializable { + private Integer id; + + /** + * 部门名称 + */ + private String name; + + /** + * 单位id + */ + private Integer companyId; + + /** + * 父级id + */ + private Integer parentId; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getCompanyId() { + return companyId; + } + + public void setCompanyId(Integer companyId) { + this.companyId = companyId; + } + + public Integer getParentId() { + return parentId; + } + + public void setParentId(Integer parentId) { + this.parentId = parentId; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + CompanyDepartment other = (CompanyDepartment) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) + && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) + && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); + result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", name=").append(name); + sb.append(", companyId=").append(companyId); + sb.append(", parentId=").append(parentId); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/CompanyDepartmentExample.java b/src/main/java/club/joylink/rtss/entity/CompanyDepartmentExample.java new file mode 100644 index 000000000..f60b0cd8b --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyDepartmentExample.java @@ -0,0 +1,472 @@ +package club.joylink.rtss.entity; + +import java.util.ArrayList; +import java.util.List; + +public class CompanyDepartmentExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public CompanyDepartmentExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("`name` is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("`name` is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("`name` =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("`name` <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("`name` >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("`name` >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("`name` <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("`name` <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("`name` like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("`name` not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("`name` in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("`name` not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("`name` between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("`name` not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNull() { + addCriterion("company_id is null"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNotNull() { + addCriterion("company_id is not null"); + return (Criteria) this; + } + + public Criteria andCompanyIdEqualTo(Integer value) { + addCriterion("company_id =", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotEqualTo(Integer value) { + addCriterion("company_id <>", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThan(Integer value) { + addCriterion("company_id >", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThanOrEqualTo(Integer value) { + addCriterion("company_id >=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThan(Integer value) { + addCriterion("company_id <", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThanOrEqualTo(Integer value) { + addCriterion("company_id <=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdIn(List values) { + addCriterion("company_id in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotIn(List values) { + addCriterion("company_id not in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdBetween(Integer value1, Integer value2) { + addCriterion("company_id between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotBetween(Integer value1, Integer value2) { + addCriterion("company_id not between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andParentIdIsNull() { + addCriterion("parent_id is null"); + return (Criteria) this; + } + + public Criteria andParentIdIsNotNull() { + addCriterion("parent_id is not null"); + return (Criteria) this; + } + + public Criteria andParentIdEqualTo(Integer value) { + addCriterion("parent_id =", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdNotEqualTo(Integer value) { + addCriterion("parent_id <>", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdGreaterThan(Integer value) { + addCriterion("parent_id >", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdGreaterThanOrEqualTo(Integer value) { + addCriterion("parent_id >=", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdLessThan(Integer value) { + addCriterion("parent_id <", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdLessThanOrEqualTo(Integer value) { + addCriterion("parent_id <=", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdIn(List values) { + addCriterion("parent_id in", values, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdNotIn(List values) { + addCriterion("parent_id not in", values, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdBetween(Integer value1, Integer value2) { + addCriterion("parent_id between", value1, value2, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdNotBetween(Integer value1, Integer value2) { + addCriterion("parent_id not between", value1, value2, "parentId"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/CompanyPosition.java b/src/main/java/club/joylink/rtss/entity/CompanyPosition.java new file mode 100644 index 000000000..a675f4498 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyPosition.java @@ -0,0 +1,88 @@ +package club.joylink.rtss.entity; + +import java.io.Serializable; + +/** + * company_position + * @author + */ +public class CompanyPosition implements Serializable { + private Integer id; + + /** + * 职位名称 + */ + private String name; + + /** + * 单位id + */ + private Integer companyId; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getCompanyId() { + return companyId; + } + + public void setCompanyId(Integer companyId) { + this.companyId = companyId; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + CompanyPosition other = (CompanyPosition) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) + && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", name=").append(name); + sb.append(", companyId=").append(companyId); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/CompanyPositionExample.java b/src/main/java/club/joylink/rtss/entity/CompanyPositionExample.java new file mode 100644 index 000000000..1b87e932e --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyPositionExample.java @@ -0,0 +1,412 @@ +package club.joylink.rtss.entity; + +import java.util.ArrayList; +import java.util.List; + +public class CompanyPositionExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public CompanyPositionExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("`name` is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("`name` is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("`name` =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("`name` <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("`name` >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("`name` >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("`name` <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("`name` <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("`name` like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("`name` not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("`name` in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("`name` not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("`name` between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("`name` not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNull() { + addCriterion("company_id is null"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNotNull() { + addCriterion("company_id is not null"); + return (Criteria) this; + } + + public Criteria andCompanyIdEqualTo(Integer value) { + addCriterion("company_id =", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotEqualTo(Integer value) { + addCriterion("company_id <>", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThan(Integer value) { + addCriterion("company_id >", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThanOrEqualTo(Integer value) { + addCriterion("company_id >=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThan(Integer value) { + addCriterion("company_id <", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThanOrEqualTo(Integer value) { + addCriterion("company_id <=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdIn(List values) { + addCriterion("company_id in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotIn(List values) { + addCriterion("company_id not in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdBetween(Integer value1, Integer value2) { + addCriterion("company_id between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotBetween(Integer value1, Integer value2) { + addCriterion("company_id not between", value1, value2, "companyId"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/CompanyUser.java b/src/main/java/club/joylink/rtss/entity/CompanyUser.java new file mode 100644 index 000000000..355fcad72 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyUser.java @@ -0,0 +1,91 @@ +package club.joylink.rtss.entity; + +import java.io.Serializable; + +/** + * company_user + * @author + */ +public class CompanyUser implements Serializable { + /** + * 公司id + */ + private Integer companyId; + + /** + * 用户id + */ + private Long userId; + + /** + * 公司管理员 + */ + private Boolean admin; + + private static final long serialVersionUID = 1L; + + public Integer getCompanyId() { + return companyId; + } + + public void setCompanyId(Integer companyId) { + this.companyId = companyId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Boolean getAdmin() { + return admin; + } + + public void setAdmin(Boolean admin) { + this.admin = admin; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + CompanyUser other = (CompanyUser) that; + return (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) + && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) + && (this.getAdmin() == null ? other.getAdmin() == null : this.getAdmin().equals(other.getAdmin())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); + result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); + result = prime * result + ((getAdmin() == null) ? 0 : getAdmin().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", companyId=").append(companyId); + sb.append(", userId=").append(userId); + sb.append(", admin=").append(admin); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/CompanyUserExample.java b/src/main/java/club/joylink/rtss/entity/CompanyUserExample.java new file mode 100644 index 000000000..baed3d680 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyUserExample.java @@ -0,0 +1,402 @@ +package club.joylink.rtss.entity; + +import java.util.ArrayList; +import java.util.List; + +public class CompanyUserExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public CompanyUserExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andCompanyIdIsNull() { + addCriterion("company_id is null"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNotNull() { + addCriterion("company_id is not null"); + return (Criteria) this; + } + + public Criteria andCompanyIdEqualTo(Integer value) { + addCriterion("company_id =", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotEqualTo(Integer value) { + addCriterion("company_id <>", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThan(Integer value) { + addCriterion("company_id >", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThanOrEqualTo(Integer value) { + addCriterion("company_id >=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThan(Integer value) { + addCriterion("company_id <", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThanOrEqualTo(Integer value) { + addCriterion("company_id <=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdIn(List values) { + addCriterion("company_id in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotIn(List values) { + addCriterion("company_id not in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdBetween(Integer value1, Integer value2) { + addCriterion("company_id between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotBetween(Integer value1, Integer value2) { + addCriterion("company_id not between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(Long value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(Long value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(Long value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(Long value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(Long value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(Long value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(Long value1, Long value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(Long value1, Long value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andAdminIsNull() { + addCriterion("`admin` is null"); + return (Criteria) this; + } + + public Criteria andAdminIsNotNull() { + addCriterion("`admin` is not null"); + return (Criteria) this; + } + + public Criteria andAdminEqualTo(Boolean value) { + addCriterion("`admin` =", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminNotEqualTo(Boolean value) { + addCriterion("`admin` <>", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminGreaterThan(Boolean value) { + addCriterion("`admin` >", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminGreaterThanOrEqualTo(Boolean value) { + addCriterion("`admin` >=", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminLessThan(Boolean value) { + addCriterion("`admin` <", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminLessThanOrEqualTo(Boolean value) { + addCriterion("`admin` <=", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminIn(List values) { + addCriterion("`admin` in", values, "admin"); + return (Criteria) this; + } + + public Criteria andAdminNotIn(List values) { + addCriterion("`admin` not in", values, "admin"); + return (Criteria) this; + } + + public Criteria andAdminBetween(Boolean value1, Boolean value2) { + addCriterion("`admin` between", value1, value2, "admin"); + return (Criteria) this; + } + + public Criteria andAdminNotBetween(Boolean value1, Boolean value2) { + addCriterion("`admin` not between", value1, value2, "admin"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/DepartmentExam.java b/src/main/java/club/joylink/rtss/entity/DepartmentExam.java new file mode 100644 index 000000000..bb0b72c6d --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/DepartmentExam.java @@ -0,0 +1,69 @@ +package club.joylink.rtss.entity; + +import java.io.Serializable; + +/** + * department_exam + * @author + */ +public class DepartmentExam implements Serializable { + private Long examId; + + private Integer departmentId; + + private static final long serialVersionUID = 1L; + + public Long getExamId() { + return examId; + } + + public void setExamId(Long examId) { + this.examId = examId; + } + + public Integer getDepartmentId() { + return departmentId; + } + + public void setDepartmentId(Integer departmentId) { + this.departmentId = departmentId; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + DepartmentExam other = (DepartmentExam) that; + return (this.getExamId() == null ? other.getExamId() == null : this.getExamId().equals(other.getExamId())) + && (this.getDepartmentId() == null ? other.getDepartmentId() == null : this.getDepartmentId().equals(other.getDepartmentId())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getExamId() == null) ? 0 : getExamId().hashCode()); + result = prime * result + ((getDepartmentId() == null) ? 0 : getDepartmentId().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", examId=").append(examId); + sb.append(", departmentId=").append(departmentId); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/DepartmentExamExample.java b/src/main/java/club/joylink/rtss/entity/DepartmentExamExample.java new file mode 100644 index 000000000..3d8aaedf1 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/DepartmentExamExample.java @@ -0,0 +1,342 @@ +package club.joylink.rtss.entity; + +import java.util.ArrayList; +import java.util.List; + +public class DepartmentExamExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public DepartmentExamExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andExamIdIsNull() { + addCriterion("exam_id is null"); + return (Criteria) this; + } + + public Criteria andExamIdIsNotNull() { + addCriterion("exam_id is not null"); + return (Criteria) this; + } + + public Criteria andExamIdEqualTo(Long value) { + addCriterion("exam_id =", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdNotEqualTo(Long value) { + addCriterion("exam_id <>", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdGreaterThan(Long value) { + addCriterion("exam_id >", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdGreaterThanOrEqualTo(Long value) { + addCriterion("exam_id >=", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdLessThan(Long value) { + addCriterion("exam_id <", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdLessThanOrEqualTo(Long value) { + addCriterion("exam_id <=", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdIn(List values) { + addCriterion("exam_id in", values, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdNotIn(List values) { + addCriterion("exam_id not in", values, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdBetween(Long value1, Long value2) { + addCriterion("exam_id between", value1, value2, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdNotBetween(Long value1, Long value2) { + addCriterion("exam_id not between", value1, value2, "examId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIsNull() { + addCriterion("department_id is null"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIsNotNull() { + addCriterion("department_id is not null"); + return (Criteria) this; + } + + public Criteria andDepartmentIdEqualTo(Integer value) { + addCriterion("department_id =", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotEqualTo(Integer value) { + addCriterion("department_id <>", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdGreaterThan(Integer value) { + addCriterion("department_id >", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdGreaterThanOrEqualTo(Integer value) { + addCriterion("department_id >=", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdLessThan(Integer value) { + addCriterion("department_id <", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdLessThanOrEqualTo(Integer value) { + addCriterion("department_id <=", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIn(List values) { + addCriterion("department_id in", values, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotIn(List values) { + addCriterion("department_id not in", values, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdBetween(Integer value1, Integer value2) { + addCriterion("department_id between", value1, value2, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotBetween(Integer value1, Integer value2) { + addCriterion("department_id not between", value1, value2, "departmentId"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/DepartmentLesson.java b/src/main/java/club/joylink/rtss/entity/DepartmentLesson.java new file mode 100644 index 000000000..62aab28c9 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/DepartmentLesson.java @@ -0,0 +1,75 @@ +package club.joylink.rtss.entity; + +import java.io.Serializable; + +/** + * department_lesson + * @author + */ +public class DepartmentLesson implements Serializable { + /** + * 课程id + */ + private Long lessonId; + + /** + * 班级id + */ + private Integer departmentId; + + private static final long serialVersionUID = 1L; + + public Long getLessonId() { + return lessonId; + } + + public void setLessonId(Long lessonId) { + this.lessonId = lessonId; + } + + public Integer getDepartmentId() { + return departmentId; + } + + public void setDepartmentId(Integer departmentId) { + this.departmentId = departmentId; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + DepartmentLesson other = (DepartmentLesson) that; + return (this.getLessonId() == null ? other.getLessonId() == null : this.getLessonId().equals(other.getLessonId())) + && (this.getDepartmentId() == null ? other.getDepartmentId() == null : this.getDepartmentId().equals(other.getDepartmentId())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getLessonId() == null) ? 0 : getLessonId().hashCode()); + result = prime * result + ((getDepartmentId() == null) ? 0 : getDepartmentId().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", lessonId=").append(lessonId); + sb.append(", departmentId=").append(departmentId); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/DepartmentLessonExample.java b/src/main/java/club/joylink/rtss/entity/DepartmentLessonExample.java new file mode 100644 index 000000000..7f6c05a60 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/DepartmentLessonExample.java @@ -0,0 +1,342 @@ +package club.joylink.rtss.entity; + +import java.util.ArrayList; +import java.util.List; + +public class DepartmentLessonExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public DepartmentLessonExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andLessonIdIsNull() { + addCriterion("lesson_id is null"); + return (Criteria) this; + } + + public Criteria andLessonIdIsNotNull() { + addCriterion("lesson_id is not null"); + return (Criteria) this; + } + + public Criteria andLessonIdEqualTo(Long value) { + addCriterion("lesson_id =", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdNotEqualTo(Long value) { + addCriterion("lesson_id <>", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdGreaterThan(Long value) { + addCriterion("lesson_id >", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdGreaterThanOrEqualTo(Long value) { + addCriterion("lesson_id >=", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdLessThan(Long value) { + addCriterion("lesson_id <", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdLessThanOrEqualTo(Long value) { + addCriterion("lesson_id <=", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdIn(List values) { + addCriterion("lesson_id in", values, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdNotIn(List values) { + addCriterion("lesson_id not in", values, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdBetween(Long value1, Long value2) { + addCriterion("lesson_id between", value1, value2, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdNotBetween(Long value1, Long value2) { + addCriterion("lesson_id not between", value1, value2, "lessonId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIsNull() { + addCriterion("department_id is null"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIsNotNull() { + addCriterion("department_id is not null"); + return (Criteria) this; + } + + public Criteria andDepartmentIdEqualTo(Integer value) { + addCriterion("department_id =", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotEqualTo(Integer value) { + addCriterion("department_id <>", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdGreaterThan(Integer value) { + addCriterion("department_id >", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdGreaterThanOrEqualTo(Integer value) { + addCriterion("department_id >=", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdLessThan(Integer value) { + addCriterion("department_id <", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdLessThanOrEqualTo(Integer value) { + addCriterion("department_id <=", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIn(List values) { + addCriterion("department_id in", values, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotIn(List values) { + addCriterion("department_id not in", values, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdBetween(Integer value1, Integer value2) { + addCriterion("department_id between", value1, value2, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotBetween(Integer value1, Integer value2) { + addCriterion("department_id not between", value1, value2, "departmentId"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/UserCompanyRel.java b/src/main/java/club/joylink/rtss/entity/DepartmentUser.java similarity index 73% rename from src/main/java/club/joylink/rtss/entity/UserCompanyRel.java rename to src/main/java/club/joylink/rtss/entity/DepartmentUser.java index 58d8437e3..a297534da 100644 --- a/src/main/java/club/joylink/rtss/entity/UserCompanyRel.java +++ b/src/main/java/club/joylink/rtss/entity/DepartmentUser.java @@ -4,10 +4,10 @@ import java.io.Serializable; import java.time.LocalDateTime; /** - * user_company_rel + * department_user * @author */ -public class UserCompanyRel implements Serializable { +public class DepartmentUser implements Serializable { private Long id; /** @@ -16,12 +16,17 @@ public class UserCompanyRel implements Serializable { private Long userId; /** - * 单位id + * 部门id */ - private Integer companyId; + private Integer departmentId; /** - * 是否管理员 + * 职位id + */ + private Integer positionId; + + /** + * 部门管理员 */ private Boolean manager; @@ -53,12 +58,20 @@ public class UserCompanyRel implements Serializable { this.userId = userId; } - public Integer getCompanyId() { - return companyId; + public Integer getDepartmentId() { + return departmentId; } - public void setCompanyId(Integer companyId) { - this.companyId = companyId; + public void setDepartmentId(Integer departmentId) { + this.departmentId = departmentId; + } + + public Integer getPositionId() { + return positionId; + } + + public void setPositionId(Integer positionId) { + this.positionId = positionId; } public Boolean getManager() { @@ -96,10 +109,11 @@ public class UserCompanyRel implements Serializable { if (getClass() != that.getClass()) { return false; } - UserCompanyRel other = (UserCompanyRel) that; + DepartmentUser other = (DepartmentUser) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) - && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) + && (this.getDepartmentId() == null ? other.getDepartmentId() == null : this.getDepartmentId().equals(other.getDepartmentId())) + && (this.getPositionId() == null ? other.getPositionId() == null : this.getPositionId().equals(other.getPositionId())) && (this.getManager() == null ? other.getManager() == null : this.getManager().equals(other.getManager())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); @@ -111,7 +125,8 @@ public class UserCompanyRel implements Serializable { int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); - result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); + result = prime * result + ((getDepartmentId() == null) ? 0 : getDepartmentId().hashCode()); + result = prime * result + ((getPositionId() == null) ? 0 : getPositionId().hashCode()); result = prime * result + ((getManager() == null) ? 0 : getManager().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); @@ -126,7 +141,8 @@ public class UserCompanyRel implements Serializable { sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", userId=").append(userId); - sb.append(", companyId=").append(companyId); + sb.append(", departmentId=").append(departmentId); + sb.append(", positionId=").append(positionId); sb.append(", manager=").append(manager); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); diff --git a/src/main/java/club/joylink/rtss/entity/UserCompanyRelExample.java b/src/main/java/club/joylink/rtss/entity/DepartmentUserExample.java similarity index 80% rename from src/main/java/club/joylink/rtss/entity/UserCompanyRelExample.java rename to src/main/java/club/joylink/rtss/entity/DepartmentUserExample.java index 8ae625b99..b23a11291 100644 --- a/src/main/java/club/joylink/rtss/entity/UserCompanyRelExample.java +++ b/src/main/java/club/joylink/rtss/entity/DepartmentUserExample.java @@ -4,7 +4,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; -public class UserCompanyRelExample { +public class DepartmentUserExample { protected String orderByClause; protected boolean distinct; @@ -15,7 +15,7 @@ public class UserCompanyRelExample { private Long offset; - public UserCompanyRelExample() { + public DepartmentUserExample() { oredCriteria = new ArrayList(); } @@ -245,63 +245,123 @@ public class UserCompanyRelExample { return (Criteria) this; } - public Criteria andCompanyIdIsNull() { - addCriterion("company_id is null"); + public Criteria andDepartmentIdIsNull() { + addCriterion("department_id is null"); return (Criteria) this; } - public Criteria andCompanyIdIsNotNull() { - addCriterion("company_id is not null"); + public Criteria andDepartmentIdIsNotNull() { + addCriterion("department_id is not null"); return (Criteria) this; } - public Criteria andCompanyIdEqualTo(Integer value) { - addCriterion("company_id =", value, "companyId"); + public Criteria andDepartmentIdEqualTo(Integer value) { + addCriterion("department_id =", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdNotEqualTo(Integer value) { - addCriterion("company_id <>", value, "companyId"); + public Criteria andDepartmentIdNotEqualTo(Integer value) { + addCriterion("department_id <>", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdGreaterThan(Integer value) { - addCriterion("company_id >", value, "companyId"); + public Criteria andDepartmentIdGreaterThan(Integer value) { + addCriterion("department_id >", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdGreaterThanOrEqualTo(Integer value) { - addCriterion("company_id >=", value, "companyId"); + public Criteria andDepartmentIdGreaterThanOrEqualTo(Integer value) { + addCriterion("department_id >=", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdLessThan(Integer value) { - addCriterion("company_id <", value, "companyId"); + public Criteria andDepartmentIdLessThan(Integer value) { + addCriterion("department_id <", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdLessThanOrEqualTo(Integer value) { - addCriterion("company_id <=", value, "companyId"); + public Criteria andDepartmentIdLessThanOrEqualTo(Integer value) { + addCriterion("department_id <=", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdIn(List values) { - addCriterion("company_id in", values, "companyId"); + public Criteria andDepartmentIdIn(List values) { + addCriterion("department_id in", values, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdNotIn(List values) { - addCriterion("company_id not in", values, "companyId"); + public Criteria andDepartmentIdNotIn(List values) { + addCriterion("department_id not in", values, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdBetween(Integer value1, Integer value2) { - addCriterion("company_id between", value1, value2, "companyId"); + public Criteria andDepartmentIdBetween(Integer value1, Integer value2) { + addCriterion("department_id between", value1, value2, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdNotBetween(Integer value1, Integer value2) { - addCriterion("company_id not between", value1, value2, "companyId"); + public Criteria andDepartmentIdNotBetween(Integer value1, Integer value2) { + addCriterion("department_id not between", value1, value2, "departmentId"); + return (Criteria) this; + } + + public Criteria andPositionIdIsNull() { + addCriterion("position_id is null"); + return (Criteria) this; + } + + public Criteria andPositionIdIsNotNull() { + addCriterion("position_id is not null"); + return (Criteria) this; + } + + public Criteria andPositionIdEqualTo(Integer value) { + addCriterion("position_id =", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdNotEqualTo(Integer value) { + addCriterion("position_id <>", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdGreaterThan(Integer value) { + addCriterion("position_id >", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdGreaterThanOrEqualTo(Integer value) { + addCriterion("position_id >=", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdLessThan(Integer value) { + addCriterion("position_id <", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdLessThanOrEqualTo(Integer value) { + addCriterion("position_id <=", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdIn(List values) { + addCriterion("position_id in", values, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdNotIn(List values) { + addCriterion("position_id not in", values, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdBetween(Integer value1, Integer value2) { + addCriterion("position_id between", value1, value2, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdNotBetween(Integer value1, Integer value2) { + addCriterion("position_id not between", value1, value2, "positionId"); return (Criteria) this; } diff --git a/src/main/java/club/joylink/rtss/services/CompanyService.java b/src/main/java/club/joylink/rtss/services/CompanyService.java index bd0158738..19395c2e6 100644 --- a/src/main/java/club/joylink/rtss/services/CompanyService.java +++ b/src/main/java/club/joylink/rtss/services/CompanyService.java @@ -1,26 +1,25 @@ package club.joylink.rtss.services; -import club.joylink.rtss.dao.CompanyDAO; -import club.joylink.rtss.dao.UserCompanyRelDAO; +import club.joylink.rtss.dao.*; import club.joylink.rtss.entity.*; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.completition.IRaceQuestionsRuleService; import club.joylink.rtss.vo.UserVO; -import club.joylink.rtss.vo.client.CompanyQueryVO; -import club.joylink.rtss.vo.client.CompanyVO; +import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.PageVO; +import club.joylink.rtss.vo.client.company.*; +import club.joylink.rtss.vo.client.student.StudentClassVO; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; -import lombok.NonNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; @Service @@ -29,6 +28,12 @@ public class CompanyService implements ICompanyService { @Autowired private CompanyDAO companyDAO; + @Autowired + private CompanyUserDAO companyUserDAO; + + @Autowired + private CompanyDepartmentDAO departmentDAO; + @Autowired private IRaceQuestionsRuleService IRaceQuestionsRuleService; @@ -36,8 +41,15 @@ public class CompanyService implements ICompanyService { private ISysUserService iSysUserService; @Autowired - private UserCompanyRelDAO userCompanyRelDAO; + private DepartmentUserDAO departmentUserDAO; + @Autowired + private DepartmentLessonDAO departmentLessonDAO; + @Autowired + private DepartmentExamDAO departmentExamDAO; + @Autowired + private ILessonService lessonService; + //************************************单位管理********************************************** @Override public List queryOrganizations() { CompanyExample example = new CompanyExample(); @@ -55,61 +67,13 @@ public class CompanyService implements ICompanyService { criteria.andNameLike(String.format("%%%s%%", queryVO.getName())); } Page page = (Page) companyDAO.selectByExample(example); - List voList = page.getResult().stream().map(company -> { - List managers; - List ucrList = findUserCompanyRelEntity(company.getId(), true); - if (CollectionUtils.isEmpty(ucrList)) { - managers = new ArrayList<>(); - } else { - List managerIds = ucrList.stream().map(UserCompanyRel::getUserId).collect(Collectors.toList()); - managers = iSysUserService.findEntity(managerIds); - } - List managerVOs = UserVO.convert2BaseInfoVO(managers); - return CompanyVO.convertFromDB(company, managerVOs); - }).collect(Collectors.toList()); + List voList =CompanyVO.convert2VOList(page.getResult()); return PageVO.convert(page, voList); } @Override - public void addManager(Integer companyId, List userIds, UserVO user) { - iSysUserService.confirmAdmin(user); - List ucrList = getUserCompanyRelEntity(userIds); - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(ucrList.stream().allMatch(ucr -> ucr.getCompanyId().equals(companyId)), - "有的用户不属于该公司"); - LocalDateTime now = LocalDateTime.now(); - ucrList.forEach(ucr -> { - ucr.setManager(true); - ucr.setUpdateTime(now); - }); - userCompanyRelDAO.batchUpdate(ucrList); - } - - @Override - public void userBindCompany(Long userId, Integer companyId) { - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(companyId, - "绑定的公司id不能为null"); - createOrUpdateUserCompanyRel(userId, companyId); - } - - @Override - public List findUserCompanyRelEntity(List userIds) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andUserIdIn(userIds); - return userCompanyRelDAO.selectByExample(example); - } - - @Override - public void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin) { - iSysUserService.confirmSuperAdmin(superAdmin.getId()); - iSysUserService.confirmExist(userId); - createOrUpdateUserCompanyRel(userId, companyId); - } - - @Override - public void deleteUserCompanyRel(Long userId) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andUserIdEqualTo(userId); - userCompanyRelDAO.deleteByExample(example); + public void userScanCodeBindCompany(Long userId, Integer companyId) { + iSysUserService.userScanCodeBindCompany(userId, companyId); } @Override @@ -130,7 +94,6 @@ public class CompanyService implements ICompanyService { @Transactional @Override public void deleteCompanyById(Integer companyId) { - companyDAO.deleteByPrimaryKey(companyId); IRaceQuestionsRuleService.deleteByCompanyId(companyId); } @@ -142,6 +105,24 @@ public class CompanyService implements ICompanyService { String.format("id为[%s]的公司不存在", companyId)); return new CompanyVO(entity); } +// +// @Override +// public void addManager(Integer companyId, List userIds, UserVO user) { +// CompanyUserExample e = new CompanyUserExample(); +// e.createCriteria().andCompanyIdEqualTo(companyId).andUserIdIn(userIds); +// CompanyUser cu =new CompanyUser(); +// cu.setAdmin(true); +// companyUserDAO.updateByExampleSelective(cu,e); +// } +// +// @Override +// public void removeManager(Integer companyId, List userIds, UserVO user) { +// CompanyUserExample e = new CompanyUserExample(); +// e.createCriteria().andCompanyIdEqualTo(companyId).andUserIdIn(userIds); +// CompanyUser cu =new CompanyUser(); +// cu.setAdmin(false); +// companyUserDAO.updateByExampleSelective(cu,e); +// } @Override public boolean isExist(Integer companyId) { @@ -153,62 +134,402 @@ public class CompanyService implements ICompanyService { private Company getCompanyEntity(Integer id) { Company company = companyDAO.selectByPrimaryKey(id); - BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company,String.format("单位[%s]不存在",id)); return company; } - private List findUserCompanyRelEntity(Integer companyId, boolean manager) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andCompanyIdEqualTo(companyId).andManagerEqualTo(manager); - return userCompanyRelDAO.selectByExample(example); + @Override + public boolean isCompanyUser(Long userId) { + CompanyUserExample e = new CompanyUserExample(); + e.createCriteria().andUserIdEqualTo(userId); + return companyUserDAO.countByExample(e)>0; + + } - private List getUserCompanyRelEntity(@NonNull List userIds) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andUserIdIn(userIds); - List ucrList = userCompanyRelDAO.selectByExample(example); - BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(ucrList, "这些用户不属于任何公司"); - return ucrList; + //************************************部门管理********************************************** + + /** + * 增加部门 + */ + @Override + public DepartmentVO createDepart(DepartmentVO departmentVO) { + BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(departmentIsExist(departmentVO), "同级部门信息重复"); + CompanyDepartment entity = departmentVO.toDB(); + departmentDAO.insert(entity); + departmentVO.setId(entity.getId()); + return departmentVO; } - private List findUserCompanyRelEntity(Integer companyId) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andCompanyIdEqualTo(companyId); - return userCompanyRelDAO.selectByExample(example); + /** + * 修改部门 + */ + @Override + public void updateDepartInfo(Integer deptId, DepartmentVO departmentVO) { + CompanyDepartment entity = departmentVO.toDB(); + entity.setId(deptId); + entity.setCompanyId(null); + departmentDAO.updateByPrimaryKeySelective(entity); } - private UserCompanyRel getUserCompanyRelEntity(Long userId) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andUserIdEqualTo(userId); - List ucrs = userCompanyRelDAO.selectByExample(example); - BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(ucrs); - return ucrs.get(0); + /** + * 删除部门 + */ + @Override + public void deleteDepartById(Integer deptId) { + departmentDAO.deleteByPrimaryKey(deptId); } - private UserCompanyRel findUserCompanyRelEntity(Long userId) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andUserIdEqualTo(userId); - List ucrs = userCompanyRelDAO.selectByExample(example); - if (CollectionUtils.isEmpty(ucrs)) { + /** + * 查询部门信息 + */ + @Override + public DepartmentVO getDepartById(Integer deptId) { + CompanyDepartment entity = departmentDAO.selectByPrimaryKey(deptId); + if (Objects.isNull(entity)) { return null; } + return new DepartmentVO(entity); + } + + /** + * 根据单位id查询部门及其子部门信息 + */ + @Override + public List getCompanyDepartTree(Integer companyId) { + CompanyDepartmentExample example = new CompanyDepartmentExample(); + example.createCriteria().andCompanyIdEqualTo(companyId); + List companyDepartments = departmentDAO.selectByExample(example); + return DepartmentVO.buildDeptTree(DepartmentVO.convert2VOList(companyDepartments)); + } + + @Override + public List getCompanyAllDepart(Integer companyId) { + CompanyDepartmentExample example = new CompanyDepartmentExample(); + example.createCriteria().andCompanyIdEqualTo(companyId); + List companyDepartments = departmentDAO.selectByExample(example); + return DepartmentVO.convert2VOList(companyDepartments); + } + + @Override + public DepartmentVO getDepartTree(Integer companyId, Integer deptId) { + CompanyDepartment companyDepartment = departmentDAO.selectByPrimaryKey(deptId); + CompanyDepartmentExample example = new CompanyDepartmentExample(); + example.createCriteria().andCompanyIdEqualTo(companyId); + List companyDepartments = departmentDAO.selectByExample(example); + List childDept = DepartmentVO.getChildDept(deptId, DepartmentVO.convert2VOList(companyDepartments)); + DepartmentVO departmentVO = new DepartmentVO(companyDepartment); + departmentVO.setChildDept(childDept); + return departmentVO; + } + + @Override + public List getDepartAndChild(Integer companyId, Integer deptId) { + var example = new CompanyDepartmentExample(); + example.createCriteria().andCompanyIdEqualTo(companyId); + var companyDepartments = departmentDAO.selectByExample(example); + var childDept = DepartmentVO.getChildDeptList(deptId, DepartmentVO.convert2VOList(companyDepartments)); + var companyDepartment = departmentDAO.selectByPrimaryKey(deptId); + childDept.add(new DepartmentVO(companyDepartment)); + return childDept; + } + + + private boolean departmentIsExist(DepartmentVO departmentVO) { + var example = new CompanyDepartmentExample(); + CompanyDepartmentExample.Criteria criteria = example.createCriteria() + .andCompanyIdEqualTo(departmentVO.getCompanyId()) + .andNameEqualTo(departmentVO.getName()); + if (Objects.isNull(departmentVO.getParentId())) { + criteria + .andParentIdIsNull(); + } else { + criteria + .andParentIdEqualTo(departmentVO.getParentId()); + } + + if (departmentDAO.countByExample(example) == 0) { + return false; + } + return true; + } + + + //************************************职位管理********************************************** + +// /** +// * 增加职位 +// */ +// @Override +// public PositionVO createPosition(PositionVO positionVO) { +// BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(positionIsExist(positionVO), "相同的职位信息"); +// var entity = positionVO.toDB(); +// positionDAO.insert(entity); +// positionVO.setId(entity.getId()); +// return positionVO; +// } +// +// private boolean positionIsExist(PositionVO positionVO) { +// var example = new CompanyPositionExample(); +// example.createCriteria() +// .andCompanyIdEqualTo(positionVO.getCompanyId()) +// .andNameEqualTo(positionVO.getName()); +// if (positionDAO.countByExample(example) == 0) { +// return false; +// } +// return true; +// } +// +// /** +// * 修改职位 +// */ +// @Override +// public void updatePositionInfo(Integer positionId, PositionVO positionVO) { +// var entity = positionVO.toDB(); +// entity.setId(positionId); +// entity.setCompanyId(null); +// positionDAO.updateByPrimaryKeySelective(entity); +// } +// +// /** +// * 删除职位 +// */ +// @Override +// public void deletePositionById(Integer positionId) { +// positionDAO.deleteByPrimaryKey(positionId); +// } +// +// /** +// * 查询职位信息 +// */ +// @Override +// public PositionVO getPositionById(Integer positionId) { +// var entity = positionDAO.selectByPrimaryKey(positionId); +// if (Objects.isNull(entity)) { +// return null; +// } +// return new PositionVO(entity); +// } +// +// /** +// * 查询单位所有职位信息 +// */ +// @Override +// public List getPositionsByCompanyId(Integer companyId) { +// var example = new CompanyPositionExample(); +// example.createCriteria() +// .andCompanyIdEqualTo(companyId); +// List companyPositions = positionDAO.selectByExample(example); +// return PositionVO.convert2VOList(companyPositions); +// } + + //************************************单位-部门-职位-用户 关系********************************************** + + + private DepartmentUser getDepartUseRelEntity(Long userId, Integer departId) { + DepartmentUserExample example = new DepartmentUserExample(); + example.createCriteria() + .andUserIdEqualTo(userId) + .andDepartmentIdEqualTo(departId); + List ucrs = departmentUserDAO.selectByExample(example); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(ucrs, "非部门" + departId + "内部用户"); return ucrs.get(0); } - private void createOrUpdateUserCompanyRel(Long userId, Integer companyId) { - UserVO user = iSysUserService.getUserById(userId); - Company company = getCompanyEntity(companyId); - UserCompanyRel ucr = findUserCompanyRelEntity(userId); - if (ucr == null) { - UserCompanyRel newUcr = new UserCompanyRel(); - newUcr.setUserId(user.getId()); - newUcr.setCompanyId(company.getId()); - newUcr.setCreateTime(LocalDateTime.now()); - userCompanyRelDAO.insert(newUcr); - } else { - ucr.setCompanyId(companyId); - userCompanyRelDAO.updateByPrimaryKey(ucr); - } + @Override + public List getDepartRefByUserId(Long userId) { + DepartmentUserExample e = new DepartmentUserExample(); + e.createCriteria().andUserIdEqualTo(userId); + List departmentUserRefs = this.departmentUserDAO.selectByExample(e); + return UserDepartRelVO.convert2VOList(departmentUserRefs); + } + /**添加部门-职位-用户关系*/ + @Override + public void addDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO) { + var userRel = getDepartUseRelEntity(user.getId(), userDepartRelVO.getDepartmentId()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(userRel, "非本部门无法操作"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(userRel.getManager(), "非部门管理员无法操作"); + DepartmentUser departmentUser = getDepartUseRelEntity(userDepartRelVO.getUserId(), userDepartRelVO.getDepartmentId()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNull(departmentUser, "已存在的部门成员"); + departmentUserDAO.insertSelective(userDepartRelVO.toDB()); } + /**更新部门-职位-用户关系*/ + @Override + public void updateDepartUserInfo(UserVO user,UserDepartRelVO userDepartRelVO) { + var userRel = getDepartUseRelEntity(user.getId(), userDepartRelVO.getDepartmentId()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(userRel, "非本部门无法操作"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(userRel.getManager(), "非部门管理员无法操作"); + DepartmentUser departmentUser = getDepartUseRelEntity(userDepartRelVO.getUserId(), userDepartRelVO.getDepartmentId()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(departmentUser, "不存在的部门成员"); + departmentUser.setPositionId(userDepartRelVO.getPositionId()); + departmentUser.setManager(userDepartRelVO.isManager()); + } + + /** 删除部门-职位-用户关系*/ + @Override + public void deleteDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO) { + DepartmentUser userRel = getDepartUseRelEntity(user.getId(), userDepartRelVO.getDepartmentId()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(userRel, "非本部门成员"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(userRel.getManager(), "非部门管理员无法操作"); + DepartmentUserExample example = new DepartmentUserExample(); + example.createCriteria().andDepartmentIdEqualTo(userDepartRelVO.getDepartmentId()).andUserIdEqualTo(userDepartRelVO.getUserId()); + departmentUserDAO.deleteByExample(example); + } + + @Override + public List getUserCompanyDeparts(UserVO user, Integer companyId) { + //根据公司id和用户id查询用户企业详细信息 + return departmentUserDAO.getUserCompanyDeparts(companyId,user.getId()); + } + + @Override + public PageVO getCompanyDepartUserInfoList(UserVO user, Integer departId, CompanyUserQueryVO companyUserQueryVO) { + + //根据部门id查询部门成员 + companyUserQueryVO.setDepartmentId(departId); + PageHelper.startPage(companyUserQueryVO.getPageNum(), companyUserQueryVO.getPageSize()); + Page page = (Page) departmentUserDAO.getCompanyDepartUsers(companyUserQueryVO); + return PageVO.convert(page); + } + + @Transactional + @Override + public void importCompanyUserInfo(UserVO user, Integer companyId, ImportCompanyUserVO importCompanyUserVO) { + + //验证操作人员 + Company company = getCompanyEntity(companyId); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(company, "单位不存在"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(user.getCompanyId(), companyId, "非同单位成员无法操作"); + + //验证是否存在并导入新的年级和班级 + var departmentExample = new CompanyDepartmentExample(); + departmentExample.createCriteria() + .andCompanyIdEqualTo(companyId) + .andNameEqualTo(importCompanyUserVO.getParentDepart()); + List importParentDepart = departmentDAO.selectByExample(departmentExample); + DepartmentVO parentDepart; + DepartmentVO childDepart; + if (CollectionUtils.isEmpty(importParentDepart)) { + parentDepart = new DepartmentVO(importCompanyUserVO.getParentDepart(), companyId, null); + createDepart(parentDepart); + childDepart = new DepartmentVO(importCompanyUserVO.getDepart(), companyId, parentDepart.getId()); + createDepart(childDepart); + UserDepartRelVO userDepartRelVO = new UserDepartRelVO(user.getId(), childDepart.getId(), null, true); + departmentUserDAO.insertSelective(userDepartRelVO.toDB()); + } else { + parentDepart = new DepartmentVO(importParentDepart.get(0)); + departmentExample.clear(); + CompanyDepartmentExample.Criteria criteria = departmentExample.createCriteria() + .andCompanyIdEqualTo(companyId) + .andNameEqualTo(importCompanyUserVO.getDepart()); + if (Objects.isNull(parentDepart.getParentId())) { + criteria + .andParentIdIsNull(); + } else { + + criteria + .andParentIdEqualTo(parentDepart.getParentId()); + } + List importChildDepart = departmentDAO.selectByExample(departmentExample); + if (CollectionUtils.isEmpty(importChildDepart)) { + childDepart = new DepartmentVO(importCompanyUserVO.getDepart(), companyId, parentDepart.getId()); + createDepart(childDepart); + UserDepartRelVO userDepartRelVO = new UserDepartRelVO(user.getId(), childDepart.getId(), null, true); + departmentUserDAO.insertSelective(userDepartRelVO.toDB()); + } else { + childDepart = new DepartmentVO(importChildDepart.get(0)); + DepartmentUserExample departmentUserExample = new DepartmentUserExample(); + departmentUserExample.createCriteria().andUserIdEqualTo(user.getId()).andDepartmentIdEqualTo(childDepart.getId()); + List departmentUsers = departmentUserDAO.selectByExample(departmentUserExample); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertCollectionEmpty(departmentUsers, "非部门成员/导入部门信息重复"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(departmentUsers.get(0).getManager(), "非部门管理员"); + } + } + + //构建系统用户对象 + List sysUsers = CompanyUserVO.convert2DBList(importCompanyUserVO.getCompanyUsers()); + sysUsers.forEach(sysUser -> { + UserVO userVO = iSysUserService.queryCompanyUserByAccount(companyId, sysUser.getAccount()); + if (Objects.isNull(userVO)) { + iSysUserService.createUser(sysUser); + userVO = new UserVO(sysUser); + iSysUserService.userBindCompany(userVO, companyId,false); + UserDepartRelVO userDepartRelVO = new UserDepartRelVO(userVO.getId(), childDepart.getId(), null, false); + departmentUserDAO.insertSelective(userDepartRelVO.toDB()); + } else { + DepartmentUserExample departmentUserExample = new DepartmentUserExample(); + departmentUserExample.createCriteria().andUserIdEqualTo(userVO.getId()).andDepartmentIdEqualTo(childDepart.getId()); + List userDeparts = departmentUserDAO.selectByExample(departmentUserExample); + if (CollectionUtils.isEmpty(userDeparts)) { + UserDepartRelVO userDepartRelVO = new UserDepartRelVO(userVO.getId(), childDepart.getId(), null, false); + departmentUserDAO.insertSelective(userDepartRelVO.toDB()); + } + } + }); + } + + //---------------------------课程 / 考试 / 部门----------------------------------------- + + @Override + public List getDepartsByLesson(Long lessonId) { + List classes = this.departmentLessonDAO.getDeparts(lessonId); + return DepartmentVO.convert2VOList(classes); + } + + @Override + public List getDepartsByExamId(Long examId) { + DepartmentExamExample example = new DepartmentExamExample(); + example.createCriteria().andExamIdEqualTo(examId); + List classes = this.departmentExamDAO.getDepartsByExamId(examId); + return DepartmentVO.convert2VOList(classes); + } + + @Override + public List getExamIdsByDepartId(Integer departId) { + DepartmentExamExample example = new DepartmentExamExample(); + example.createCriteria().andDepartmentIdEqualTo(departId); + List departmentExamRefs = this.departmentExamDAO.selectByExample(example); + return departmentExamRefs.stream().map(DepartmentExam::getExamId).collect(Collectors.toList()); + } + // + @Override + public void deleteDepartsExam(Long examId) { + DepartmentExamExample example = new DepartmentExamExample(); + example.createCriteria().andExamIdEqualTo(examId); + departmentExamDAO.deleteByExample(example); + } + + //TODO 判是否存在 + @Override + public void addDepartExam(Long examId, Integer departId) { + DepartmentExam departmentExam = new DepartmentExam(); + departmentExam.setExamId(examId); + departmentExam.setDepartmentId(departId); + departmentExamDAO.insert(departmentExam); + } + + @Override + public List getDepartLessonRefs(Integer departId) { + DepartmentLessonExample example = new DepartmentLessonExample(); + example.createCriteria().andDepartmentIdEqualTo(departId); + List departmentLessonRef = this.departmentLessonDAO.selectByExample(example); + return departmentLessonRef; + } + + @Override + public List getLessonsByDepart(Integer departId) { + List lessonIds = getDepartLessonRefs(departId).stream().map(DepartmentLesson::getLessonId).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(lessonIds)) return new ArrayList<>(); + return lessonService.getValidLesson(lessonIds, null); + } + + @Override + public List getDepartNamesByLesson(Long LessonId) { + List classes = this.departmentLessonDAO.getClassNames(LessonId); + return classes; + } + + + } diff --git a/src/main/java/club/joylink/rtss/services/ExamService.java b/src/main/java/club/joylink/rtss/services/ExamService.java index 43196e86d..93249cec1 100644 --- a/src/main/java/club/joylink/rtss/services/ExamService.java +++ b/src/main/java/club/joylink/rtss/services/ExamService.java @@ -4,10 +4,10 @@ import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.dao.*; import club.joylink.rtss.entity.*; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; -import club.joylink.rtss.services.student.IClassStudentUserService; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.*; -import club.joylink.rtss.vo.client.student.StudentClassVO; +import club.joylink.rtss.vo.client.company.DepartmentVO; +import club.joylink.rtss.vo.client.company.UserDepartRelVO; import club.joylink.rtss.vo.client.userPermission.UserPermissionVO; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; @@ -54,7 +54,7 @@ public class ExamService implements IExamService{ private ExamDefinitionRulesDAO examDefinitionRulesDAO; @Autowired - private IClassStudentUserService iClassStudentUserService; + private ICompanyService iCompanyService; /** * 创建考试定义 @@ -158,7 +158,7 @@ public class ExamService implements IExamService{ examDefinitionDAO.insert(examDefinition); //插入试卷班级关系 if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { - examDefinitionVO.getClasses().forEach(studentClassVO -> iClassStudentUserService.addExamRelClass(examDefinition.getId(),studentClassVO.getId())); + examDefinitionVO.getClasses().forEach(departmentVO -> iCompanyService.addDepartExam(examDefinition.getId(),departmentVO.getId())); } //插入试题规则表数据 List examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList(); @@ -266,7 +266,7 @@ public class ExamService implements IExamService{ examDefinitionRulesVOList.add(examDefinitionRulesVO); }); ExamDefinitionVO examDefinitionVO = new ExamDefinitionVO(examDefinition); - examDefinitionVO.setClasses(iClassStudentUserService.getClassesByExamId(examId)); + examDefinitionVO.setClasses(iCompanyService.getDepartsByExamId(examId)); examDefinitionVO.setExamDefinitionRulesVOList(examDefinitionRulesVOList); return examDefinitionVO; @@ -281,11 +281,12 @@ public class ExamService implements IExamService{ //查询课程信息 LessonVO lessonVO = iLessonService.getLessonInfo(lessonId); // 如果用户关联班级 查找班级关联试卷 - List studentRelIdClasses = this.iClassStudentUserService.getRelClassByUser(userVO.getId()); - List examIds = null; - if (!CollectionUtils.isEmpty(studentRelIdClasses)) { - Integer classId = studentRelIdClasses.get(0).getClassId(); - examIds = iClassStudentUserService.getRelExamIdsByClassId(classId); + List userDepartRelVOS = this.iCompanyService.getDepartRefByUserId(userVO.getId()); + List examIds = new ArrayList<>(); + if (!CollectionUtils.isEmpty(userDepartRelVOS)) { + for (UserDepartRelVO udr : userDepartRelVOS) { + examIds.addAll(iCompanyService.getExamIdsByDepartId(udr.getDepartmentId())); + } } //查询课程下的试题信息 ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); @@ -299,7 +300,7 @@ public class ExamService implements IExamService{ if (null != exam.getEndTime() && now.isAfter(exam.getEndTime())) { this.offLine(exam.getId(), userVO); iterator.remove(); - } else if (Objects.nonNull(examIds) && !examIds.contains(exam.getId())) { + } else if (!examIds.contains(exam.getId())) { iterator.remove(); } } @@ -309,9 +310,9 @@ public class ExamService implements IExamService{ examDefinitionList.forEach(examDefinition -> { ExamDefinitionVO exam = new ExamDefinitionVO(examDefinition); // 试卷存在班级关系,获取班级列表 - List classes = iClassStudentUserService.getClassesByExamId(examDefinition.getId()); - if (!CollectionUtils.isEmpty(classes)) { - exam.setClasses(classes); + List departs = iCompanyService.getDepartsByExamId(examDefinition.getId()); + if (!CollectionUtils.isEmpty(departs)) { + exam.setClasses(departs); } examDefinitionVOList.add(exam); }); @@ -476,9 +477,11 @@ public class ExamService implements IExamService{ public void update(Long id, ExamDefinitionVO examDefinitionVO) { ExamDefinition examDefinition = this.examDefinitionDAO.selectByPrimaryKey(id); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(examDefinition); - iClassStudentUserService.getClassesByExamId(id).forEach(studentClassVO -> iClassStudentUserService.deleteExamRelClass(id)); - if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())){ - examDefinitionVO.getClasses().forEach(studentClassVO -> iClassStudentUserService.addExamRelClass(id, studentClassVO.getId())); + if (!CollectionUtils.isEmpty(iCompanyService.getDepartsByExamId(id))) { + iCompanyService.deleteDepartsExam(id); + } + if (!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { + examDefinitionVO.getClasses().forEach(departmentVO -> iCompanyService.addDepartExam(id, departmentVO.getId())); } //考试名称查重 String name = examDefinitionVO.getName(); diff --git a/src/main/java/club/joylink/rtss/services/ICompanyService.java b/src/main/java/club/joylink/rtss/services/ICompanyService.java index a20c8534a..47f70033d 100644 --- a/src/main/java/club/joylink/rtss/services/ICompanyService.java +++ b/src/main/java/club/joylink/rtss/services/ICompanyService.java @@ -1,10 +1,10 @@ package club.joylink.rtss.services; -import club.joylink.rtss.entity.UserCompanyRel; +import club.joylink.rtss.entity.DepartmentLesson; import club.joylink.rtss.vo.UserVO; -import club.joylink.rtss.vo.client.CompanyQueryVO; -import club.joylink.rtss.vo.client.CompanyVO; +import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.PageVO; +import club.joylink.rtss.vo.client.company.*; import java.util.List; @@ -20,32 +20,93 @@ public interface ICompanyService { CompanyVO getCompanyById(Integer companyId); +// void removeManager(Integer companyId, List userIds, UserVO user); + boolean isExist(Integer companyId); PageVO queryPageOrganizations(CompanyQueryVO queryVO); - - /** - * 添加公司管理员 - */ - void addManager(Integer companyId, List userIds, UserVO user); +// +// /** +// * 添加公司管理员 +// */ +// void addManager(Integer companyId, List userIds, UserVO user); /** * 用户绑定单位 */ - void userBindCompany(Long userId, Integer companyId); + void userScanCodeBindCompany(Long userId, Integer companyId); - /** - * 查询用户公司关联关系 - */ - List findUserCompanyRelEntity(List collect); +// /** +// * 查询用户公司关联关系 +// */ +// List findUserCompanyRelEntity(List collect); +// +// /** +// * 超管修改用户的单位 +// */ +// void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin); +// +// /** +// * 删除用户和公司的关联关系 +// */ +// void deleteUserCompanyRel(Long userId); - /** - * 超管修改用户的单位 - */ - void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin); + boolean isCompanyUser(Long userId); - /** - * 删除用户和公司的关联关系 - */ - void deleteUserCompanyRel(Long userId); + DepartmentVO createDepart(DepartmentVO departmentVO); + + void updateDepartInfo(Integer id, DepartmentVO departmentVO); + + void deleteDepartById(Integer deptId); + + DepartmentVO getDepartById(Integer deptId); + + List getCompanyDepartTree(Integer companyId); + + List getCompanyAllDepart(Integer companyId); + + DepartmentVO getDepartTree(Integer companyId, Integer deptId); + + List getDepartAndChild(Integer companyId, Integer deptId); + +// PositionVO createPosition(PositionVO positionVO); +// +// void updatePositionInfo(Integer positionId, PositionVO positionVO); +// +// void deletePositionById(Integer positionId); +// +// PositionVO getPositionById(Integer positionId); +// +// List getPositionsByCompanyId(Integer companyId); + + List getDepartRefByUserId(Long userId); + + void addDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO); + + void updateDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO); + + void deleteDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO); + + + List getUserCompanyDeparts(UserVO user, Integer companyId); + + PageVO getCompanyDepartUserInfoList(UserVO user, Integer companyId, CompanyUserQueryVO companyUserQueryVO); + + void importCompanyUserInfo(UserVO user, Integer companyId, ImportCompanyUserVO importCompanyUserVO); + + List getDepartsByLesson(Long lessonId); + + List getDepartsByExamId(Long examId); + + List getExamIdsByDepartId(Integer departId); + + void deleteDepartsExam(Long examId); + + void addDepartExam(Long examId, Integer departId); + + List getDepartLessonRefs(Integer departId); + + List getLessonsByDepart(Integer departId); + + List getDepartNamesByLesson(Long LessonId); } diff --git a/src/main/java/club/joylink/rtss/services/ISysUserService.java b/src/main/java/club/joylink/rtss/services/ISysUserService.java index 320d1ab71..86dcb6568 100644 --- a/src/main/java/club/joylink/rtss/services/ISysUserService.java +++ b/src/main/java/club/joylink/rtss/services/ISysUserService.java @@ -7,11 +7,15 @@ import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.UserConfigVO; import club.joylink.rtss.vo.client.user.*; import club.joylink.rtss.vo.wx.WmUserSession; +import org.springframework.transaction.annotation.Transactional; import java.util.List; public interface ISysUserService { + + UserVO queryCompanyUserByAccount(Integer companyId, String account); + /** * 根据openId查询用户 * @param openid @@ -139,6 +143,11 @@ public interface ISysUserService { */ UserVO createUserOfWechatMicro(WmUserSession wmUserSession); + @Transactional + void batchCreateUser(List newSysUsers); + + void createUser(SysUser sysUser); + /** * 更新用户微信小程序openid * @param id @@ -273,7 +282,7 @@ public interface ISysUserService { */ void userBindWm(String code, Long userId); - void userBindCompany(Long userId, Integer companyId); + void userScanCodeBindCompany(Long userId, Integer companyId); UserVO getUserBaseInfoById(Long id); @@ -292,8 +301,12 @@ public interface ISysUserService { void superAdminUpdateUserInfo(UserVO updateUser, UserVO superAdmin); + void userBindCompany(UserVO userVO, Integer companyId,boolean companyAdmin); + /** * 查询所有的销售人员 */ List querySellers(); + + void deleteById(Long id); } diff --git a/src/main/java/club/joylink/rtss/services/LessonService.java b/src/main/java/club/joylink/rtss/services/LessonService.java index 6d1be8576..bb17c1c6a 100644 --- a/src/main/java/club/joylink/rtss/services/LessonService.java +++ b/src/main/java/club/joylink/rtss/services/LessonService.java @@ -24,6 +24,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.NotEmpty; import java.time.LocalDateTime; import java.util.*; import java.util.function.Function; @@ -70,10 +71,10 @@ public class LessonService implements ILessonService { private ITrainingV1Service iTrainingV1Service; @Autowired - private StudentRelLessonClassDAO studentRelLessonClassDAO; + private IExamService iExamService; @Autowired - private IExamService iExamService; + private DepartmentLessonDAO departmentLessonDAO; @Override public LessonTreeVO getLessonTree(Long id, UserVO userVO) { @@ -211,26 +212,25 @@ public class LessonService implements ILessonService { newLesson.setId(publishedLesson.getId()); this.lessonDAO.updateByPrimaryKey(newLesson); //课程存在,预备检查与班级的关系 - StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample(); - relLessonClassExample.createCriteria().andLessonIdEqualTo(publishedLesson.getId()); - List studentRelLessonClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample); + DepartmentLessonExample departmentLessonExample = new DepartmentLessonExample(); + departmentLessonExample.createCriteria().andLessonIdEqualTo(publishedLesson.getId()); + List departmentLessonRefs = this.departmentLessonDAO.selectByExample(departmentLessonExample); if (!CollectionUtils.isEmpty(publishVO.getClassIdList())) { - //目前GZB项目带班级发布 - if (!CollectionUtils.isEmpty(studentRelLessonClasses)) { - List existedClassIds = studentRelLessonClasses.stream().map(StudentRelLessonClass::getClassId).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(departmentLessonRefs)) { + List existedClassIds = departmentLessonRefs.stream().map(DepartmentLesson::getDepartmentId).collect(Collectors.toList()); Collections.sort(existedClassIds); Collections.sort(publishVO.getClassIdList()); if (!existedClassIds.equals(publishVO.getClassIdList())) { //清除现有课程班级关系 - this.studentRelLessonClassDAO.deleteByExample(relLessonClassExample); + this.departmentLessonDAO.deleteByExample(departmentLessonExample); addRelLessonClass(publishVO, publishedLesson.getId()); } } else { addRelLessonClass(publishVO, publishedLesson.getId()); } } else { - if (!CollectionUtils.isEmpty(studentRelLessonClasses)) { - this.studentRelLessonClassDAO.deleteByExample(relLessonClassExample); + if (!CollectionUtils.isEmpty(departmentLessonRefs)) { + this.departmentLessonDAO.deleteByExample(departmentLessonExample); } } // if(!lessonVo.getName().equals(publishedLesson.getName())) { @@ -533,7 +533,7 @@ public class LessonService implements ILessonService { } @Override - public List getValidLesson(@NonNull List ids, String prdType) { + public List getValidLesson(@NotEmpty List ids, String prdType) { return lessonDAO.getValidLesson(ids, prdType); } @@ -778,10 +778,10 @@ public class LessonService implements ILessonService { */ private void addRelLessonClass(LessonPublishVO publishVO, Long id) { publishVO.getClassIdList().forEach(classId -> { - StudentRelLessonClass relLessonClass = new StudentRelLessonClass(); - relLessonClass.setClassId(classId); - relLessonClass.setLessonId(id); - this.studentRelLessonClassDAO.insert(relLessonClass); + DepartmentLesson departmentLesson = new DepartmentLesson(); + departmentLesson.setDepartmentId(classId); + departmentLesson.setLessonId(id); + this.departmentLessonDAO.insert(departmentLesson); }); } diff --git a/src/main/java/club/joylink/rtss/services/MapSystemService.java b/src/main/java/club/joylink/rtss/services/MapSystemService.java index 4a13ffcab..7d823f9b3 100644 --- a/src/main/java/club/joylink/rtss/services/MapSystemService.java +++ b/src/main/java/club/joylink/rtss/services/MapSystemService.java @@ -2,17 +2,16 @@ package club.joylink.rtss.services; import club.joylink.rtss.constants.*; import club.joylink.rtss.dao.MapSystemDAO; +import club.joylink.rtss.entity.DepartmentLesson; import club.joylink.rtss.entity.MapSystem; import club.joylink.rtss.entity.MapSystemExample; -import club.joylink.rtss.entity.StudentRelIdClass; -import club.joylink.rtss.entity.StudentRelLessonClass; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; -import club.joylink.rtss.services.student.IClassStudentUserService; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.TreeNode; +import club.joylink.rtss.vo.client.company.UserDepartRelVO; import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.runplan.RunPlanVO; import club.joylink.rtss.vo.client.sub.MapSystemDetailVO; @@ -56,7 +55,7 @@ public class MapSystemService implements IMapSystemService { private ISysUserService iSysUserService; @Autowired - private IClassStudentUserService iClassStudentUserService; + private ICompanyService iCompanyService; @Override @Transactional @@ -217,36 +216,39 @@ public class MapSystemService implements IMapSystemService { || MapSystemType.Exam.name().equals(mapSystem.getType())) { List lessonVOList = new ArrayList<>(); - //用户存在班级关系时,根据班级课程关系查询课程,目前仅GZB使用 - List studentRelIdClasses = this.iClassStudentUserService.getRelClassByUser(userVO.getId()); - if(loginInfo.getProject().equals(Project.GZB) && !CollectionUtils.isEmpty(studentRelIdClasses)){ - Integer classId = studentRelIdClasses.get(0).getClassId();//学生只关联一个班 - List relLessonsByClass = this.iClassStudentUserService.getRelLessonsByClass(classId); - if(!CollectionUtils.isEmpty(relLessonsByClass)){ - lessonVOList = iLessonService.getValidLesson(relLessonsByClass.stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()), mapSystem.getPrdType()); - } - //默认课程展示 - MapVO mapVO = iMapService.findMapBaseInfoById(mapSystem.getMapId()); - BusinessConsts.Lesson.PrdInfo prdInfo = BusinessConsts.Lesson.PrdInfo.getBy(mapSystem.getPrdType()); - if (Objects.nonNull(prdInfo)) { - String defaultLessonName = String.join("-", mapVO.getName(), prdInfo.getName()); - LessonVO existedDefaultLesson = iLessonService.findByMapAndNameAndPrdType(mapSystem.getMapId(), defaultLessonName, mapSystem.getPrdType()); - if (Objects.nonNull(existedDefaultLesson)) { - if (lessonVOList.stream().noneMatch(lessonVO -> lessonVO.getId().equals(existedDefaultLesson.getId()))) { - lessonVOList.add(existedDefaultLesson); + //用户存在部门关系时,根据部门课程关系查询课程 + if(iCompanyService.isCompanyUser(userVO.getId())){ + List userDepartRelVOS = this.iCompanyService.getDepartRefByUserId(userVO.getId()); + if(!CollectionUtils.isEmpty(userDepartRelVOS)){ + List departLessonRefs = userDepartRelVOS.stream() + .flatMap(userDepartRelVO -> this.iCompanyService.getDepartLessonRefs(userDepartRelVO.getDepartmentId()).stream()).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(departLessonRefs)){ + lessonVOList = iLessonService.getValidLesson(departLessonRefs.stream().map(DepartmentLesson::getLessonId).collect(Collectors.toList()), mapSystem.getPrdType()); + } + //默认课程展示 + MapVO mapVO = iMapService.findMapBaseInfoById(mapSystem.getMapId()); + BusinessConsts.Lesson.PrdInfo prdInfo = BusinessConsts.Lesson.PrdInfo.getBy(mapSystem.getPrdType()); + if (Objects.nonNull(prdInfo)) { + String defaultLessonName = String.join("-", mapVO.getName(), prdInfo.getName()); + LessonVO existedDefaultLesson = iLessonService.findByMapAndNameAndPrdType(mapSystem.getMapId(), defaultLessonName, mapSystem.getPrdType()); + if (Objects.nonNull(existedDefaultLesson)) { + if (lessonVOList.stream().noneMatch(lessonVO -> lessonVO.getId().equals(existedDefaultLesson.getId()))) { + lessonVOList.add(existedDefaultLesson); + } } } } - }else{ - lessonVOList = iLessonService.getByMapIdAndPrdType(mapSystem.getMapId(), mapSystem.getPrdType()); } + else{ + lessonVOList = iLessonService.getByMapIdAndPrdType(mapSystem.getMapId(), mapSystem.getPrdType()); + } if (CollectionUtils.isEmpty(lessonVOList)) { - return null; + return mapSystemDetailVO; } //查询课程关联的班级列表 lessonVOList.forEach(lessonVO -> { - List classNames = this.iClassStudentUserService.getRelclassByLessonId(lessonVO.getId()); + List classNames = this.iCompanyService.getDepartNamesByLesson(lessonVO.getId()); if(!CollectionUtils.isEmpty(classNames)){ lessonVO.setClassNames(classNames); } diff --git a/src/main/java/club/joylink/rtss/services/SysUserService.java b/src/main/java/club/joylink/rtss/services/SysUserService.java index bcfbf4c42..57f128d01 100644 --- a/src/main/java/club/joylink/rtss/services/SysUserService.java +++ b/src/main/java/club/joylink/rtss/services/SysUserService.java @@ -84,7 +84,11 @@ public class SysUserService implements ISysUserService { private CompanyDAO companyDAO; @Autowired - private ICompanyService iCompanyService; + private CompanyUserDAO companyUserDAO; + + @Autowired + private DepartmentUserDAO departmentUserDAO; + @Override public UserVO findUserByAccountAndPassword(String account, String password) { @@ -94,7 +98,9 @@ public class SysUserService implements ISysUserService { example.or().andEmailEqualTo(account).andPasswordEqualTo(password); // 邮箱 List users = this.sysUserDAO.selectByExample(example); if(!CollectionUtils.isEmpty(users)) { - return new UserVO(users.get(0)); + UserVO userVO = sysUserDAO.queryUserWithCompany(users.get(0).getId()); + userVO.setRolesByString(); + return userVO; } return null; } @@ -109,6 +115,12 @@ public class SysUserService implements ISysUserService { return UserVO.convertFromDB(list); } + + @Override + public UserVO queryCompanyUserByAccount(Integer companyId, String account) { + return this.sysUserDAO.queryCompanyUserByAccount(account, companyId); + } + @Override public UserVO getUserByWxOpenId(String openid) { SysUserExample example = new SysUserExample(); @@ -217,7 +229,7 @@ public class SysUserService implements ISysUserService { @Override public PageVO queryPagedUser(UserQueryVO queryVO) { PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); - Page page = (Page) sysUserDAO.pagedQueryWithCompany(queryVO); + Page page = (Page) sysUserDAO.queryUsersWithCompany(queryVO); page.getResult().forEach(UserVO::forClient); return PageVO.convert(page); // SysUserExample example = new SysUserExample(); @@ -334,24 +346,26 @@ public class SysUserService implements ISysUserService { @Override @Transactional - public void userBindCompany(Long userId, Integer companyId) { - iCompanyService.userBindCompany(userId, companyId); + public void userScanCodeBindCompany(Long userId, Integer companyId) { + Company company = companyDAO.selectByPrimaryKey(companyId); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company, "不存在此单位"); + SysUser sysUser = sysUserDAO.selectByPrimaryKey(userId); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sysUser, "不存在的用户"); + UserVO userVO = new UserVO(sysUser); + userBindCompany(userVO, companyId,true); + this.loginSessionManager.updateLoginUser(userVO); } @Override public UserVO getUserBaseInfoById(Long id) { - SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(id); - BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sysUser, "不存在的用户"); - UserVO userVO = new UserVO(); - userVO.setId(sysUser.getId()); - userVO.setAccount(sysUser.getAccount()); - userVO.setName(sysUser.getName()); - userVO.setNickname(sysUser.getNickname()); - userVO.setAvatarPath(sysUser.getAvatarPath()); - userVO.setRolesByString(sysUser.getRoles()); - userVO.setEmail(sysUser.getEmail()); - userVO.setStatus(sysUser.getStatus()); - userVO.setCreateTime(sysUser.getCreateTime()); + UserVO userVO = this.sysUserDAO.queryUserWithCompany(id); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(userVO, "不存在的用户"); + userVO.setRolesByString(); + userVO.setWmOpenId(null); + userVO.setWxId(null); + userVO.setWxUnionId(null); + userVO.setNationcode(null); + userVO.setPassword(null); return userVO; } @@ -407,7 +421,9 @@ public class SysUserService implements ISysUserService { if(CollectionUtils.isEmpty(list)) { return null; } - return new UserVO(list.get(0)); + UserVO userVO = sysUserDAO.queryUserWithCompany(list.get(0).getId()); + userVO.setRolesByString(); + return userVO; } @Override @@ -417,7 +433,9 @@ public class SysUserService implements ISysUserService { example.createCriteria().andWmOpenIdEqualTo(wmOpenId); List userList = this.sysUserDAO.selectByExample(example); if(!CollectionUtils.isEmpty(userList)) { - return new UserVO(userList.get(0)); + UserVO userVO = sysUserDAO.queryUserWithCompany(userList.get(0).getId()); + userVO.setRolesByString(); + return userVO; } return null; } @@ -451,6 +469,17 @@ public class SysUserService implements ISysUserService { return new UserVO(user); } + @Override + @Transactional + public void batchCreateUser(List newSysUsers) { + this.sysUserDAO.batchInsert(newSysUsers); + } + + @Override + public void createUser(SysUser newSysUser) { + this.sysUserDAO.insert(newSysUser); + } + private String generateNickname() { return String.format("用户_%s", RandomGenerator.getByLen(5)); } @@ -482,20 +511,6 @@ public class SysUserService implements ISysUserService { } } - /** - * 根据wxOpenId查询系统用户 - * @param openId - * @return - */ - public SysUser findSysUserByWxOpenId(String openId) { - SysUserExample example = new SysUserExample(); - example.createCriteria().andWxIdEqualTo(openId); - List list = this.sysUserDAO.selectByExample(example); - if(!CollectionUtils.isEmpty(list)) { - SysUser user = list.get(0); - } - return null; - } @Override public void wxSubscribeEventHandle(String wxId) { @@ -548,7 +563,9 @@ public class SysUserService implements ISysUserService { user.setName(name); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - this.loginSessionManager.updateLoginUser(new UserVO(user)); + UserVO userVO = sysUserDAO.queryUserWithCompany(id); + userVO.setRolesByString(); + this.loginSessionManager.updateLoginUser(userVO); } } @@ -561,7 +578,9 @@ public class SysUserService implements ISysUserService { user.setNickname(nickname); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - this.loginSessionManager.updateLoginUser(new UserVO(user)); + UserVO userVO = sysUserDAO.queryUserWithCompany(id); + userVO.setRolesByString(); + this.loginSessionManager.updateLoginUser(userVO); } } @@ -572,7 +591,9 @@ public class SysUserService implements ISysUserService { user.setAvatarPath(avatarPath); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - this.loginSessionManager.updateLoginUser(new UserVO(user)); + UserVO userVO = sysUserDAO.queryUserWithCompany(id); + userVO.setRolesByString(); + this.loginSessionManager.updateLoginUser(userVO); } } @@ -589,7 +610,9 @@ public class SysUserService implements ISysUserService { user.setMobile(updateMobileVO.getMobile()); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - this.loginSessionManager.updateLoginUser(new UserVO(user)); + UserVO userVO = sysUserDAO.queryUserWithCompany(id); + userVO.setRolesByString(); + this.loginSessionManager.updateLoginUser(userVO); } } @@ -605,7 +628,9 @@ public class SysUserService implements ISysUserService { user.setEmail(updateEmailVO.getEmail()); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - this.loginSessionManager.updateLoginUser(new UserVO(user)); + UserVO userVO = sysUserDAO.queryUserWithCompany(id); + userVO.setRolesByString(); + this.loginSessionManager.updateLoginUser(userVO); } } @@ -732,14 +757,55 @@ public class SysUserService implements ISysUserService { SysUser user = getEntity(userId); if(!user.getRoles().equals(updateUserVO.getRolesStr())) { user.setRoles(updateUserVO.getRolesStr()); + user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); } //更新所属公司 - if (updateUserVO.getCompanyId() != null) { - iCompanyService.superAdminUpdateUserCompanyRel(userId, updateUserVO.getCompanyId(), superAdmin); + Integer companyId = updateUserVO.getCompanyId(); + UserVO userVO = new UserVO(user); + userBindCompany(userVO, companyId,false); + this.loginSessionManager.updateLoginUser(userVO); + } + + @Override + public void userBindCompany(UserVO userVO, Integer companyId, boolean companyAdmin) { + CompanyUserExample e = new CompanyUserExample(); + e.createCriteria().andUserIdEqualTo(userVO.getId()); + userVO.setCompanyId(companyId); + userVO.setCompanyAdmin(companyAdmin); + if (Objects.nonNull(companyId)) { + List companyUsers = companyUserDAO.selectByExample(e); + if(CollectionUtils.isEmpty(companyUsers)){ + CompanyUser companyUser = new CompanyUser(); + companyUser.setCompanyId(companyId); + companyUser.setUserId(userVO.getId()); + companyUser.setAdmin(companyAdmin); + companyUserDAO.insertSelective(companyUser); + }else{ + CompanyUser companyUser =companyUsers.get(0); + companyUser.setCompanyId(companyId); + companyUser.setUserId(userVO.getId()); + companyUser.setAdmin(companyAdmin); + companyUserDAO.updateByExampleSelective(companyUser,e); + if(!Objects.equals(companyUser.getCompanyId(),companyId)){ + DepartmentUserExample ue =new DepartmentUserExample(); + ue.createCriteria().andUserIdEqualTo(userVO.getId()); + departmentUserDAO.deleteByExample(ue); + } + } + String companyName = companyDAO.selectByPrimaryKey(companyId).getName(); + userVO.setCompanyName(companyName); + } else { - iCompanyService.deleteUserCompanyRel(userId); + companyUserDAO.deleteByExample(e); + DepartmentUserExample ue =new DepartmentUserExample(); + ue.createCriteria().andUserIdEqualTo(userVO.getId()); + departmentUserDAO.deleteByExample(ue); + userVO.setCompanyAdmin(null); } + + + } @Override @@ -756,4 +822,9 @@ public class SysUserService implements ISysUserService { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(user, String.format("id为[%s]的用户不存在", id)); return user; } + + @Override + public void deleteById(Long id) { + sysUserDAO.deleteByPrimaryKey(id); + } } diff --git a/src/main/java/club/joylink/rtss/services/student/ClassStudentUserServiceImpl.java b/src/main/java/club/joylink/rtss/services/student/DepartUserStaticServiceImpl.java similarity index 74% rename from src/main/java/club/joylink/rtss/services/student/ClassStudentUserServiceImpl.java rename to src/main/java/club/joylink/rtss/services/student/DepartUserStaticServiceImpl.java index d4981daa2..6538432ac 100644 --- a/src/main/java/club/joylink/rtss/services/student/ClassStudentUserServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/student/DepartUserStaticServiceImpl.java @@ -6,7 +6,6 @@ import club.joylink.rtss.entity.*; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.*; import club.joylink.rtss.vo.UserVO; -import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.goods.GoodsVO; import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.order.OrderCreateVO; @@ -34,7 +33,7 @@ import java.util.stream.Collectors; */ @Slf4j @Service -public class ClassStudentUserServiceImpl implements IClassStudentUserService { +public class DepartUserStaticServiceImpl implements IDepartUserStatisticService { @Autowired private SysUserDAO sysUserDAO; @@ -89,7 +88,10 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService { @Autowired private IOrderService iOrderService; + @Autowired + private DepartmentUserDAO departmentUserDAO; + //TODO 迁移学生权限分发 @Override @Transactional public void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator) { @@ -168,70 +170,70 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService { distributePermissions2ZJ(good.getId(), userIds, usersWithPermissions); } - @Override - public List getClassesByProjectCode(String projectCode) { - StudentClassExample classExample = new StudentClassExample(); - classExample.createCriteria().andProjectCodeEqualTo(projectCode); - List studentClasses = this.studentClassDAO.selectByExample(classExample); - return StudentClassVO.convertFromDBList(studentClasses); - } +// @Override +// public List getClassesByProjectCode(String projectCode) { +// StudentClassExample classExample = new StudentClassExample(); +// classExample.createCriteria().andProjectCodeEqualTo(projectCode); +// List studentClasses = this.studentClassDAO.selectByExample(classExample); +// return StudentClassVO.convertFromDBList(studentClasses); +// } - @Override - public List getClassesByLesson(Long lessonId) { - List classes = this.studentClassDAO.getClasses(lessonId); - return StudentClassVO.convertFromDBList(classes); - } +// @Override +// public List getClassesByLesson(Long lessonId) { +// List classes = this.studentClassDAO.getClasses(lessonId); +// return StudentClassVO.convertFromDBList(classes); +// } - @Override - public List getClassesByExamId(Long examId) { - StudentRelExamClassExample example = new StudentRelExamClassExample(); - example.createCriteria().andExamIdEqualTo(examId); - List classes = this.studentClassDAO.getClassesByExamId(examId); - return StudentClassVO.convertFromDBList(classes); - } +// @Override +// public List getClassesByExamId(Long examId) { +// StudentRelExamClassExample example = new StudentRelExamClassExample(); +// example.createCriteria().andExamIdEqualTo(examId); +// List classes = this.studentClassDAO.getClassesByExamId(examId); +// return StudentClassVO.convertFromDBList(classes); +// } - @Override - public List getRelLessonsByClass(Integer classId) { - StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample(); - relLessonClassExample.createCriteria().andClassIdEqualTo(classId); - List studentClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample); - return studentClasses; - } +// @Override +// public List getRelLessonsByClass(Integer classId) { +// StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample(); +// relLessonClassExample.createCriteria().andClassIdEqualTo(classId); +// List studentClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample); +// return studentClasses; +// } - @Override - public List getRelclassByLessonId(Long LessonId) { - List classes = this.studentRelLessonClassDAO.getClassNames(LessonId); - return classes; - } +// @Override +// public List getRelclassByLessonId(Long LessonId) { +// List classes = this.studentRelLessonClassDAO.getClassNames(LessonId); +// return classes; +// } - @Override - public List getRelExamIdsByClassId(Integer classId) { - StudentRelExamClassExample example = new StudentRelExamClassExample(); - example.createCriteria().andClassIdEqualTo(classId); - List classes = this.studentRelExamClassDAO.selectByExample(example); - return classes.stream().map(StudentRelExamClass::getExamId).collect(Collectors.toList()); - } +// @Override +// public List getRelExamIdsByClassId(Integer classId) { +// StudentRelExamClassExample example = new StudentRelExamClassExample(); +// example.createCriteria().andClassIdEqualTo(classId); +// List classes = this.studentRelExamClassDAO.selectByExample(example); +// return classes.stream().map(StudentRelExamClass::getExamId).collect(Collectors.toList()); +// } +// +// @Override +// public List getLessonByClass(Integer classId) { +// List lessonIds = getRelLessonsByClass(classId).stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()); +// return lessonService.getValidLesson(lessonIds, null); +// } - @Override - public List getLessonByClass(Integer classId) { - List lessonIds = getRelLessonsByClass(classId).stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()); - return lessonService.getValidLesson(lessonIds, null); - } - - @Override - public List getRelClassByUser(Long userId) { - StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample(); - relIdClassExample.createCriteria().andStudentUserIdEqualTo(userId); - List studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample); - return studentRelIdClasses; - } +// @Override +// public List getRelClassByUser(Long userId) { +// StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample(); +// relIdClassExample.createCriteria().andStudentUserIdEqualTo(userId); +// List studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample); +// return studentRelIdClasses; +// } @Override public List studentInfoStatistics(StudentInfoExportParam infoExportParam) { //根据班级id查询对应学生信息 - StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample(); - relIdClassExample.createCriteria().andClassIdEqualTo(infoExportParam.getClassId()); - List studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample); + DepartmentUserExample departmentUserExample = new DepartmentUserExample(); + departmentUserExample.createCriteria().andDepartmentIdEqualTo(infoExportParam.getClassId()); + List departmentUsers = this.departmentUserDAO.selectByExample(departmentUserExample); //课程关联实训数 Map prd2TrainNums = infoExportParam.getPrdParams().stream().collect(Collectors.toMap(prdParam -> prdParam.getPrdType(), prdParam -> { LsRelChapterTrainingExample lsRelChapterTrainingExample = new LsRelChapterTrainingExample(); @@ -243,27 +245,27 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService { this.examDefinitionDAO.selectByPrimaryKey(prdParam.getExamPaperId()).getFullPoint() )); //根据本学期日期始末,针对每个学生查询 出勤天数、根据课程id查询测验模式通过个数、根据考试id查询成绩 - return studentRelIdClasses.stream().map(studentRelIdClass -> { + return departmentUsers.stream().map(departmentUser -> { ExportStudentInfo exportStudentInfo = new ExportStudentInfo(); - SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(studentRelIdClass.getStudentUserId()); + SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(departmentUser.getUserId()); exportStudentInfo.setName(sysUser.getName()); exportStudentInfo.setStudentID(sysUser.getAccount()); //查询出勤天数 - Integer days = this.sysUserLoginDAO.loginDays(studentRelIdClass.getStudentUserId(), Client.Joylink.getName(), infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); + Integer days = this.sysUserLoginDAO.loginDays(departmentUser.getUserId(), Client.Joylink.getName(), infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); //出勤率 exportStudentInfo.setAttendance((float) Math.round((Objects.isNull(days) ? 0 : (days > infoExportParam.getAttendanceDays() ? infoExportParam.getAttendanceDays() : days)) * 100 / infoExportParam.getAttendanceDays()) / 100); infoExportParam.getPrdParams().forEach(prdParam -> { PrdStudentScoretInfo prdStudentScoretInfo = new PrdStudentScoretInfo(); prdStudentScoretInfo.setPrdType(prdParam.getPrdType()); //查询课程下不同实训的测验通过数 - Integer passedNum = this.userTrainingStatsMapper.countBy(studentRelIdClass.getStudentUserId(), prdParam.getLessonId(), 0, BusinessConsts.Training.Mode.Mode04, 1, infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); + Integer passedNum = this.userTrainingStatsMapper.countBy(departmentUser.getUserId(), prdParam.getLessonId(), 0, BusinessConsts.Training.Mode.Mode04, 1, infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); //技能操作通过率 if (prd2TrainNums.get(prdParam.getPrdType()) != 0) { prdStudentScoretInfo.setLessonPassRate((float) Math.round((Objects.isNull(passedNum) ? 0 : passedNum) * 100 / prd2TrainNums.get(prdParam.getPrdType())) / 100); } //查询考试得分 - Integer maxScore = this.userExamMapper.getMaxScoreBy(studentRelIdClass.getStudentUserId(), prdParam.getExamPaperId(), infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); + Integer maxScore = this.userExamMapper.getMaxScoreBy(departmentUser.getUserId(), prdParam.getExamPaperId(), infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); //考试成绩占总分比 prdStudentScoretInfo.setExamSocreRadio((float) Math.round((Objects.isNull(maxScore) ? 0 : maxScore) * 100 / prd2Fullpoint.get(prdParam.getPrdType())) / 100); exportStudentInfo.getScores().add(prdStudentScoretInfo); @@ -272,20 +274,20 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService { }).collect(Collectors.toList()); } - @Override - public void addExamRelClass(Long examId, Integer classId) { - StudentRelExamClass studentRelExamClass = new StudentRelExamClass(); - studentRelExamClass.setExamId(examId); - studentRelExamClass.setClassId(classId); - studentRelExamClassDAO.insert(studentRelExamClass); - } +// @Override +// public void addExamRelClass(Long examId, Integer classId) { +// StudentRelExamClass studentRelExamClass = new StudentRelExamClass(); +// studentRelExamClass.setExamId(examId); +// studentRelExamClass.setClassId(classId); +// studentRelExamClassDAO.insert(studentRelExamClass); +// } - @Override - public void deleteExamRelClass(Long examId) { - StudentRelExamClassExample example = new StudentRelExamClassExample(); - example.createCriteria().andExamIdEqualTo(examId); - studentRelExamClassDAO.deleteByExample(example); - } +// @Override +// public void deleteExamRelClass(Long examId) { +// StudentRelExamClassExample example = new StudentRelExamClassExample(); +// example.createCriteria().andExamIdEqualTo(examId); +// studentRelExamClassDAO.deleteByExample(example); +// } /** * 创建权限分发给赵杰,再从赵杰的权限创建权限分发给学生领取 diff --git a/src/main/java/club/joylink/rtss/services/student/IClassStudentUserService.java b/src/main/java/club/joylink/rtss/services/student/IDepartUserStatisticService.java similarity index 57% rename from src/main/java/club/joylink/rtss/services/student/IClassStudentUserService.java rename to src/main/java/club/joylink/rtss/services/student/IDepartUserStatisticService.java index fb1aa62f2..9902da864 100644 --- a/src/main/java/club/joylink/rtss/services/student/IClassStudentUserService.java +++ b/src/main/java/club/joylink/rtss/services/student/IDepartUserStatisticService.java @@ -11,10 +11,8 @@ import club.joylink.rtss.vo.client.student.StudentInfoExportParam; import java.util.List; -/** - * 班级学生用户接口 - */ -public interface IClassStudentUserService { + +public interface IDepartUserStatisticService { /** * 导入学生用户及班级信息 @@ -24,36 +22,36 @@ public interface IClassStudentUserService { */ void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator); - /** - * 根据项目查询班级 - * @param projectCode - * @return - */ - List getClassesByProjectCode(String projectCode); +// /** +// * 根据项目查询班级 +// * @param projectCode +// * @return +// */ +// List getClassesByProjectCode(String projectCode); - List getClassesByLesson(Long lessonId); +// List getClassesByLesson(Long lessonId); - List getClassesByExamId(Long examId); +// List getClassesByExamId(Long examId); - /**根据班级查询课程关系*/ - List getRelLessonsByClass(Integer classId); +// /**根据班级查询课程关系*/ +// List getRelLessonsByClass(Integer classId); /**根据课程查询关联的班级名字列表*/ - List getRelclassByLessonId(Long LessonId); +// List getRelclassByLessonId(Long LessonId); - List getRelExamIdsByClassId(Integer classId); +// List getRelExamIdsByClassId(Integer classId); - List getLessonByClass(Integer classId); +// List getLessonByClass(Integer classId); /**根据用户id查询关联的班级关系*/ - List getRelClassByUser(Long userId); +// List getRelClassByUser(Long userId); /**统计学生成绩信息*/ List studentInfoStatistics(StudentInfoExportParam infoExportParam); - void addExamRelClass(Long examId, Integer classId); +// void addExamRelClass(Long examId, Integer classId); - void deleteExamRelClass(Long examId); +// void deleteExamRelClass(Long examId); /**关联课程及班级信息*/ } diff --git a/src/main/java/club/joylink/rtss/vo/UserVO.java b/src/main/java/club/joylink/rtss/vo/UserVO.java index 3ea46566c..b1aa77ab3 100644 --- a/src/main/java/club/joylink/rtss/vo/UserVO.java +++ b/src/main/java/club/joylink/rtss/vo/UserVO.java @@ -83,6 +83,7 @@ public class UserVO implements Serializable { /** * 数据库的roles字段 */ + @JsonIgnore private String dbRoles; /** @@ -105,10 +106,14 @@ public class UserVO implements Serializable { */ private LocalDateTime createTime; + //单位信息 private Integer companyId; private String companyName; + private Boolean companyAdmin; + + public UserVO() {} public UserVO(SysUser sysUser) { @@ -175,6 +180,14 @@ public class UserVO implements Serializable { } } + public void setRolesByString() { + if(StringUtils.hasText(dbRoles)) { + String[] splits = dbRoles.split(","); + this.roles = new ArrayList<>(); + Collections.addAll(this.roles, splits); + } + } + @Override public String toString() { return "UserVO [id=" + id + ", name=" + name + ", nickname=" + nickname + ", mobile=" + mobile + ", email=" + email +", nationcode=" @@ -223,6 +236,7 @@ public class UserVO implements Serializable { * 是否管理员 * @return */ + @JsonIgnore public boolean isAdmin() { return !CollectionUtils.isEmpty(this.roles) && (this.roles.contains(BusinessConsts.ROLE_04) || this.roles.contains(BusinessConsts.ROLE_05)); @@ -232,6 +246,7 @@ public class UserVO implements Serializable { * 是否超级管理员 * @return */ + @JsonIgnore public boolean isSuperAdmin() { return !CollectionUtils.isEmpty(this.roles) && (this.roles.contains(BusinessConsts.ROLE_05)); diff --git a/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java b/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java index b690f0fce..2849dd8ee 100644 --- a/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java @@ -1,13 +1,13 @@ package club.joylink.rtss.vo.client; +import club.joylink.rtss.entity.ExamDefinition; +import club.joylink.rtss.vo.client.company.DepartmentVO; +import club.joylink.rtss.vo.client.validGroup.ExamDefinitionCheck; +import club.joylink.rtss.vo.client.validGroup.ExamDefinitionRulesCheck; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import club.joylink.rtss.entity.ExamDefinition; -import club.joylink.rtss.vo.client.student.StudentClassVO; -import club.joylink.rtss.vo.client.validGroup.ExamDefinitionCheck; -import club.joylink.rtss.vo.client.validGroup.ExamDefinitionRulesCheck; import io.swagger.annotations.ApiModel; import lombok.Getter; import lombok.NoArgsConstructor; @@ -121,7 +121,7 @@ public class ExamDefinitionVO { private Boolean trial; /**关联班级列表*/ - private List classes; + private List classes; @Valid @NotNull(message = "考试规则不能为空", groups = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class}) diff --git a/src/main/java/club/joylink/rtss/vo/client/company/CompanyDepartUserVO.java b/src/main/java/club/joylink/rtss/vo/client/company/CompanyDepartUserVO.java new file mode 100644 index 000000000..1232b0ada --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/CompanyDepartUserVO.java @@ -0,0 +1,35 @@ +package club.joylink.rtss.vo.client.company; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class CompanyDepartUserVO{ + +// private Long id; + + private Long userId; + + private String account; + + + private String name; + +// private String nickname; + + + private Integer companyId; + private String companyName; + + private Integer departmentId; + private String departmentName; + + private Integer positionId; + private String positionName; + + private boolean manager; + +} diff --git a/src/main/java/club/joylink/rtss/vo/client/CompanyQueryVO.java b/src/main/java/club/joylink/rtss/vo/client/company/CompanyQueryVO.java similarity index 60% rename from src/main/java/club/joylink/rtss/vo/client/CompanyQueryVO.java rename to src/main/java/club/joylink/rtss/vo/client/company/CompanyQueryVO.java index fd7fcaf51..20874a2a0 100644 --- a/src/main/java/club/joylink/rtss/vo/client/CompanyQueryVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/company/CompanyQueryVO.java @@ -1,5 +1,6 @@ -package club.joylink.rtss.vo.client; +package club.joylink.rtss.vo.client.company; +import club.joylink.rtss.vo.client.PageQueryVO; import lombok.Getter; import lombok.Setter; @@ -10,4 +11,5 @@ public class CompanyQueryVO extends PageQueryVO { private String name; + } diff --git a/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserQueryVO.java b/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserQueryVO.java new file mode 100644 index 000000000..d160e4a31 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserQueryVO.java @@ -0,0 +1,22 @@ +package club.joylink.rtss.vo.client.company; + +import club.joylink.rtss.vo.client.PageQueryVO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class CompanyUserQueryVO extends PageQueryVO { + + + @ApiModelProperty(value = "真实姓名") + private String name; + + private String account; + + @ApiModelProperty(value = "部门id",hidden = true) + private Integer departmentId; + + +} diff --git a/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserVO.java b/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserVO.java new file mode 100644 index 000000000..4a2b72645 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserVO.java @@ -0,0 +1,49 @@ +package club.joylink.rtss.vo.client.company; + +import club.joylink.rtss.constants.BusinessConsts; +import club.joylink.rtss.entity.SysUser; +import club.joylink.rtss.util.EncryptUtil; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Getter +@Setter +@NoArgsConstructor +public class CompanyUserVO { + + + @ApiModelProperty(value = "用户姓名") + @NotBlank(message = "用户姓名不能为空") + private String name; + + @ApiModelProperty(value = "用户账号") + @NotBlank(message = "用户账号不能为空") + private String account; + + + public static SysUser convert2DB(CompanyUserVO companyUserVO) { + SysUser user = new SysUser(); + user.setName(companyUserVO.name); + user.setAccount(companyUserVO.account); + user.setNickname(companyUserVO.name); + user.setPassword(EncryptUtil.md5(BusinessConsts.GZB_DEFAULT_PASSWORD)); + user.setStatus(BusinessConsts.STATUS_USE); + user.setRoles(BusinessConsts.ROLE_01); + user.setCreateTime(LocalDateTime.now()); + return user; + } + + public static List convert2DBList(List companyUserVOS){ + return companyUserVOS.stream().map(CompanyUserVO::convert2DB).collect(Collectors.toList()); + } +} + + diff --git a/src/main/java/club/joylink/rtss/vo/client/CompanyVO.java b/src/main/java/club/joylink/rtss/vo/client/company/CompanyVO.java similarity index 83% rename from src/main/java/club/joylink/rtss/vo/client/CompanyVO.java rename to src/main/java/club/joylink/rtss/vo/client/company/CompanyVO.java index 800584a07..918d3d1bb 100644 --- a/src/main/java/club/joylink/rtss/vo/client/CompanyVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/company/CompanyVO.java @@ -1,7 +1,6 @@ -package club.joylink.rtss.vo.client; +package club.joylink.rtss.vo.client.company; import club.joylink.rtss.entity.Company; -import club.joylink.rtss.vo.UserVO; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Getter; @@ -31,8 +30,6 @@ public class CompanyVO { /**联系方式*/ private String phone = ""; - private List managers; - public CompanyVO(Company entity) { this.id = entity.getId(); this.name = entity.getName(); @@ -48,12 +45,6 @@ public class CompanyVO { return voList; } - public static CompanyVO convertFromDB(Company company, List managers) { - CompanyVO vo = new CompanyVO(company); - vo.setManagers(managers); - return vo; - } - public Company toDB() { Company entity = new Company(); entity.setId(this.id); @@ -63,4 +54,6 @@ public class CompanyVO { entity.setCreateTime(LocalDateTime.now()); return entity; } + + } diff --git a/src/main/java/club/joylink/rtss/vo/client/company/DepartmentVO.java b/src/main/java/club/joylink/rtss/vo/client/company/DepartmentVO.java new file mode 100644 index 000000000..ca6aeada7 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/DepartmentVO.java @@ -0,0 +1,105 @@ +package club.joylink.rtss.vo.client.company; + +import club.joylink.rtss.entity.CompanyDepartment; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +@Getter +@Setter +@NoArgsConstructor +public class DepartmentVO { + + @JsonSerialize(using = ToStringSerializer.class) + private Integer id; + + @NotBlank(message = "部门名称不能为空") + private String name; + + private Integer companyId; + + @JsonIgnore + private Integer parentId; + + private List childDept; + + public DepartmentVO(CompanyDepartment entity) { + this.id = entity.getId(); + this.name = entity.getName(); + this.companyId = entity.getCompanyId(); + this.parentId = entity.getParentId(); + } + + public DepartmentVO(String name, Integer companyId, Integer parentId) { + this.name = name; + this.companyId = companyId; + this.parentId = parentId; + } + + public static List convert2VOList(List dataList) { + List voList = new ArrayList<>(); + for (CompanyDepartment entity : dataList) { + voList.add(new DepartmentVO(entity)); + } + return voList; + } + + public CompanyDepartment toDB() { + CompanyDepartment entity = new CompanyDepartment(); + entity.setId(this.id); + entity.setName(this.name); + entity.setCompanyId(this.companyId); + entity.setParentId(this.parentId); + return entity; + } + + public static List buildDeptTree(List voList) { + List rootDeparts = new ArrayList<>(); + voList.forEach(d -> { + if (Objects.isNull(d.getParentId())) { + d.setChildDept(getChildDept(d.getId(), voList)); + rootDeparts.add(d); + } + }); + return rootDeparts; + } + + public static List getChildDept(Integer parentId, List list) { + List child = new ArrayList<>(); + list.forEach(c -> { + if (parentId == c.getParentId()) { + child.add(c); + + } + }); + var list1 = new ArrayList<>(list); + list1.removeAll(child); + child.forEach(c -> { + c.setChildDept(getChildDept(c.getId(), list1)); + }); + return child; + } + + public static List getChildDeptList(Integer parentId, List list) { + List child = new ArrayList<>(); + list.forEach(c -> { + if (parentId == c.getParentId()) { + child.add(c); + } + }); + var list1 = new ArrayList<>(list); + list1.removeAll(child); + child.forEach(c -> { + child.addAll(getChildDept(c.getId(), list1)); + }); + return child; + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/company/ImportCompanyUserVO.java b/src/main/java/club/joylink/rtss/vo/client/company/ImportCompanyUserVO.java new file mode 100644 index 000000000..ea53a1d9a --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/ImportCompanyUserVO.java @@ -0,0 +1,23 @@ +package club.joylink.rtss.vo.client.company; + +import lombok.Getter; +import lombok.Setter; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; + +@Getter +@Setter +public class ImportCompanyUserVO { + + @NotBlank + private String parentDepart; + @NotBlank + private String depart; + + @NotEmpty + @Valid + private List companyUsers; +} diff --git a/src/main/java/club/joylink/rtss/vo/client/company/PositionVO.java b/src/main/java/club/joylink/rtss/vo/client/company/PositionVO.java new file mode 100644 index 000000000..fe993aaea --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/PositionVO.java @@ -0,0 +1,48 @@ +package club.joylink.rtss.vo.client.company; + +import club.joylink.rtss.entity.CompanyPosition; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +public class PositionVO { + + @JsonSerialize(using = ToStringSerializer.class) + private Integer id; + + @NotBlank(message = "职位名称不能为空") + private String name; + + private Integer companyId; + + public PositionVO(CompanyPosition entity) { + this.id = entity.getId(); + this.name = entity.getName(); + this.companyId = entity.getCompanyId(); + } + + public static List convert2VOList(List dataList) { + List voList = new ArrayList<>(); + for (CompanyPosition entity : dataList) { + voList.add(new PositionVO(entity)); + } + return voList; + } + + public CompanyPosition toDB() { + CompanyPosition entity = new CompanyPosition(); + entity.setId(this.id); + entity.setName(this.name); + entity.setCompanyId(this.companyId); + return entity; + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/company/UserDepartRelVO.java b/src/main/java/club/joylink/rtss/vo/client/company/UserDepartRelVO.java new file mode 100644 index 000000000..35213769a --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/UserDepartRelVO.java @@ -0,0 +1,62 @@ +package club.joylink.rtss.vo.client.company; + +import club.joylink.rtss.entity.DepartmentUser; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Getter +@Setter +@NoArgsConstructor +public class UserDepartRelVO { + + + private Long userId; + +// private UserVO userVO; + +// private Integer companyId; +// private String companyName; + + private Integer departmentId; +// private String departmentName; + + private Integer positionId; + private boolean manager; + + public UserDepartRelVO(Long userId, Integer departmentId, Integer positionId, boolean manager) { + this.userId = userId; + this.departmentId = departmentId; + this.positionId = positionId; + this.manager = manager; + } + + public UserDepartRelVO(DepartmentUser departmentUser) { + this.userId = departmentUser.getUserId(); + this.departmentId = departmentUser.getDepartmentId(); + this.positionId = departmentUser.getPositionId(); + this.manager = departmentUser.getManager(); + } + + public DepartmentUser toDB() { + DepartmentUser entity = new DepartmentUser(); + entity.setDepartmentId(departmentId); + entity.setPositionId(positionId); + entity.setUserId(userId); + entity.setManager(manager); + return entity; + } + + public static List convert2VOList(List departmentUsers){ + if(CollectionUtils.isEmpty(departmentUsers)){ + return new ArrayList<>(); + } + return departmentUsers.stream().map(UserDepartRelVO::new).collect(Collectors.toList()); + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/company/UserDepartVO.java b/src/main/java/club/joylink/rtss/vo/client/company/UserDepartVO.java new file mode 100644 index 000000000..da1dce245 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/UserDepartVO.java @@ -0,0 +1,15 @@ +package club.joylink.rtss.vo.client.company; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class UserDepartVO{ + + private Integer departmentId; + private String departmentName; + private boolean manager; +} diff --git a/src/main/resources/mybatis/mapper/CompanyDepartmentDAO.xml b/src/main/resources/mybatis/mapper/CompanyDepartmentDAO.xml new file mode 100644 index 000000000..5b6ee5554 --- /dev/null +++ b/src/main/resources/mybatis/mapper/CompanyDepartmentDAO.xml @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, `name`, company_id, parent_id + + + + + delete from company_department + where id = #{id,jdbcType=INTEGER} + + + delete from company_department + + + + + + insert into company_department (`name`, company_id, parent_id + ) + values (#{name,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER} + ) + + + insert into company_department + + + `name`, + + + company_id, + + + parent_id, + + + + + #{name,jdbcType=VARCHAR}, + + + #{companyId,jdbcType=INTEGER}, + + + #{parentId,jdbcType=INTEGER}, + + + + + + update company_department + + + id = #{record.id,jdbcType=INTEGER}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + company_id = #{record.companyId,jdbcType=INTEGER}, + + + parent_id = #{record.parentId,jdbcType=INTEGER}, + + + + + + + + update company_department + set id = #{record.id,jdbcType=INTEGER}, + `name` = #{record.name,jdbcType=VARCHAR}, + company_id = #{record.companyId,jdbcType=INTEGER}, + parent_id = #{record.parentId,jdbcType=INTEGER} + + + + + + update company_department + + + `name` = #{name,jdbcType=VARCHAR}, + + + company_id = #{companyId,jdbcType=INTEGER}, + + + parent_id = #{parentId,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update company_department + set `name` = #{name,jdbcType=VARCHAR}, + company_id = #{companyId,jdbcType=INTEGER}, + parent_id = #{parentId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/CompanyPositionDAO.xml b/src/main/resources/mybatis/mapper/CompanyPositionDAO.xml new file mode 100644 index 000000000..cf57ccc3c --- /dev/null +++ b/src/main/resources/mybatis/mapper/CompanyPositionDAO.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, `name`, company_id + + + + + delete from company_position + where id = #{id,jdbcType=INTEGER} + + + delete from company_position + + + + + + insert into company_position (`name`, company_id) + values (#{name,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}) + + + insert into company_position + + + `name`, + + + company_id, + + + + + #{name,jdbcType=VARCHAR}, + + + #{companyId,jdbcType=INTEGER}, + + + + + + update company_position + + + id = #{record.id,jdbcType=INTEGER}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + company_id = #{record.companyId,jdbcType=INTEGER}, + + + + + + + + update company_position + set id = #{record.id,jdbcType=INTEGER}, + `name` = #{record.name,jdbcType=VARCHAR}, + company_id = #{record.companyId,jdbcType=INTEGER} + + + + + + update company_position + + + `name` = #{name,jdbcType=VARCHAR}, + + + company_id = #{companyId,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update company_position + set `name` = #{name,jdbcType=VARCHAR}, + company_id = #{companyId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/CompanyUserDAO.xml b/src/main/resources/mybatis/mapper/CompanyUserDAO.xml new file mode 100644 index 000000000..da49eed5b --- /dev/null +++ b/src/main/resources/mybatis/mapper/CompanyUserDAO.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + company_id, user_id, `admin` + + + + delete from company_user + + + + + + insert into company_user (company_id, user_id, `admin` + ) + values (#{companyId,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT}, #{admin,jdbcType=BIT} + ) + + + insert into company_user + + + company_id, + + + user_id, + + + `admin`, + + + + + #{companyId,jdbcType=INTEGER}, + + + #{userId,jdbcType=BIGINT}, + + + #{admin,jdbcType=BIT}, + + + + + + update company_user + + + company_id = #{record.companyId,jdbcType=INTEGER}, + + + user_id = #{record.userId,jdbcType=BIGINT}, + + + `admin` = #{record.admin,jdbcType=BIT}, + + + + + + + + update company_user + set company_id = #{record.companyId,jdbcType=INTEGER}, + user_id = #{record.userId,jdbcType=BIGINT}, + `admin` = #{record.admin,jdbcType=BIT} + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/DepartmentExamDAO.xml b/src/main/resources/mybatis/mapper/DepartmentExamDAO.xml new file mode 100644 index 000000000..c38015626 --- /dev/null +++ b/src/main/resources/mybatis/mapper/DepartmentExamDAO.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + exam_id, department_id + + + + delete from department_exam + + + + + + insert into department_exam (exam_id, department_id) + values (#{examId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER}) + + + insert into department_exam + + + exam_id, + + + department_id, + + + + + #{examId,jdbcType=BIGINT}, + + + #{departmentId,jdbcType=INTEGER}, + + + + + + update department_exam + + + exam_id = #{record.examId,jdbcType=BIGINT}, + + + department_id = #{record.departmentId,jdbcType=INTEGER}, + + + + + + + + update department_exam + set exam_id = #{record.examId,jdbcType=BIGINT}, + department_id = #{record.departmentId,jdbcType=INTEGER} + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/DepartmentLessonDAO.xml b/src/main/resources/mybatis/mapper/DepartmentLessonDAO.xml new file mode 100644 index 000000000..c0b9bc152 --- /dev/null +++ b/src/main/resources/mybatis/mapper/DepartmentLessonDAO.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + lesson_id, department_id + + + + delete from department_lesson + + + + + + insert into department_lesson (lesson_id, department_id) + values (#{lessonId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER}) + + + insert into department_lesson + + + lesson_id, + + + department_id, + + + + + #{lessonId,jdbcType=BIGINT}, + + + #{departmentId,jdbcType=INTEGER}, + + + + + + update department_lesson + + + lesson_id = #{record.lessonId,jdbcType=BIGINT}, + + + department_id = #{record.departmentId,jdbcType=INTEGER}, + + + + + + + + update department_lesson + set lesson_id = #{record.lessonId,jdbcType=BIGINT}, + department_id = #{record.departmentId,jdbcType=INTEGER} + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/UserCompanyRelDAO.xml b/src/main/resources/mybatis/mapper/DepartmentUserDAO.xml similarity index 58% rename from src/main/resources/mybatis/mapper/UserCompanyRelDAO.xml rename to src/main/resources/mybatis/mapper/DepartmentUserDAO.xml index fd4a7eda6..b24c4f7aa 100644 --- a/src/main/resources/mybatis/mapper/UserCompanyRelDAO.xml +++ b/src/main/resources/mybatis/mapper/DepartmentUserDAO.xml @@ -1,10 +1,11 @@ - - + + - + + @@ -68,15 +69,15 @@ - id, user_id, company_id, manager, create_time, update_time + id, user_id, department_id, position_id, manager, create_time, update_time - select distinct - from user_company_rel + from department_user @@ -95,33 +96,38 @@ - delete from user_company_rel + delete from department_user where id = #{id,jdbcType=BIGINT} - - delete from user_company_rel + + delete from department_user - - insert into user_company_rel (user_id, company_id, manager, - create_time, update_time) - values (#{userId,jdbcType=BIGINT}, #{companyId,jdbcType=INTEGER}, #{manager,jdbcType=BIT}, - #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) + + insert into department_user (user_id, department_id, position_id, + manager, create_time, update_time + ) + values (#{userId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER}, #{positionId,jdbcType=INTEGER}, + #{manager,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} + ) - - insert into user_company_rel + + insert into department_user user_id, - - company_id, + + department_id, + + + position_id, manager, @@ -137,8 +143,11 @@ #{userId,jdbcType=BIGINT}, - - #{companyId,jdbcType=INTEGER}, + + #{departmentId,jdbcType=INTEGER}, + + + #{positionId,jdbcType=INTEGER}, #{manager,jdbcType=BIT}, @@ -151,14 +160,14 @@ - + select count(*) from department_user - update user_company_rel + update department_user id = #{record.id,jdbcType=BIGINT}, @@ -166,8 +175,11 @@ user_id = #{record.userId,jdbcType=BIGINT}, - - company_id = #{record.companyId,jdbcType=INTEGER}, + + department_id = #{record.departmentId,jdbcType=INTEGER}, + + + position_id = #{record.positionId,jdbcType=INTEGER}, manager = #{record.manager,jdbcType=BIT}, @@ -184,10 +196,11 @@ - update user_company_rel + update department_user set id = #{record.id,jdbcType=BIGINT}, user_id = #{record.userId,jdbcType=BIGINT}, - company_id = #{record.companyId,jdbcType=INTEGER}, + department_id = #{record.departmentId,jdbcType=INTEGER}, + position_id = #{record.positionId,jdbcType=INTEGER}, manager = #{record.manager,jdbcType=BIT}, create_time = #{record.createTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP} @@ -195,14 +208,17 @@ - - update user_company_rel + + update department_user user_id = #{userId,jdbcType=BIGINT}, - - company_id = #{companyId,jdbcType=INTEGER}, + + department_id = #{departmentId,jdbcType=INTEGER}, + + + position_id = #{positionId,jdbcType=INTEGER}, manager = #{manager,jdbcType=BIT}, @@ -216,24 +232,67 @@ where id = #{id,jdbcType=BIGINT} - - update user_company_rel + + update department_user set user_id = #{userId,jdbcType=BIGINT}, - company_id = #{companyId,jdbcType=INTEGER}, + department_id = #{departmentId,jdbcType=INTEGER}, + position_id = #{positionId,jdbcType=INTEGER}, manager = #{manager,jdbcType=BIT}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} - - - update user_company_rel set - - user_id = #{record.userId,jdbcType=BIGINT}, - company_id = #{record.companyId,jdbcType=INTEGER}, - manager = #{record.manager,jdbcType=BIT}, - create_time = #{record.createTime,jdbcType=TIMESTAMP}, - update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mybatis/mapper/SysUserDAO.xml b/src/main/resources/mybatis/mapper/SysUserDAO.xml index 130bad963..b58072214 100644 --- a/src/main/resources/mybatis/mapper/SysUserDAO.xml +++ b/src/main/resources/mybatis/mapper/SysUserDAO.xml @@ -415,7 +415,6 @@ update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} - @@ -435,30 +434,49 @@ + - + SELECT + s.id as userId, account, s.`name` as userName, nickname, avatar_path, `password`, mobile, nationcode, email, + wx_id, wx_union_id, wm_open_id, `status`, roles, `offline`, s.create_time, update_user_id, + s.update_time, c.id as companyId, c.`name` as companyName,cu.admin as admin + FROM sys_user s LEFT JOIN company_user cu ON s.id=cu.user_id LEFT JOIN company c ON c.id = cu.company_id - and sys_user.`name` like concat('%', #{name}, '%') + and s.`name` like concat('%', #{name}, '%') - and sys_user.`nickname` like concat('%', #{nickname}, '%') + and s.`nickname` like concat('%', #{nickname}, '%') - and sys_user.`mobile` like concat('%', #{mobile}, '%') + and s.`mobile` like concat('%', #{mobile}, '%') - and sys_user.`roles` like concat('%', #{rolesStr}, '%') + and s.`roles` like concat('%', #{rolesStr}, '%') - and company.id = #{companyId} + and c.id = #{companyId} - order by sys_user.id + order by s.id + + + + +