单位部门成员数据管理关联课程考试

This commit is contained in:
DU 2021-01-08 18:00:51 +08:00
parent 8b64fde956
commit c6f0df8b18
53 changed files with 5077 additions and 489 deletions

94
sql/20210108-dukang.sql Normal file
View File

@ -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
;

View File

@ -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();
//
//}

View File

@ -4,9 +4,8 @@ import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.ICompanyService; import club.joylink.rtss.services.ICompanyService;
import club.joylink.rtss.vo.UserVO; 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.PageVO;
import club.joylink.rtss.vo.client.company.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -16,7 +15,7 @@ import springfox.documentation.annotations.ApiIgnore;
import java.util.List; import java.util.List;
@Api(tags = {"公司单位管理接口"}) @Api(tags = {"单位成员管理接口"})
@RestController @RestController
@RequestMapping("/api/company") @RequestMapping("/api/company")
public class CompanyController { public class CompanyController {
@ -27,52 +26,178 @@ public class CompanyController {
@ApiOperation(value = "添加公司信息") @ApiOperation(value = "添加公司信息")
@PostMapping @PostMapping
public CompanyVO create(@RequestBody @Validated CompanyVO company) { public CompanyVO create(@RequestBody @Validated CompanyVO company) {
CompanyVO vo = this.iCompanyService.create(company); CompanyVO vo = iCompanyService.create(company);
return vo; return vo;
} }
@ApiOperation(value = "获取公司列表") @ApiOperation(value = "获取公司列表")
@GetMapping @GetMapping
public List<CompanyVO> queryAll() { public List<CompanyVO> queryAll() {
List<CompanyVO> list = this.iCompanyService.queryOrganizations(); List<CompanyVO> list = iCompanyService.queryOrganizations();
return list; return list;
} }
@ApiOperation(value = "分页获取公司列表") @ApiOperation(value = "分页获取公司列表")
@GetMapping("paging") @GetMapping("paging")
public PageVO<CompanyVO> pagingQueryAll(CompanyQueryVO queryVO) { public PageVO<CompanyVO> pagingQueryAll(CompanyQueryVO queryVO) {
PageVO<CompanyVO> list = this.iCompanyService.queryPageOrganizations(queryVO); PageVO<CompanyVO> list = iCompanyService.queryPageOrganizations(queryVO);
return list; return list;
} }
@ApiOperation(value = "删除公司信息") @ApiOperation(value = "删除公司信息")
@DeleteMapping("{id}") @DeleteMapping("{id}")
public void delete( @PathVariable Integer id) { public void delete( @PathVariable Integer id) {
this.iCompanyService.deleteCompanyById(id); iCompanyService.deleteCompanyById(id);
} }
@ApiOperation(value = "查询公司信息") @ApiOperation(value = "查询公司信息")
@GetMapping("{id}") @GetMapping("{id}")
public CompanyVO get( @PathVariable Integer id) { public CompanyVO get( @PathVariable Integer id) {
return this.iCompanyService.getCompanyById(id); return iCompanyService.getCompanyById(id);
} }
@ApiOperation(value = "更新公司信息") @ApiOperation(value = "更新公司信息")
@PutMapping("{id}") @PutMapping("{id}")
public CompanyVO updateCompany(@PathVariable Integer id, @RequestBody @Validated CompanyVO company) { 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}) // @Role({RoleEnum.Admin, RoleEnum.SuperAdmin})
@ApiOperation("添加公司管理者") // @ApiOperation("添加公司管理者")
@PutMapping("/{companyId}/addManager") // @PutMapping("/{companyId}/addManager")
public void addManager(@PathVariable Integer companyId, @RequestBody List<Long> userIds, @RequestAttribute @ApiIgnore UserVO user) { // public void addManager(@PathVariable Integer companyId, @RequestBody List<Long> userIds, @RequestAttribute @ApiIgnore UserVO user) {
iCompanyService.addManager(companyId, userIds, user); // iCompanyService.addManager(companyId, userIds, user);
} // }
//
// @Role({RoleEnum.Admin, RoleEnum.SuperAdmin})
// @ApiOperation("取消公司管理者")
// @PutMapping("/{companyId}/removeManager")
// public void addManager(@PathVariable Integer companyId, @RequestBody List<Long> userIds, @RequestAttribute @ApiIgnore UserVO user) {
// iCompanyService.removeManager(companyId, userIds, user);
// }
@ApiOperation(value = "微信小程用户绑定单位") @ApiOperation(value = "微信小程用户绑定单位")
@PutMapping(path = "/bind/company") @PutMapping(path = "/bind/company")
public void userBindCompany(Long userId, Integer companyId) { public void userScanCodeBindCompany(Long userId, Integer companyId) {
this.iCompanyService.userBindCompany(userId, 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<DepartmentVO> queryCompanyDepartTree(@PathVariable Integer companyId) {
List<DepartmentVO> list = iCompanyService.getCompanyDepartTree(companyId);
return list;
}
@ApiOperation(value = "获取单位所有部门")
@GetMapping(path = "{companyId}/dept")
public List<DepartmentVO> queryCompanyDepart(@PathVariable Integer companyId) {
List<DepartmentVO> 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<DepartmentVO> 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<PositionVO> 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<CompanyDepartUserVO> 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<CompanyDepartUserVO> getUserCompanyDeparts(@RequestAttribute @ApiIgnore UserVO user, @PathVariable Integer companyId) {
return iCompanyService.getUserCompanyDeparts(user,companyId);
}
} }

View File

@ -2,14 +2,14 @@ package club.joylink.rtss.controller.publish;
import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.ICompanyService;
import club.joylink.rtss.services.ILessonService; import club.joylink.rtss.services.ILessonService;
import club.joylink.rtss.services.student.IClassStudentUserService;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.LessonQueryVO; import club.joylink.rtss.vo.client.LessonQueryVO;
import club.joylink.rtss.vo.client.LessonTreeVO; import club.joylink.rtss.vo.client.LessonTreeVO;
import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.LessonVO;
import club.joylink.rtss.vo.client.PageVO; 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 club.joylink.rtss.vo.client.validGroup.LessonUpdateNameAndRemarksCheck;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -28,7 +28,7 @@ public class LessonController {
private ILessonService iLessonService; private ILessonService iLessonService;
@Autowired @Autowired
private IClassStudentUserService iClassStudentUserService; private ICompanyService iCompanyService;
@Autowired @Autowired
public LessonController(ILessonService iLessonService) { public LessonController(ILessonService iLessonService) {
@ -53,16 +53,16 @@ public class LessonController {
return this.iLessonService.queryValidLessons(lessonQueryVO); return this.iLessonService.queryValidLessons(lessonQueryVO);
} }
@ApiOperation(value = "根据班级获取关联课程列表") @ApiOperation(value = "根据部门获取关联课程列表")
@GetMapping(path = "/class/{classId}") @GetMapping(path = "/depart/{departId}")
public List<LessonVO> queryLessons(@PathVariable Integer classId) { public List<LessonVO> queryLessons(@PathVariable Integer departId) {
return this.iClassStudentUserService.getLessonByClass(classId); return this.iCompanyService.getLessonsByDepart(departId);
} }
@ApiOperation(value = "根据课程获取关联班级信息列表") @ApiOperation(value = "根据课程获取关联班级信息列表")
@GetMapping(path = "/{lessonId}/classes") @GetMapping(path = "/{lessonId}/departs")
public List<StudentClassVO> queryClassByLesson(@PathVariable Long lessonId) { public List<DepartmentVO> queryClassByLesson(@PathVariable Long lessonId) {
return this.iClassStudentUserService.getClassesByLesson(lessonId); return this.iCompanyService.getDepartsByLesson(lessonId);
} }
@ApiOperation(value = "获取课程列表") @ApiOperation(value = "获取课程列表")

View File

@ -4,14 +4,12 @@ import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.ISysUserService; import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.services.local.UserGenerateService; 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.UserQueryVO;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.UserConfigVO; import club.joylink.rtss.vo.client.UserConfigVO;
import club.joylink.rtss.vo.client.student.ExportStudentInfo; 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.student.StudentInfoExportParam;
import club.joylink.rtss.vo.client.user.WeChatBindStatusVO; import club.joylink.rtss.vo.client.user.WeChatBindStatusVO;
import club.joylink.rtss.vo.user.UserGenerateConfigVO; import club.joylink.rtss.vo.user.UserGenerateConfigVO;
@ -37,7 +35,7 @@ public class UserController {
private UserGenerateService userGenerateService; private UserGenerateService userGenerateService;
@Autowired @Autowired
private IClassStudentUserService iClassStudentUserService; private IDepartUserStatisticService iDepartUserStatisticService;
@ApiOperation(value = "更新用户配置") @ApiOperation(value = "更新用户配置")
@PostMapping(path = "/config") @PostMapping(path = "/config")
@ -111,23 +109,23 @@ public class UserController {
return this.iSysUserService.fuzzyQueryPagedUser(fuzzyParam); return this.iSysUserService.fuzzyQueryPagedUser(fuzzyParam);
} }
@ApiOperation(value="贵州装备制造导入学生信息接口") // @ApiOperation(value="贵州装备制造导入学生信息接口")
@PostMapping(path="/project/{projectCode}/import/student") // @PostMapping(path="/project/{projectCode}/import/student")
public void importStudents(@PathVariable String projectCode, @Validated @RequestBody ImportStudentInfo importStudentInfo, @RequestAttribute @ApiIgnore UserVO user){ // public void importStudents(@PathVariable String projectCode, @Validated @RequestBody ImportStudentInfo importStudentInfo, @RequestAttribute @ApiIgnore UserVO user){
this.iClassStudentUserService.importStudentInfos(projectCode, importStudentInfo, user); // this.iClassStudentUserService.importStudentInfos(projectCode, importStudentInfo, user);
// }
@ApiOperation(value="导出部门学生信息及成绩接口")
@PutMapping(path="/scores")
public List<ExportStudentInfo> getStudentSores( @Validated @RequestBody StudentInfoExportParam infoExportParam){
return this.iDepartUserStatisticService.studentInfoStatistics(infoExportParam);
} }
@ApiOperation(value="贵州装备制造导出学生信息及成绩接口") // @ApiOperation(value="贵州装备制造查询对应的班级")
@PutMapping(path="/project/{projectCode}/export/student") // @GetMapping(path="/project/{projectCode}/classes")
public List<ExportStudentInfo> importStudents(@PathVariable String projectCode, @Validated @RequestBody StudentInfoExportParam infoExportParam){ // public List<StudentClassVO> getClasses(@PathVariable String projectCode){
return this.iClassStudentUserService.studentInfoStatistics(infoExportParam); // return this.iClassStudentUserService.getClassesByProjectCode(projectCode);
} // }
@ApiOperation(value="贵州装备制造查询对应的班级")
@GetMapping(path="/project/{projectCode}/classes")
public List<StudentClassVO> getClasses(@PathVariable String projectCode){
return this.iClassStudentUserService.getClassesByProjectCode(projectCode);
}
@ApiOperation("查询销售人员") @ApiOperation("查询销售人员")
@GetMapping("/seller") @GetMapping("/seller")

View File

@ -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<CompanyDepartment, Integer, CompanyDepartmentExample> {
}

View File

@ -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<CompanyPosition, Integer, CompanyPositionExample> {
}

View File

@ -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<CompanyUser, CompanyUser, CompanyUserExample> {
}

View File

@ -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<DepartmentExam, DepartmentExam, DepartmentExamExample> {
@Select("<script>" +
"SELECT c.* " +
"FROM company_department c INNER JOIN department_exam " +
"ON id = department_id " +
"AND exam_id = #{examId} " +
"</script>")
List<CompanyDepartment> getDepartsByExamId(@Param("examId") Long examId);
}

View File

@ -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<DepartmentLesson, DepartmentLesson, DepartmentLessonExample> {
@Select("<script>" +
"SELECT cd.* " +
"FROM company_department cd INNER JOIN department_lesson dl " +
"ON cd.id = dl.department_id " +
"AND lesson_id = #{lessonId} " +
"</script>")
List<CompanyDepartment> getDeparts(@Param("lessonId") Long lessonId);
@Select("<script>" +
"SELECT `name` " +
"FROM company_department " +
"INNER JOIN department_lesson " +
"ON id = department_id " +
"AND lesson_id = #{lessonId} " +
"</script>")
List<String> getClassNames(@Param("lessonId") Long lessonId);
}

View File

@ -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<DepartmentUser, Long, DepartmentUserExample> {
List<CompanyDepartUserVO> getCompanyDepartUsers(CompanyUserQueryVO companyUserQueryVO);
List<CompanyDepartUserVO> getUserCompanyDeparts(@Param("companyId") Integer companyId,@Param("userId") Long userId);
}

View File

@ -47,7 +47,9 @@ public interface SysUserDAO extends MyBatisBaseDao<SysUser, Long, SysUserExample
"</script>") "</script>")
List<DailyLiveQuantityVO> statisticsDailyRegister(@Param("beginDate") LocalDate beginDate, @Param("endDate") LocalDate endDate); List<DailyLiveQuantityVO> statisticsDailyRegister(@Param("beginDate") LocalDate beginDate, @Param("endDate") LocalDate endDate);
List<UserVO> pagedQueryWithCompany(UserQueryVO queryVO); List<UserVO> queryUsersWithCompany(UserQueryVO queryVO);
UserVO queryUserWithCompany(@Param("userId") Long userId);
UserVO queryCompanyUserByAccount(@Param("account") String account,@Param("companyId") Integer companyId);
// @Results(value = { // @Results(value = {
// @Result(column = "id", property = "id"), // @Result(column = "id", property = "id"),

View File

@ -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<UserCompanyRel, Long, UserCompanyRelExample> {
void batchUpdate(List<UserCompanyRel> ucrList);
}

View File

@ -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();
}
}

View File

@ -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<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public CompanyDepartmentExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> 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<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> 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<Integer> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andCompanyIdNotIn(List<Integer> 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<Integer> values) {
addCriterion("parent_id in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotIn(List<Integer> 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);
}
}
}

View File

@ -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();
}
}

View File

@ -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<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public CompanyPositionExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> 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<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> 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<Integer> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andCompanyIdNotIn(List<Integer> 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);
}
}
}

View File

@ -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();
}
}

View File

@ -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<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public CompanyUserExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Integer> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andCompanyIdNotIn(List<Integer> 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<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> 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<Boolean> values) {
addCriterion("`admin` in", values, "admin");
return (Criteria) this;
}
public Criteria andAdminNotIn(List<Boolean> 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);
}
}
}

View File

@ -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();
}
}

View File

@ -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<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public DepartmentExamExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Long> values) {
addCriterion("exam_id in", values, "examId");
return (Criteria) this;
}
public Criteria andExamIdNotIn(List<Long> 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<Integer> values) {
addCriterion("department_id in", values, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdNotIn(List<Integer> 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);
}
}
}

View File

@ -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();
}
}

View File

@ -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<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public DepartmentLessonExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Long> values) {
addCriterion("lesson_id in", values, "lessonId");
return (Criteria) this;
}
public Criteria andLessonIdNotIn(List<Long> 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<Integer> values) {
addCriterion("department_id in", values, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdNotIn(List<Integer> 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);
}
}
}

View File

@ -4,10 +4,10 @@ import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
* user_company_rel * department_user
* @author * @author
*/ */
public class UserCompanyRel implements Serializable { public class DepartmentUser implements Serializable {
private Long id; private Long id;
/** /**
@ -16,12 +16,17 @@ public class UserCompanyRel implements Serializable {
private Long userId; private Long userId;
/** /**
* 单位id * 部门id
*/ */
private Integer companyId; private Integer departmentId;
/** /**
* 是否管理员 * 职位id
*/
private Integer positionId;
/**
* 部门管理员
*/ */
private Boolean manager; private Boolean manager;
@ -53,12 +58,20 @@ public class UserCompanyRel implements Serializable {
this.userId = userId; this.userId = userId;
} }
public Integer getCompanyId() { public Integer getDepartmentId() {
return companyId; return departmentId;
} }
public void setCompanyId(Integer companyId) { public void setDepartmentId(Integer departmentId) {
this.companyId = companyId; this.departmentId = departmentId;
}
public Integer getPositionId() {
return positionId;
}
public void setPositionId(Integer positionId) {
this.positionId = positionId;
} }
public Boolean getManager() { public Boolean getManager() {
@ -96,10 +109,11 @@ public class UserCompanyRel implements Serializable {
if (getClass() != that.getClass()) { if (getClass() != that.getClass()) {
return false; return false;
} }
UserCompanyRel other = (UserCompanyRel) that; DepartmentUser other = (DepartmentUser) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (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.getManager() == null ? other.getManager() == null : this.getManager().equals(other.getManager()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
@ -111,7 +125,8 @@ public class UserCompanyRel implements Serializable {
int result = 1; int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().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 + ((getManager() == null) ? 0 : getManager().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().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("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", userId=").append(userId); 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(", manager=").append(manager);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);

View File

@ -4,7 +4,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class UserCompanyRelExample { public class DepartmentUserExample {
protected String orderByClause; protected String orderByClause;
protected boolean distinct; protected boolean distinct;
@ -15,7 +15,7 @@ public class UserCompanyRelExample {
private Long offset; private Long offset;
public UserCompanyRelExample() { public DepartmentUserExample() {
oredCriteria = new ArrayList<Criteria>(); oredCriteria = new ArrayList<Criteria>();
} }
@ -245,63 +245,123 @@ public class UserCompanyRelExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdIsNull() { public Criteria andDepartmentIdIsNull() {
addCriterion("company_id is null"); addCriterion("department_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdIsNotNull() { public Criteria andDepartmentIdIsNotNull() {
addCriterion("company_id is not null"); addCriterion("department_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdEqualTo(Integer value) { public Criteria andDepartmentIdEqualTo(Integer value) {
addCriterion("company_id =", value, "companyId"); addCriterion("department_id =", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdNotEqualTo(Integer value) { public Criteria andDepartmentIdNotEqualTo(Integer value) {
addCriterion("company_id <>", value, "companyId"); addCriterion("department_id <>", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdGreaterThan(Integer value) { public Criteria andDepartmentIdGreaterThan(Integer value) {
addCriterion("company_id >", value, "companyId"); addCriterion("department_id >", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdGreaterThanOrEqualTo(Integer value) { public Criteria andDepartmentIdGreaterThanOrEqualTo(Integer value) {
addCriterion("company_id >=", value, "companyId"); addCriterion("department_id >=", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdLessThan(Integer value) { public Criteria andDepartmentIdLessThan(Integer value) {
addCriterion("company_id <", value, "companyId"); addCriterion("department_id <", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdLessThanOrEqualTo(Integer value) { public Criteria andDepartmentIdLessThanOrEqualTo(Integer value) {
addCriterion("company_id <=", value, "companyId"); addCriterion("department_id <=", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdIn(List<Integer> values) { public Criteria andDepartmentIdIn(List<Integer> values) {
addCriterion("company_id in", values, "companyId"); addCriterion("department_id in", values, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdNotIn(List<Integer> values) { public Criteria andDepartmentIdNotIn(List<Integer> values) {
addCriterion("company_id not in", values, "companyId"); addCriterion("department_id not in", values, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdBetween(Integer value1, Integer value2) { public Criteria andDepartmentIdBetween(Integer value1, Integer value2) {
addCriterion("company_id between", value1, value2, "companyId"); addCriterion("department_id between", value1, value2, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdNotBetween(Integer value1, Integer value2) { public Criteria andDepartmentIdNotBetween(Integer value1, Integer value2) {
addCriterion("company_id not between", value1, value2, "companyId"); 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<Integer> values) {
addCriterion("position_id in", values, "positionId");
return (Criteria) this;
}
public Criteria andPositionIdNotIn(List<Integer> 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; return (Criteria) this;
} }

View File

@ -1,26 +1,25 @@
package club.joylink.rtss.services; package club.joylink.rtss.services;
import club.joylink.rtss.dao.CompanyDAO; import club.joylink.rtss.dao.*;
import club.joylink.rtss.dao.UserCompanyRelDAO;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.completition.IRaceQuestionsRuleService; import club.joylink.rtss.services.completition.IRaceQuestionsRuleService;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.CompanyQueryVO; import club.joylink.rtss.vo.client.LessonVO;
import club.joylink.rtss.vo.client.CompanyVO;
import club.joylink.rtss.vo.client.PageVO; 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.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -29,6 +28,12 @@ public class CompanyService implements ICompanyService {
@Autowired @Autowired
private CompanyDAO companyDAO; private CompanyDAO companyDAO;
@Autowired
private CompanyUserDAO companyUserDAO;
@Autowired
private CompanyDepartmentDAO departmentDAO;
@Autowired @Autowired
private IRaceQuestionsRuleService IRaceQuestionsRuleService; private IRaceQuestionsRuleService IRaceQuestionsRuleService;
@ -36,8 +41,15 @@ public class CompanyService implements ICompanyService {
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@Autowired @Autowired
private UserCompanyRelDAO userCompanyRelDAO; private DepartmentUserDAO departmentUserDAO;
@Autowired
private DepartmentLessonDAO departmentLessonDAO;
@Autowired
private DepartmentExamDAO departmentExamDAO;
@Autowired
private ILessonService lessonService;
//************************************单位管理**********************************************
@Override @Override
public List<CompanyVO> queryOrganizations() { public List<CompanyVO> queryOrganizations() {
CompanyExample example = new CompanyExample(); CompanyExample example = new CompanyExample();
@ -55,61 +67,13 @@ public class CompanyService implements ICompanyService {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName())); criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
} }
Page<Company> page = (Page<Company>) companyDAO.selectByExample(example); Page<Company> page = (Page<Company>) companyDAO.selectByExample(example);
List<CompanyVO> voList = page.getResult().stream().map(company -> { List<CompanyVO> voList =CompanyVO.convert2VOList(page.getResult());
List<SysUser> managers;
List<UserCompanyRel> ucrList = findUserCompanyRelEntity(company.getId(), true);
if (CollectionUtils.isEmpty(ucrList)) {
managers = new ArrayList<>();
} else {
List<Long> managerIds = ucrList.stream().map(UserCompanyRel::getUserId).collect(Collectors.toList());
managers = iSysUserService.findEntity(managerIds);
}
List<UserVO> managerVOs = UserVO.convert2BaseInfoVO(managers);
return CompanyVO.convertFromDB(company, managerVOs);
}).collect(Collectors.toList());
return PageVO.convert(page, voList); return PageVO.convert(page, voList);
} }
@Override @Override
public void addManager(Integer companyId, List<Long> userIds, UserVO user) { public void userScanCodeBindCompany(Long userId, Integer companyId) {
iSysUserService.confirmAdmin(user); iSysUserService.userScanCodeBindCompany(userId, companyId);
List<UserCompanyRel> 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<UserCompanyRel> findUserCompanyRelEntity(List<Long> 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);
} }
@Override @Override
@ -130,7 +94,6 @@ public class CompanyService implements ICompanyService {
@Transactional @Transactional
@Override @Override
public void deleteCompanyById(Integer companyId) { public void deleteCompanyById(Integer companyId) {
companyDAO.deleteByPrimaryKey(companyId); companyDAO.deleteByPrimaryKey(companyId);
IRaceQuestionsRuleService.deleteByCompanyId(companyId); IRaceQuestionsRuleService.deleteByCompanyId(companyId);
} }
@ -142,6 +105,24 @@ public class CompanyService implements ICompanyService {
String.format("id为[%s]的公司不存在", companyId)); String.format("id为[%s]的公司不存在", companyId));
return new CompanyVO(entity); return new CompanyVO(entity);
} }
//
// @Override
// public void addManager(Integer companyId, List<Long> 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<Long> 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 @Override
public boolean isExist(Integer companyId) { public boolean isExist(Integer companyId) {
@ -153,62 +134,402 @@ public class CompanyService implements ICompanyService {
private Company getCompanyEntity(Integer id) { private Company getCompanyEntity(Integer id) {
Company company = companyDAO.selectByPrimaryKey(id); Company company = companyDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company,String.format("单位[%s]不存在",id));
return company; return company;
} }
private List<UserCompanyRel> findUserCompanyRelEntity(Integer companyId, boolean manager) { @Override
UserCompanyRelExample example = new UserCompanyRelExample(); public boolean isCompanyUser(Long userId) {
example.createCriteria().andCompanyIdEqualTo(companyId).andManagerEqualTo(manager); CompanyUserExample e = new CompanyUserExample();
return userCompanyRelDAO.selectByExample(example); e.createCriteria().andUserIdEqualTo(userId);
return companyUserDAO.countByExample(e)>0;
} }
private List<UserCompanyRel> getUserCompanyRelEntity(@NonNull List<Long> userIds) { //************************************部门管理**********************************************
UserCompanyRelExample example = new UserCompanyRelExample();
example.createCriteria().andUserIdIn(userIds); /**
List<UserCompanyRel> 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<UserCompanyRel> 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<UserCompanyRel> ucrs = userCompanyRelDAO.selectByExample(example); @Override
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(ucrs); public void deleteDepartById(Integer deptId) {
return ucrs.get(0); departmentDAO.deleteByPrimaryKey(deptId);
} }
private UserCompanyRel findUserCompanyRelEntity(Long userId) { /**
UserCompanyRelExample example = new UserCompanyRelExample(); * 查询部门信息
example.createCriteria().andUserIdEqualTo(userId); */
List<UserCompanyRel> ucrs = userCompanyRelDAO.selectByExample(example); @Override
if (CollectionUtils.isEmpty(ucrs)) { public DepartmentVO getDepartById(Integer deptId) {
CompanyDepartment entity = departmentDAO.selectByPrimaryKey(deptId);
if (Objects.isNull(entity)) {
return null; return null;
} }
return new DepartmentVO(entity);
}
/**
* 根据单位id查询部门及其子部门信息
*/
@Override
public List<DepartmentVO> getCompanyDepartTree(Integer companyId) {
CompanyDepartmentExample example = new CompanyDepartmentExample();
example.createCriteria().andCompanyIdEqualTo(companyId);
List<CompanyDepartment> companyDepartments = departmentDAO.selectByExample(example);
return DepartmentVO.buildDeptTree(DepartmentVO.convert2VOList(companyDepartments));
}
@Override
public List<DepartmentVO> getCompanyAllDepart(Integer companyId) {
CompanyDepartmentExample example = new CompanyDepartmentExample();
example.createCriteria().andCompanyIdEqualTo(companyId);
List<CompanyDepartment> 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<CompanyDepartment> companyDepartments = departmentDAO.selectByExample(example);
List<DepartmentVO> childDept = DepartmentVO.getChildDept(deptId, DepartmentVO.convert2VOList(companyDepartments));
DepartmentVO departmentVO = new DepartmentVO(companyDepartment);
departmentVO.setChildDept(childDept);
return departmentVO;
}
@Override
public List<DepartmentVO> 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<PositionVO> getPositionsByCompanyId(Integer companyId) {
// var example = new CompanyPositionExample();
// example.createCriteria()
// .andCompanyIdEqualTo(companyId);
// List<CompanyPosition> 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<DepartmentUser> ucrs = departmentUserDAO.selectByExample(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(ucrs, "非部门" + departId + "内部用户");
return ucrs.get(0); return ucrs.get(0);
} }
private void createOrUpdateUserCompanyRel(Long userId, Integer companyId) { @Override
UserVO user = iSysUserService.getUserById(userId); public List<UserDepartRelVO> getDepartRefByUserId(Long userId) {
DepartmentUserExample e = new DepartmentUserExample();
e.createCriteria().andUserIdEqualTo(userId);
List<DepartmentUser> 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<CompanyDepartUserVO> getUserCompanyDeparts(UserVO user, Integer companyId) {
//根据公司id和用户id查询用户企业详细信息
return departmentUserDAO.getUserCompanyDeparts(companyId,user.getId());
}
@Override
public PageVO<CompanyDepartUserVO> getCompanyDepartUserInfoList(UserVO user, Integer departId, CompanyUserQueryVO companyUserQueryVO) {
//根据部门id查询部门成员
companyUserQueryVO.setDepartmentId(departId);
PageHelper.startPage(companyUserQueryVO.getPageNum(), companyUserQueryVO.getPageSize());
Page<CompanyDepartUserVO> page = (Page<CompanyDepartUserVO>) departmentUserDAO.getCompanyDepartUsers(companyUserQueryVO);
return PageVO.convert(page);
}
@Transactional
@Override
public void importCompanyUserInfo(UserVO user, Integer companyId, ImportCompanyUserVO importCompanyUserVO) {
//验证操作人员
Company company = getCompanyEntity(companyId); Company company = getCompanyEntity(companyId);
UserCompanyRel ucr = findUserCompanyRelEntity(userId); BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(company, "单位不存在");
if (ucr == null) { BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(user.getCompanyId(), companyId, "非同单位成员无法操作");
UserCompanyRel newUcr = new UserCompanyRel();
newUcr.setUserId(user.getId()); //验证是否存在并导入新的年级和班级
newUcr.setCompanyId(company.getId()); var departmentExample = new CompanyDepartmentExample();
newUcr.setCreateTime(LocalDateTime.now()); departmentExample.createCriteria()
userCompanyRelDAO.insert(newUcr); .andCompanyIdEqualTo(companyId)
.andNameEqualTo(importCompanyUserVO.getParentDepart());
List<CompanyDepartment> 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 { } else {
ucr.setCompanyId(companyId); parentDepart = new DepartmentVO(importParentDepart.get(0));
userCompanyRelDAO.updateByPrimaryKey(ucr); 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<CompanyDepartment> 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<DepartmentUser> departmentUsers = departmentUserDAO.selectByExample(departmentUserExample);
BusinessExceptionAssertEnum.INVALID_OPERATION.assertCollectionEmpty(departmentUsers, "非部门成员/导入部门信息重复");
BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(departmentUsers.get(0).getManager(), "非部门管理员");
} }
} }
//构建系统用户对象
List<SysUser> 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<DepartmentUser> 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<DepartmentVO> getDepartsByLesson(Long lessonId) {
List<CompanyDepartment> classes = this.departmentLessonDAO.getDeparts(lessonId);
return DepartmentVO.convert2VOList(classes);
}
@Override
public List<DepartmentVO> getDepartsByExamId(Long examId) {
DepartmentExamExample example = new DepartmentExamExample();
example.createCriteria().andExamIdEqualTo(examId);
List<CompanyDepartment> classes = this.departmentExamDAO.getDepartsByExamId(examId);
return DepartmentVO.convert2VOList(classes);
}
@Override
public List<Long> getExamIdsByDepartId(Integer departId) {
DepartmentExamExample example = new DepartmentExamExample();
example.createCriteria().andDepartmentIdEqualTo(departId);
List<DepartmentExam> 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<DepartmentLesson> getDepartLessonRefs(Integer departId) {
DepartmentLessonExample example = new DepartmentLessonExample();
example.createCriteria().andDepartmentIdEqualTo(departId);
List<DepartmentLesson> departmentLessonRef = this.departmentLessonDAO.selectByExample(example);
return departmentLessonRef;
}
@Override
public List<LessonVO> getLessonsByDepart(Integer departId) {
List<Long> 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<String> getDepartNamesByLesson(Long LessonId) {
List<String> classes = this.departmentLessonDAO.getClassNames(LessonId);
return classes;
}
} }

View File

@ -4,10 +4,10 @@ import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.*; import club.joylink.rtss.dao.*;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.student.IClassStudentUserService;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.*; 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 club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -54,7 +54,7 @@ public class ExamService implements IExamService{
private ExamDefinitionRulesDAO examDefinitionRulesDAO; private ExamDefinitionRulesDAO examDefinitionRulesDAO;
@Autowired @Autowired
private IClassStudentUserService iClassStudentUserService; private ICompanyService iCompanyService;
/** /**
* 创建考试定义 * 创建考试定义
@ -158,7 +158,7 @@ public class ExamService implements IExamService{
examDefinitionDAO.insert(examDefinition); examDefinitionDAO.insert(examDefinition);
//插入试卷班级关系 //插入试卷班级关系
if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { 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<ExamDefinitionRulesVO> examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList(); List<ExamDefinitionRulesVO> examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList();
@ -266,7 +266,7 @@ public class ExamService implements IExamService{
examDefinitionRulesVOList.add(examDefinitionRulesVO); examDefinitionRulesVOList.add(examDefinitionRulesVO);
}); });
ExamDefinitionVO examDefinitionVO = new ExamDefinitionVO(examDefinition); ExamDefinitionVO examDefinitionVO = new ExamDefinitionVO(examDefinition);
examDefinitionVO.setClasses(iClassStudentUserService.getClassesByExamId(examId)); examDefinitionVO.setClasses(iCompanyService.getDepartsByExamId(examId));
examDefinitionVO.setExamDefinitionRulesVOList(examDefinitionRulesVOList); examDefinitionVO.setExamDefinitionRulesVOList(examDefinitionRulesVOList);
return examDefinitionVO; return examDefinitionVO;
@ -281,11 +281,12 @@ public class ExamService implements IExamService{
//查询课程信息 //查询课程信息
LessonVO lessonVO = iLessonService.getLessonInfo(lessonId); LessonVO lessonVO = iLessonService.getLessonInfo(lessonId);
// 如果用户关联班级 查找班级关联试卷 // 如果用户关联班级 查找班级关联试卷
List<StudentRelIdClass> studentRelIdClasses = this.iClassStudentUserService.getRelClassByUser(userVO.getId()); List<UserDepartRelVO> userDepartRelVOS = this.iCompanyService.getDepartRefByUserId(userVO.getId());
List<Long> examIds = null; List<Long> examIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(studentRelIdClasses)) { if (!CollectionUtils.isEmpty(userDepartRelVOS)) {
Integer classId = studentRelIdClasses.get(0).getClassId(); for (UserDepartRelVO udr : userDepartRelVOS) {
examIds = iClassStudentUserService.getRelExamIdsByClassId(classId); examIds.addAll(iCompanyService.getExamIdsByDepartId(udr.getDepartmentId()));
}
} }
//查询课程下的试题信息 //查询课程下的试题信息
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
@ -299,7 +300,7 @@ public class ExamService implements IExamService{
if (null != exam.getEndTime() && now.isAfter(exam.getEndTime())) { if (null != exam.getEndTime() && now.isAfter(exam.getEndTime())) {
this.offLine(exam.getId(), userVO); this.offLine(exam.getId(), userVO);
iterator.remove(); iterator.remove();
} else if (Objects.nonNull(examIds) && !examIds.contains(exam.getId())) { } else if (!examIds.contains(exam.getId())) {
iterator.remove(); iterator.remove();
} }
} }
@ -309,9 +310,9 @@ public class ExamService implements IExamService{
examDefinitionList.forEach(examDefinition -> { examDefinitionList.forEach(examDefinition -> {
ExamDefinitionVO exam = new ExamDefinitionVO(examDefinition); ExamDefinitionVO exam = new ExamDefinitionVO(examDefinition);
// 试卷存在班级关系获取班级列表 // 试卷存在班级关系获取班级列表
List<StudentClassVO> classes = iClassStudentUserService.getClassesByExamId(examDefinition.getId()); List<DepartmentVO> departs = iCompanyService.getDepartsByExamId(examDefinition.getId());
if (!CollectionUtils.isEmpty(classes)) { if (!CollectionUtils.isEmpty(departs)) {
exam.setClasses(classes); exam.setClasses(departs);
} }
examDefinitionVOList.add(exam); examDefinitionVOList.add(exam);
}); });
@ -476,9 +477,11 @@ public class ExamService implements IExamService{
public void update(Long id, ExamDefinitionVO examDefinitionVO) { public void update(Long id, ExamDefinitionVO examDefinitionVO) {
ExamDefinition examDefinition = this.examDefinitionDAO.selectByPrimaryKey(id); ExamDefinition examDefinition = this.examDefinitionDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(examDefinition); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(examDefinition);
iClassStudentUserService.getClassesByExamId(id).forEach(studentClassVO -> iClassStudentUserService.deleteExamRelClass(id)); if (!CollectionUtils.isEmpty(iCompanyService.getDepartsByExamId(id))) {
if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())){ iCompanyService.deleteDepartsExam(id);
examDefinitionVO.getClasses().forEach(studentClassVO -> iClassStudentUserService.addExamRelClass(id, studentClassVO.getId())); }
if (!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) {
examDefinitionVO.getClasses().forEach(departmentVO -> iCompanyService.addDepartExam(id, departmentVO.getId()));
} }
//考试名称查重 //考试名称查重
String name = examDefinitionVO.getName(); String name = examDefinitionVO.getName();

View File

@ -1,10 +1,10 @@
package club.joylink.rtss.services; 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.UserVO;
import club.joylink.rtss.vo.client.CompanyQueryVO; import club.joylink.rtss.vo.client.LessonVO;
import club.joylink.rtss.vo.client.CompanyVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.company.*;
import java.util.List; import java.util.List;
@ -20,32 +20,93 @@ public interface ICompanyService {
CompanyVO getCompanyById(Integer companyId); CompanyVO getCompanyById(Integer companyId);
// void removeManager(Integer companyId, List<Long> userIds, UserVO user);
boolean isExist(Integer companyId); boolean isExist(Integer companyId);
PageVO<CompanyVO> queryPageOrganizations(CompanyQueryVO queryVO); PageVO<CompanyVO> queryPageOrganizations(CompanyQueryVO queryVO);
//
/** // /**
* 添加公司管理员 // * 添加公司管理员
*/ // */
void addManager(Integer companyId, List<Long> userIds, UserVO user); // void addManager(Integer companyId, List<Long> userIds, UserVO user);
/** /**
* 用户绑定单位 * 用户绑定单位
*/ */
void userBindCompany(Long userId, Integer companyId); void userScanCodeBindCompany(Long userId, Integer companyId);
/** // /**
* 查询用户公司关联关系 // * 查询用户公司关联关系
*/ // */
List<UserCompanyRel> findUserCompanyRelEntity(List<Long> collect); // List<UserCompanyRel> findUserCompanyRelEntity(List<Long> collect);
//
// /**
// * 超管修改用户的单位
// */
// void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin);
//
// /**
// * 删除用户和公司的关联关系
// */
// void deleteUserCompanyRel(Long userId);
/** boolean isCompanyUser(Long userId);
* 超管修改用户的单位
*/
void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin);
/** DepartmentVO createDepart(DepartmentVO departmentVO);
* 删除用户和公司的关联关系
*/ void updateDepartInfo(Integer id, DepartmentVO departmentVO);
void deleteUserCompanyRel(Long userId);
void deleteDepartById(Integer deptId);
DepartmentVO getDepartById(Integer deptId);
List<DepartmentVO> getCompanyDepartTree(Integer companyId);
List<DepartmentVO> getCompanyAllDepart(Integer companyId);
DepartmentVO getDepartTree(Integer companyId, Integer deptId);
List<DepartmentVO> getDepartAndChild(Integer companyId, Integer deptId);
// PositionVO createPosition(PositionVO positionVO);
//
// void updatePositionInfo(Integer positionId, PositionVO positionVO);
//
// void deletePositionById(Integer positionId);
//
// PositionVO getPositionById(Integer positionId);
//
// List<PositionVO> getPositionsByCompanyId(Integer companyId);
List<UserDepartRelVO> getDepartRefByUserId(Long userId);
void addDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO);
void updateDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO);
void deleteDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO);
List<CompanyDepartUserVO> getUserCompanyDeparts(UserVO user, Integer companyId);
PageVO<CompanyDepartUserVO> getCompanyDepartUserInfoList(UserVO user, Integer companyId, CompanyUserQueryVO companyUserQueryVO);
void importCompanyUserInfo(UserVO user, Integer companyId, ImportCompanyUserVO importCompanyUserVO);
List<DepartmentVO> getDepartsByLesson(Long lessonId);
List<DepartmentVO> getDepartsByExamId(Long examId);
List<Long> getExamIdsByDepartId(Integer departId);
void deleteDepartsExam(Long examId);
void addDepartExam(Long examId, Integer departId);
List<DepartmentLesson> getDepartLessonRefs(Integer departId);
List<LessonVO> getLessonsByDepart(Integer departId);
List<String> getDepartNamesByLesson(Long LessonId);
} }

View File

@ -7,11 +7,15 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.UserConfigVO; import club.joylink.rtss.vo.client.UserConfigVO;
import club.joylink.rtss.vo.client.user.*; import club.joylink.rtss.vo.client.user.*;
import club.joylink.rtss.vo.wx.WmUserSession; import club.joylink.rtss.vo.wx.WmUserSession;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
public interface ISysUserService { public interface ISysUserService {
UserVO queryCompanyUserByAccount(Integer companyId, String account);
/** /**
* 根据openId查询用户 * 根据openId查询用户
* @param openid * @param openid
@ -139,6 +143,11 @@ public interface ISysUserService {
*/ */
UserVO createUserOfWechatMicro(WmUserSession wmUserSession); UserVO createUserOfWechatMicro(WmUserSession wmUserSession);
@Transactional
void batchCreateUser(List<SysUser> newSysUsers);
void createUser(SysUser sysUser);
/** /**
* 更新用户微信小程序openid * 更新用户微信小程序openid
* @param id * @param id
@ -273,7 +282,7 @@ public interface ISysUserService {
*/ */
void userBindWm(String code, Long userId); void userBindWm(String code, Long userId);
void userBindCompany(Long userId, Integer companyId); void userScanCodeBindCompany(Long userId, Integer companyId);
UserVO getUserBaseInfoById(Long id); UserVO getUserBaseInfoById(Long id);
@ -292,8 +301,12 @@ public interface ISysUserService {
void superAdminUpdateUserInfo(UserVO updateUser, UserVO superAdmin); void superAdminUpdateUserInfo(UserVO updateUser, UserVO superAdmin);
void userBindCompany(UserVO userVO, Integer companyId,boolean companyAdmin);
/** /**
* 查询所有的销售人员 * 查询所有的销售人员
*/ */
List<UserVO> querySellers(); List<UserVO> querySellers();
void deleteById(Long id);
} }

View File

@ -24,6 +24,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotEmpty;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
@ -70,10 +71,10 @@ public class LessonService implements ILessonService {
private ITrainingV1Service iTrainingV1Service; private ITrainingV1Service iTrainingV1Service;
@Autowired @Autowired
private StudentRelLessonClassDAO studentRelLessonClassDAO; private IExamService iExamService;
@Autowired @Autowired
private IExamService iExamService; private DepartmentLessonDAO departmentLessonDAO;
@Override @Override
public LessonTreeVO getLessonTree(Long id, UserVO userVO) { public LessonTreeVO getLessonTree(Long id, UserVO userVO) {
@ -211,26 +212,25 @@ public class LessonService implements ILessonService {
newLesson.setId(publishedLesson.getId()); newLesson.setId(publishedLesson.getId());
this.lessonDAO.updateByPrimaryKey(newLesson); this.lessonDAO.updateByPrimaryKey(newLesson);
//课程存在,预备检查与班级的关系 //课程存在,预备检查与班级的关系
StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample(); DepartmentLessonExample departmentLessonExample = new DepartmentLessonExample();
relLessonClassExample.createCriteria().andLessonIdEqualTo(publishedLesson.getId()); departmentLessonExample.createCriteria().andLessonIdEqualTo(publishedLesson.getId());
List<StudentRelLessonClass> studentRelLessonClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample); List<DepartmentLesson> departmentLessonRefs = this.departmentLessonDAO.selectByExample(departmentLessonExample);
if (!CollectionUtils.isEmpty(publishVO.getClassIdList())) { if (!CollectionUtils.isEmpty(publishVO.getClassIdList())) {
//目前GZB项目带班级发布 if (!CollectionUtils.isEmpty(departmentLessonRefs)) {
if (!CollectionUtils.isEmpty(studentRelLessonClasses)) { List<Integer> existedClassIds = departmentLessonRefs.stream().map(DepartmentLesson::getDepartmentId).collect(Collectors.toList());
List<Integer> existedClassIds = studentRelLessonClasses.stream().map(StudentRelLessonClass::getClassId).collect(Collectors.toList());
Collections.sort(existedClassIds); Collections.sort(existedClassIds);
Collections.sort(publishVO.getClassIdList()); Collections.sort(publishVO.getClassIdList());
if (!existedClassIds.equals(publishVO.getClassIdList())) { if (!existedClassIds.equals(publishVO.getClassIdList())) {
//清除现有课程班级关系 //清除现有课程班级关系
this.studentRelLessonClassDAO.deleteByExample(relLessonClassExample); this.departmentLessonDAO.deleteByExample(departmentLessonExample);
addRelLessonClass(publishVO, publishedLesson.getId()); addRelLessonClass(publishVO, publishedLesson.getId());
} }
} else { } else {
addRelLessonClass(publishVO, publishedLesson.getId()); addRelLessonClass(publishVO, publishedLesson.getId());
} }
} else { } else {
if (!CollectionUtils.isEmpty(studentRelLessonClasses)) { if (!CollectionUtils.isEmpty(departmentLessonRefs)) {
this.studentRelLessonClassDAO.deleteByExample(relLessonClassExample); this.departmentLessonDAO.deleteByExample(departmentLessonExample);
} }
} }
// if(!lessonVo.getName().equals(publishedLesson.getName())) { // if(!lessonVo.getName().equals(publishedLesson.getName())) {
@ -533,7 +533,7 @@ public class LessonService implements ILessonService {
} }
@Override @Override
public List<LessonVO> getValidLesson(@NonNull List<Long> ids, String prdType) { public List<LessonVO> getValidLesson(@NotEmpty List<Long> ids, String prdType) {
return lessonDAO.getValidLesson(ids, prdType); return lessonDAO.getValidLesson(ids, prdType);
} }
@ -778,10 +778,10 @@ public class LessonService implements ILessonService {
*/ */
private void addRelLessonClass(LessonPublishVO publishVO, Long id) { private void addRelLessonClass(LessonPublishVO publishVO, Long id) {
publishVO.getClassIdList().forEach(classId -> { publishVO.getClassIdList().forEach(classId -> {
StudentRelLessonClass relLessonClass = new StudentRelLessonClass(); DepartmentLesson departmentLesson = new DepartmentLesson();
relLessonClass.setClassId(classId); departmentLesson.setDepartmentId(classId);
relLessonClass.setLessonId(id); departmentLesson.setLessonId(id);
this.studentRelLessonClassDAO.insert(relLessonClass); this.departmentLessonDAO.insert(departmentLesson);
}); });
} }

View File

@ -2,17 +2,16 @@ package club.joylink.rtss.services;
import club.joylink.rtss.constants.*; import club.joylink.rtss.constants.*;
import club.joylink.rtss.dao.MapSystemDAO; import club.joylink.rtss.dao.MapSystemDAO;
import club.joylink.rtss.entity.DepartmentLesson;
import club.joylink.rtss.entity.MapSystem; import club.joylink.rtss.entity.MapSystem;
import club.joylink.rtss.entity.MapSystemExample; 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.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.student.IClassStudentUserService;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.LessonVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.TreeNode; 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.map.MapVO;
import club.joylink.rtss.vo.client.runplan.RunPlanVO; import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.client.sub.MapSystemDetailVO; import club.joylink.rtss.vo.client.sub.MapSystemDetailVO;
@ -56,7 +55,7 @@ public class MapSystemService implements IMapSystemService {
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@Autowired @Autowired
private IClassStudentUserService iClassStudentUserService; private ICompanyService iCompanyService;
@Override @Override
@Transactional @Transactional
@ -217,13 +216,14 @@ public class MapSystemService implements IMapSystemService {
|| MapSystemType.Exam.name().equals(mapSystem.getType())) { || MapSystemType.Exam.name().equals(mapSystem.getType())) {
List<LessonVO> lessonVOList = new ArrayList<>(); List<LessonVO> lessonVOList = new ArrayList<>();
//用户存在班级关系时根据班级课程关系查询课程目前仅GZB使用 //用户存在部门关系时根据部门课程关系查询课程
List<StudentRelIdClass> studentRelIdClasses = this.iClassStudentUserService.getRelClassByUser(userVO.getId()); if(iCompanyService.isCompanyUser(userVO.getId())){
if(loginInfo.getProject().equals(Project.GZB) && !CollectionUtils.isEmpty(studentRelIdClasses)){ List<UserDepartRelVO> userDepartRelVOS = this.iCompanyService.getDepartRefByUserId(userVO.getId());
Integer classId = studentRelIdClasses.get(0).getClassId();//学生只关联一个班 if(!CollectionUtils.isEmpty(userDepartRelVOS)){
List<StudentRelLessonClass> relLessonsByClass = this.iClassStudentUserService.getRelLessonsByClass(classId); List<DepartmentLesson> departLessonRefs = userDepartRelVOS.stream()
if(!CollectionUtils.isEmpty(relLessonsByClass)){ .flatMap(userDepartRelVO -> this.iCompanyService.getDepartLessonRefs(userDepartRelVO.getDepartmentId()).stream()).collect(Collectors.toList());
lessonVOList = iLessonService.getValidLesson(relLessonsByClass.stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()), mapSystem.getPrdType()); if(!CollectionUtils.isEmpty(departLessonRefs)){
lessonVOList = iLessonService.getValidLesson(departLessonRefs.stream().map(DepartmentLesson::getLessonId).collect(Collectors.toList()), mapSystem.getPrdType());
} }
//默认课程展示 //默认课程展示
MapVO mapVO = iMapService.findMapBaseInfoById(mapSystem.getMapId()); MapVO mapVO = iMapService.findMapBaseInfoById(mapSystem.getMapId());
@ -237,16 +237,18 @@ public class MapSystemService implements IMapSystemService {
} }
} }
} }
}else{ }
}
else{
lessonVOList = iLessonService.getByMapIdAndPrdType(mapSystem.getMapId(), mapSystem.getPrdType()); lessonVOList = iLessonService.getByMapIdAndPrdType(mapSystem.getMapId(), mapSystem.getPrdType());
} }
if (CollectionUtils.isEmpty(lessonVOList)) { if (CollectionUtils.isEmpty(lessonVOList)) {
return null; return mapSystemDetailVO;
} }
//查询课程关联的班级列表 //查询课程关联的班级列表
lessonVOList.forEach(lessonVO -> { lessonVOList.forEach(lessonVO -> {
List<String> classNames = this.iClassStudentUserService.getRelclassByLessonId(lessonVO.getId()); List<String> classNames = this.iCompanyService.getDepartNamesByLesson(lessonVO.getId());
if(!CollectionUtils.isEmpty(classNames)){ if(!CollectionUtils.isEmpty(classNames)){
lessonVO.setClassNames(classNames); lessonVO.setClassNames(classNames);
} }

View File

@ -84,7 +84,11 @@ public class SysUserService implements ISysUserService {
private CompanyDAO companyDAO; private CompanyDAO companyDAO;
@Autowired @Autowired
private ICompanyService iCompanyService; private CompanyUserDAO companyUserDAO;
@Autowired
private DepartmentUserDAO departmentUserDAO;
@Override @Override
public UserVO findUserByAccountAndPassword(String account, String password) { public UserVO findUserByAccountAndPassword(String account, String password) {
@ -94,7 +98,9 @@ public class SysUserService implements ISysUserService {
example.or().andEmailEqualTo(account).andPasswordEqualTo(password); // 邮箱 example.or().andEmailEqualTo(account).andPasswordEqualTo(password); // 邮箱
List<SysUser> users = this.sysUserDAO.selectByExample(example); List<SysUser> users = this.sysUserDAO.selectByExample(example);
if(!CollectionUtils.isEmpty(users)) { if(!CollectionUtils.isEmpty(users)) {
return new UserVO(users.get(0)); UserVO userVO = sysUserDAO.queryUserWithCompany(users.get(0).getId());
userVO.setRolesByString();
return userVO;
} }
return null; return null;
} }
@ -109,6 +115,12 @@ public class SysUserService implements ISysUserService {
return UserVO.convertFromDB(list); return UserVO.convertFromDB(list);
} }
@Override
public UserVO queryCompanyUserByAccount(Integer companyId, String account) {
return this.sysUserDAO.queryCompanyUserByAccount(account, companyId);
}
@Override @Override
public UserVO getUserByWxOpenId(String openid) { public UserVO getUserByWxOpenId(String openid) {
SysUserExample example = new SysUserExample(); SysUserExample example = new SysUserExample();
@ -217,7 +229,7 @@ public class SysUserService implements ISysUserService {
@Override @Override
public PageVO<UserVO> queryPagedUser(UserQueryVO queryVO) { public PageVO<UserVO> queryPagedUser(UserQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<UserVO> page = (Page<UserVO>) sysUserDAO.pagedQueryWithCompany(queryVO); Page<UserVO> page = (Page<UserVO>) sysUserDAO.queryUsersWithCompany(queryVO);
page.getResult().forEach(UserVO::forClient); page.getResult().forEach(UserVO::forClient);
return PageVO.convert(page); return PageVO.convert(page);
// SysUserExample example = new SysUserExample(); // SysUserExample example = new SysUserExample();
@ -334,24 +346,26 @@ public class SysUserService implements ISysUserService {
@Override @Override
@Transactional @Transactional
public void userBindCompany(Long userId, Integer companyId) { public void userScanCodeBindCompany(Long userId, Integer companyId) {
iCompanyService.userBindCompany(userId, 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 @Override
public UserVO getUserBaseInfoById(Long id) { public UserVO getUserBaseInfoById(Long id) {
SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(id); UserVO userVO = this.sysUserDAO.queryUserWithCompany(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sysUser, "不存在的用户"); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(userVO, "不存在的用户");
UserVO userVO = new UserVO(); userVO.setRolesByString();
userVO.setId(sysUser.getId()); userVO.setWmOpenId(null);
userVO.setAccount(sysUser.getAccount()); userVO.setWxId(null);
userVO.setName(sysUser.getName()); userVO.setWxUnionId(null);
userVO.setNickname(sysUser.getNickname()); userVO.setNationcode(null);
userVO.setAvatarPath(sysUser.getAvatarPath()); userVO.setPassword(null);
userVO.setRolesByString(sysUser.getRoles());
userVO.setEmail(sysUser.getEmail());
userVO.setStatus(sysUser.getStatus());
userVO.setCreateTime(sysUser.getCreateTime());
return userVO; return userVO;
} }
@ -407,7 +421,9 @@ public class SysUserService implements ISysUserService {
if(CollectionUtils.isEmpty(list)) { if(CollectionUtils.isEmpty(list)) {
return null; return null;
} }
return new UserVO(list.get(0)); UserVO userVO = sysUserDAO.queryUserWithCompany(list.get(0).getId());
userVO.setRolesByString();
return userVO;
} }
@Override @Override
@ -417,7 +433,9 @@ public class SysUserService implements ISysUserService {
example.createCriteria().andWmOpenIdEqualTo(wmOpenId); example.createCriteria().andWmOpenIdEqualTo(wmOpenId);
List<SysUser> userList = this.sysUserDAO.selectByExample(example); List<SysUser> userList = this.sysUserDAO.selectByExample(example);
if(!CollectionUtils.isEmpty(userList)) { if(!CollectionUtils.isEmpty(userList)) {
return new UserVO(userList.get(0)); UserVO userVO = sysUserDAO.queryUserWithCompany(userList.get(0).getId());
userVO.setRolesByString();
return userVO;
} }
return null; return null;
} }
@ -451,6 +469,17 @@ public class SysUserService implements ISysUserService {
return new UserVO(user); return new UserVO(user);
} }
@Override
@Transactional
public void batchCreateUser(List<SysUser> newSysUsers) {
this.sysUserDAO.batchInsert(newSysUsers);
}
@Override
public void createUser(SysUser newSysUser) {
this.sysUserDAO.insert(newSysUser);
}
private String generateNickname() { private String generateNickname() {
return String.format("用户_%s", RandomGenerator.getByLen(5)); 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<SysUser> list = this.sysUserDAO.selectByExample(example);
if(!CollectionUtils.isEmpty(list)) {
SysUser user = list.get(0);
}
return null;
}
@Override @Override
public void wxSubscribeEventHandle(String wxId) { public void wxSubscribeEventHandle(String wxId) {
@ -548,7 +563,9 @@ public class SysUserService implements ISysUserService {
user.setName(name); user.setName(name);
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); 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.setNickname(nickname);
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); 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.setAvatarPath(avatarPath);
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); 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.setMobile(updateMobileVO.getMobile());
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); 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.setEmail(updateEmailVO.getEmail());
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); 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); SysUser user = getEntity(userId);
if(!user.getRoles().equals(updateUserVO.getRolesStr())) { if(!user.getRoles().equals(updateUserVO.getRolesStr())) {
user.setRoles(updateUserVO.getRolesStr()); user.setRoles(updateUserVO.getRolesStr());
user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); this.sysUserDAO.updateByPrimaryKey(user);
} }
//更新所属公司 //更新所属公司
if (updateUserVO.getCompanyId() != null) { Integer companyId = updateUserVO.getCompanyId();
iCompanyService.superAdminUpdateUserCompanyRel(userId, updateUserVO.getCompanyId(), superAdmin); UserVO userVO = new UserVO(user);
} else { userBindCompany(userVO, companyId,false);
iCompanyService.deleteUserCompanyRel(userId); 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<CompanyUser> 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 {
companyUserDAO.deleteByExample(e);
DepartmentUserExample ue =new DepartmentUserExample();
ue.createCriteria().andUserIdEqualTo(userVO.getId());
departmentUserDAO.deleteByExample(ue);
userVO.setCompanyAdmin(null);
}
} }
@Override @Override
@ -756,4 +822,9 @@ public class SysUserService implements ISysUserService {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(user, String.format("id为[%s]的用户不存在", id)); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(user, String.format("id为[%s]的用户不存在", id));
return user; return user;
} }
@Override
public void deleteById(Long id) {
sysUserDAO.deleteByPrimaryKey(id);
}
} }

View File

@ -6,7 +6,6 @@ import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.*; import club.joylink.rtss.services.*;
import club.joylink.rtss.vo.UserVO; 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.goods.GoodsVO;
import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.order.OrderCreateVO; import club.joylink.rtss.vo.client.order.OrderCreateVO;
@ -34,7 +33,7 @@ import java.util.stream.Collectors;
*/ */
@Slf4j @Slf4j
@Service @Service
public class ClassStudentUserServiceImpl implements IClassStudentUserService { public class DepartUserStaticServiceImpl implements IDepartUserStatisticService {
@Autowired @Autowired
private SysUserDAO sysUserDAO; private SysUserDAO sysUserDAO;
@ -89,7 +88,10 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
@Autowired @Autowired
private IOrderService iOrderService; private IOrderService iOrderService;
@Autowired
private DepartmentUserDAO departmentUserDAO;
//TODO 迁移学生权限分发
@Override @Override
@Transactional @Transactional
public void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator) { public void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator) {
@ -168,70 +170,70 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
distributePermissions2ZJ(good.getId(), userIds, usersWithPermissions); distributePermissions2ZJ(good.getId(), userIds, usersWithPermissions);
} }
@Override // @Override
public List<StudentClassVO> getClassesByProjectCode(String projectCode) { // public List<StudentClassVO> getClassesByProjectCode(String projectCode) {
StudentClassExample classExample = new StudentClassExample(); // StudentClassExample classExample = new StudentClassExample();
classExample.createCriteria().andProjectCodeEqualTo(projectCode); // classExample.createCriteria().andProjectCodeEqualTo(projectCode);
List<StudentClass> studentClasses = this.studentClassDAO.selectByExample(classExample); // List<StudentClass> studentClasses = this.studentClassDAO.selectByExample(classExample);
return StudentClassVO.convertFromDBList(studentClasses); // return StudentClassVO.convertFromDBList(studentClasses);
} // }
@Override // @Override
public List<StudentClassVO> getClassesByLesson(Long lessonId) { // public List<StudentClassVO> getClassesByLesson(Long lessonId) {
List<StudentClass> classes = this.studentClassDAO.getClasses(lessonId); // List<StudentClass> classes = this.studentClassDAO.getClasses(lessonId);
return StudentClassVO.convertFromDBList(classes); // return StudentClassVO.convertFromDBList(classes);
} // }
@Override // @Override
public List<StudentClassVO> getClassesByExamId(Long examId) { // public List<StudentClassVO> getClassesByExamId(Long examId) {
StudentRelExamClassExample example = new StudentRelExamClassExample(); // StudentRelExamClassExample example = new StudentRelExamClassExample();
example.createCriteria().andExamIdEqualTo(examId); // example.createCriteria().andExamIdEqualTo(examId);
List<StudentClass> classes = this.studentClassDAO.getClassesByExamId(examId); // List<StudentClass> classes = this.studentClassDAO.getClassesByExamId(examId);
return StudentClassVO.convertFromDBList(classes); // return StudentClassVO.convertFromDBList(classes);
} // }
@Override // @Override
public List<StudentRelLessonClass> getRelLessonsByClass(Integer classId) { // public List<StudentRelLessonClass> getRelLessonsByClass(Integer classId) {
StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample(); // StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample();
relLessonClassExample.createCriteria().andClassIdEqualTo(classId); // relLessonClassExample.createCriteria().andClassIdEqualTo(classId);
List<StudentRelLessonClass> studentClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample); // List<StudentRelLessonClass> studentClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample);
return studentClasses; // return studentClasses;
} // }
@Override // @Override
public List<String> getRelclassByLessonId(Long LessonId) { // public List<String> getRelclassByLessonId(Long LessonId) {
List<String> classes = this.studentRelLessonClassDAO.getClassNames(LessonId); // List<String> classes = this.studentRelLessonClassDAO.getClassNames(LessonId);
return classes; // return classes;
} // }
@Override // @Override
public List<Long> getRelExamIdsByClassId(Integer classId) { // public List<Long> getRelExamIdsByClassId(Integer classId) {
StudentRelExamClassExample example = new StudentRelExamClassExample(); // StudentRelExamClassExample example = new StudentRelExamClassExample();
example.createCriteria().andClassIdEqualTo(classId); // example.createCriteria().andClassIdEqualTo(classId);
List<StudentRelExamClass> classes = this.studentRelExamClassDAO.selectByExample(example); // List<StudentRelExamClass> classes = this.studentRelExamClassDAO.selectByExample(example);
return classes.stream().map(StudentRelExamClass::getExamId).collect(Collectors.toList()); // return classes.stream().map(StudentRelExamClass::getExamId).collect(Collectors.toList());
} // }
//
// @Override
// public List<LessonVO> getLessonByClass(Integer classId) {
// List<Long> lessonIds = getRelLessonsByClass(classId).stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList());
// return lessonService.getValidLesson(lessonIds, null);
// }
@Override // @Override
public List<LessonVO> getLessonByClass(Integer classId) { // public List<StudentRelIdClass> getRelClassByUser(Long userId) {
List<Long> lessonIds = getRelLessonsByClass(classId).stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()); // StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample();
return lessonService.getValidLesson(lessonIds, null); // relIdClassExample.createCriteria().andStudentUserIdEqualTo(userId);
} // List<StudentRelIdClass> studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample);
// return studentRelIdClasses;
@Override // }
public List<StudentRelIdClass> getRelClassByUser(Long userId) {
StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample();
relIdClassExample.createCriteria().andStudentUserIdEqualTo(userId);
List<StudentRelIdClass> studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample);
return studentRelIdClasses;
}
@Override @Override
public List<ExportStudentInfo> studentInfoStatistics(StudentInfoExportParam infoExportParam) { public List<ExportStudentInfo> studentInfoStatistics(StudentInfoExportParam infoExportParam) {
//根据班级id查询对应学生信息 //根据班级id查询对应学生信息
StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample(); DepartmentUserExample departmentUserExample = new DepartmentUserExample();
relIdClassExample.createCriteria().andClassIdEqualTo(infoExportParam.getClassId()); departmentUserExample.createCriteria().andDepartmentIdEqualTo(infoExportParam.getClassId());
List<StudentRelIdClass> studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample); List<DepartmentUser> departmentUsers = this.departmentUserDAO.selectByExample(departmentUserExample);
//课程关联实训数 //课程关联实训数
Map<String, Long> prd2TrainNums = infoExportParam.getPrdParams().stream().collect(Collectors.toMap(prdParam -> prdParam.getPrdType(), prdParam -> { Map<String, Long> prd2TrainNums = infoExportParam.getPrdParams().stream().collect(Collectors.toMap(prdParam -> prdParam.getPrdType(), prdParam -> {
LsRelChapterTrainingExample lsRelChapterTrainingExample = new LsRelChapterTrainingExample(); LsRelChapterTrainingExample lsRelChapterTrainingExample = new LsRelChapterTrainingExample();
@ -243,27 +245,27 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
this.examDefinitionDAO.selectByPrimaryKey(prdParam.getExamPaperId()).getFullPoint() this.examDefinitionDAO.selectByPrimaryKey(prdParam.getExamPaperId()).getFullPoint()
)); ));
//根据本学期日期始末针对每个学生查询 出勤天数根据课程id查询测验模式通过个数根据考试id查询成绩 //根据本学期日期始末针对每个学生查询 出勤天数根据课程id查询测验模式通过个数根据考试id查询成绩
return studentRelIdClasses.stream().map(studentRelIdClass -> { return departmentUsers.stream().map(departmentUser -> {
ExportStudentInfo exportStudentInfo = new ExportStudentInfo(); ExportStudentInfo exportStudentInfo = new ExportStudentInfo();
SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(studentRelIdClass.getStudentUserId()); SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(departmentUser.getUserId());
exportStudentInfo.setName(sysUser.getName()); exportStudentInfo.setName(sysUser.getName());
exportStudentInfo.setStudentID(sysUser.getAccount()); 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); exportStudentInfo.setAttendance((float) Math.round((Objects.isNull(days) ? 0 : (days > infoExportParam.getAttendanceDays() ? infoExportParam.getAttendanceDays() : days)) * 100 / infoExportParam.getAttendanceDays()) / 100);
infoExportParam.getPrdParams().forEach(prdParam -> { infoExportParam.getPrdParams().forEach(prdParam -> {
PrdStudentScoretInfo prdStudentScoretInfo = new PrdStudentScoretInfo(); PrdStudentScoretInfo prdStudentScoretInfo = new PrdStudentScoretInfo();
prdStudentScoretInfo.setPrdType(prdParam.getPrdType()); 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) { if (prd2TrainNums.get(prdParam.getPrdType()) != 0) {
prdStudentScoretInfo.setLessonPassRate((float) Math.round((Objects.isNull(passedNum) ? 0 : passedNum) * 100 / prd2TrainNums.get(prdParam.getPrdType())) / 100); 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); prdStudentScoretInfo.setExamSocreRadio((float) Math.round((Objects.isNull(maxScore) ? 0 : maxScore) * 100 / prd2Fullpoint.get(prdParam.getPrdType())) / 100);
exportStudentInfo.getScores().add(prdStudentScoretInfo); exportStudentInfo.getScores().add(prdStudentScoretInfo);
@ -272,20 +274,20 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@Override // @Override
public void addExamRelClass(Long examId, Integer classId) { // public void addExamRelClass(Long examId, Integer classId) {
StudentRelExamClass studentRelExamClass = new StudentRelExamClass(); // StudentRelExamClass studentRelExamClass = new StudentRelExamClass();
studentRelExamClass.setExamId(examId); // studentRelExamClass.setExamId(examId);
studentRelExamClass.setClassId(classId); // studentRelExamClass.setClassId(classId);
studentRelExamClassDAO.insert(studentRelExamClass); // studentRelExamClassDAO.insert(studentRelExamClass);
} // }
@Override // @Override
public void deleteExamRelClass(Long examId) { // public void deleteExamRelClass(Long examId) {
StudentRelExamClassExample example = new StudentRelExamClassExample(); // StudentRelExamClassExample example = new StudentRelExamClassExample();
example.createCriteria().andExamIdEqualTo(examId); // example.createCriteria().andExamIdEqualTo(examId);
studentRelExamClassDAO.deleteByExample(example); // studentRelExamClassDAO.deleteByExample(example);
} // }
/** /**
* 创建权限分发给赵杰再从赵杰的权限创建权限分发给学生领取 * 创建权限分发给赵杰再从赵杰的权限创建权限分发给学生领取

View File

@ -11,10 +11,8 @@ import club.joylink.rtss.vo.client.student.StudentInfoExportParam;
import java.util.List; import java.util.List;
/**
* 班级学生用户接口 public interface IDepartUserStatisticService {
*/
public interface IClassStudentUserService {
/** /**
* 导入学生用户及班级信息 * 导入学生用户及班级信息
@ -24,36 +22,36 @@ public interface IClassStudentUserService {
*/ */
void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator); void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator);
/** // /**
* 根据项目查询班级 // * 根据项目查询班级
* @param projectCode // * @param projectCode
* @return // * @return
*/ // */
List<StudentClassVO> getClassesByProjectCode(String projectCode); // List<StudentClassVO> getClassesByProjectCode(String projectCode);
List<StudentClassVO> getClassesByLesson(Long lessonId); // List<StudentClassVO> getClassesByLesson(Long lessonId);
List<StudentClassVO> getClassesByExamId(Long examId); // List<StudentClassVO> getClassesByExamId(Long examId);
/**根据班级查询课程关系*/ // /**根据班级查询课程关系*/
List<StudentRelLessonClass> getRelLessonsByClass(Integer classId); // List<StudentRelLessonClass> getRelLessonsByClass(Integer classId);
/**根据课程查询关联的班级名字列表*/ /**根据课程查询关联的班级名字列表*/
List<String> getRelclassByLessonId(Long LessonId); // List<String> getRelclassByLessonId(Long LessonId);
List<Long> getRelExamIdsByClassId(Integer classId); // List<Long> getRelExamIdsByClassId(Integer classId);
List<LessonVO> getLessonByClass(Integer classId); // List<LessonVO> getLessonByClass(Integer classId);
/**根据用户id查询关联的班级关系*/ /**根据用户id查询关联的班级关系*/
List<StudentRelIdClass> getRelClassByUser(Long userId); // List<StudentRelIdClass> getRelClassByUser(Long userId);
/**统计学生成绩信息*/ /**统计学生成绩信息*/
List<ExportStudentInfo> studentInfoStatistics(StudentInfoExportParam infoExportParam); List<ExportStudentInfo> studentInfoStatistics(StudentInfoExportParam infoExportParam);
void addExamRelClass(Long examId, Integer classId); // void addExamRelClass(Long examId, Integer classId);
void deleteExamRelClass(Long examId); // void deleteExamRelClass(Long examId);
/**关联课程及班级信息*/ /**关联课程及班级信息*/
} }

View File

@ -83,6 +83,7 @@ public class UserVO implements Serializable {
/** /**
* 数据库的roles字段 * 数据库的roles字段
*/ */
@JsonIgnore
private String dbRoles; private String dbRoles;
/** /**
@ -105,10 +106,14 @@ public class UserVO implements Serializable {
*/ */
private LocalDateTime createTime; private LocalDateTime createTime;
//单位信息
private Integer companyId; private Integer companyId;
private String companyName; private String companyName;
private Boolean companyAdmin;
public UserVO() {} public UserVO() {}
public UserVO(SysUser sysUser) { 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 @Override
public String toString() { public String toString() {
return "UserVO [id=" + id + ", name=" + name + ", nickname=" + nickname + ", mobile=" + mobile + ", email=" + email +", nationcode=" return "UserVO [id=" + id + ", name=" + name + ", nickname=" + nickname + ", mobile=" + mobile + ", email=" + email +", nationcode="
@ -223,6 +236,7 @@ public class UserVO implements Serializable {
* 是否管理员 * 是否管理员
* @return * @return
*/ */
@JsonIgnore
public boolean isAdmin() { public boolean isAdmin() {
return !CollectionUtils.isEmpty(this.roles) return !CollectionUtils.isEmpty(this.roles)
&& (this.roles.contains(BusinessConsts.ROLE_04) || this.roles.contains(BusinessConsts.ROLE_05)); && (this.roles.contains(BusinessConsts.ROLE_04) || this.roles.contains(BusinessConsts.ROLE_05));
@ -232,6 +246,7 @@ public class UserVO implements Serializable {
* 是否超级管理员 * 是否超级管理员
* @return * @return
*/ */
@JsonIgnore
public boolean isSuperAdmin() { public boolean isSuperAdmin() {
return !CollectionUtils.isEmpty(this.roles) return !CollectionUtils.isEmpty(this.roles)
&& (this.roles.contains(BusinessConsts.ROLE_05)); && (this.roles.contains(BusinessConsts.ROLE_05));

View File

@ -1,13 +1,13 @@
package club.joylink.rtss.vo.client; 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.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 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 io.swagger.annotations.ApiModel;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -121,7 +121,7 @@ public class ExamDefinitionVO {
private Boolean trial; private Boolean trial;
/**关联班级列表*/ /**关联班级列表*/
private List<StudentClassVO> classes; private List<DepartmentVO> classes;
@Valid @Valid
@NotNull(message = "考试规则不能为空", groups = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class}) @NotNull(message = "考试规则不能为空", groups = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class})

View File

@ -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;
}

View File

@ -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.Getter;
import lombok.Setter; import lombok.Setter;
@ -10,4 +11,5 @@ public class CompanyQueryVO extends PageQueryVO {
private String name; private String name;
} }

View File

@ -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;
}

View File

@ -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<SysUser> convert2DBList(List<CompanyUserVO> companyUserVOS){
return companyUserVOS.stream().map(CompanyUserVO::convert2DB).collect(Collectors.toList());
}
}

View File

@ -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.entity.Company;
import club.joylink.rtss.vo.UserVO;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter; import lombok.Getter;
@ -31,8 +30,6 @@ public class CompanyVO {
/**联系方式*/ /**联系方式*/
private String phone = ""; private String phone = "";
private List<UserVO> managers;
public CompanyVO(Company entity) { public CompanyVO(Company entity) {
this.id = entity.getId(); this.id = entity.getId();
this.name = entity.getName(); this.name = entity.getName();
@ -48,12 +45,6 @@ public class CompanyVO {
return voList; return voList;
} }
public static CompanyVO convertFromDB(Company company, List<UserVO> managers) {
CompanyVO vo = new CompanyVO(company);
vo.setManagers(managers);
return vo;
}
public Company toDB() { public Company toDB() {
Company entity = new Company(); Company entity = new Company();
entity.setId(this.id); entity.setId(this.id);
@ -63,4 +54,6 @@ public class CompanyVO {
entity.setCreateTime(LocalDateTime.now()); entity.setCreateTime(LocalDateTime.now());
return entity; return entity;
} }
} }

View File

@ -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<DepartmentVO> 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<DepartmentVO> convert2VOList(List<CompanyDepartment> dataList) {
List<DepartmentVO> 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<DepartmentVO> buildDeptTree(List<DepartmentVO> voList) {
List<DepartmentVO> 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<DepartmentVO> getChildDept(Integer parentId, List<DepartmentVO> list) {
List<DepartmentVO> 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<DepartmentVO> getChildDeptList(Integer parentId, List<DepartmentVO> list) {
List<DepartmentVO> 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;
}
}

View File

@ -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<CompanyUserVO> companyUsers;
}

View File

@ -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<PositionVO> convert2VOList(List<CompanyPosition> dataList) {
List<PositionVO> 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;
}
}

View File

@ -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<UserDepartRelVO> convert2VOList(List<DepartmentUser> departmentUsers){
if(CollectionUtils.isEmpty(departmentUsers)){
return new ArrayList<>();
}
return departmentUsers.stream().map(UserDepartRelVO::new).collect(Collectors.toList());
}
}

View File

@ -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;
}

View File

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.CompanyDepartmentDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.CompanyDepartment">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="company_id" jdbcType="INTEGER" property="companyId" />
<result column="parent_id" jdbcType="INTEGER" property="parentId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, company_id, parent_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyDepartmentExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from company_department
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from company_department
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from company_department
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompanyDepartmentExample">
delete from company_department
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CompanyDepartment" useGeneratedKeys="true">
insert into company_department (`name`, company_id, parent_id
)
values (#{name,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CompanyDepartment" useGeneratedKeys="true">
insert into company_department
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
`name`,
</if>
<if test="companyId != null">
company_id,
</if>
<if test="parentId != null">
parent_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
<if test="parentId != null">
#{parentId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompanyDepartmentExample" resultType="java.lang.Long">
select count(*) from company_department
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update company_department
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=INTEGER},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
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}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.CompanyDepartment">
update company_department
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
company_id = #{companyId,jdbcType=INTEGER},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.CompanyDepartment">
update company_department
set `name` = #{name,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=INTEGER},
parent_id = #{parentId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.CompanyPositionDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.CompanyPosition">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="company_id" jdbcType="INTEGER" property="companyId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, company_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyPositionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from company_position
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from company_position
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from company_position
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompanyPositionExample">
delete from company_position
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CompanyPosition" useGeneratedKeys="true">
insert into company_position (`name`, company_id)
values (#{name,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CompanyPosition" useGeneratedKeys="true">
insert into company_position
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
`name`,
</if>
<if test="companyId != null">
company_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompanyPositionExample" resultType="java.lang.Long">
select count(*) from company_position
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update company_position
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update company_position
set id = #{record.id,jdbcType=INTEGER},
`name` = #{record.name,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.CompanyPosition">
update company_position
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
company_id = #{companyId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.CompanyPosition">
update company_position
set `name` = #{name,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.CompanyUserDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.CompanyUser">
<result column="company_id" jdbcType="INTEGER" property="companyId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="admin" jdbcType="BIT" property="admin" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
company_id, user_id, `admin`
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyUserExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from company_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompanyUserExample">
delete from company_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.CompanyUser">
insert into company_user (company_id, user_id, `admin`
)
values (#{companyId,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT}, #{admin,jdbcType=BIT}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.CompanyUser">
insert into company_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyId != null">
company_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="admin != null">
`admin`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="admin != null">
#{admin,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompanyUserExample" resultType="java.lang.Long">
select count(*) from company_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update company_user
<set>
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=INTEGER},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.admin != null">
`admin` = #{record.admin,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update company_user
set company_id = #{record.companyId,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=BIGINT},
`admin` = #{record.admin,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.DepartmentExamDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.DepartmentExam">
<result column="exam_id" jdbcType="BIGINT" property="examId" />
<result column="department_id" jdbcType="INTEGER" property="departmentId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
exam_id, department_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.DepartmentExamExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from department_exam
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DepartmentExamExample">
delete from department_exam
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.DepartmentExam">
insert into department_exam (exam_id, department_id)
values (#{examId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.DepartmentExam">
insert into department_exam
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="examId != null">
exam_id,
</if>
<if test="departmentId != null">
department_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="examId != null">
#{examId,jdbcType=BIGINT},
</if>
<if test="departmentId != null">
#{departmentId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.DepartmentExamExample" resultType="java.lang.Long">
select count(*) from department_exam
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update department_exam
<set>
<if test="record.examId != null">
exam_id = #{record.examId,jdbcType=BIGINT},
</if>
<if test="record.departmentId != null">
department_id = #{record.departmentId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update department_exam
set exam_id = #{record.examId,jdbcType=BIGINT},
department_id = #{record.departmentId,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.DepartmentLessonDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.DepartmentLesson">
<result column="lesson_id" jdbcType="BIGINT" property="lessonId" />
<result column="department_id" jdbcType="INTEGER" property="departmentId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
lesson_id, department_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.DepartmentLessonExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from department_lesson
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DepartmentLessonExample">
delete from department_lesson
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.DepartmentLesson">
insert into department_lesson (lesson_id, department_id)
values (#{lessonId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.DepartmentLesson">
insert into department_lesson
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="lessonId != null">
lesson_id,
</if>
<if test="departmentId != null">
department_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="lessonId != null">
#{lessonId,jdbcType=BIGINT},
</if>
<if test="departmentId != null">
#{departmentId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.DepartmentLessonExample" resultType="java.lang.Long">
select count(*) from department_lesson
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update department_lesson
<set>
<if test="record.lessonId != null">
lesson_id = #{record.lessonId,jdbcType=BIGINT},
</if>
<if test="record.departmentId != null">
department_id = #{record.departmentId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update department_lesson
set lesson_id = #{record.lessonId,jdbcType=BIGINT},
department_id = #{record.departmentId,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.UserCompanyRelDAO"> <mapper namespace="club.joylink.rtss.dao.DepartmentUserDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.UserCompanyRel"> <resultMap id="BaseResultMap" type="club.joylink.rtss.entity.DepartmentUser">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" /> <result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="company_id" jdbcType="INTEGER" property="companyId" /> <result column="department_id" jdbcType="INTEGER" property="departmentId" />
<result column="position_id" jdbcType="INTEGER" property="positionId" />
<result column="manager" jdbcType="BIT" property="manager" /> <result column="manager" jdbcType="BIT" property="manager" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
@ -68,15 +69,15 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, user_id, company_id, manager, create_time, update_time id, user_id, department_id, position_id, manager, create_time, update_time
</sql> </sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.UserCompanyRelExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="club.joylink.rtss.entity.DepartmentUserExample" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from user_company_rel from department_user
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
@ -95,33 +96,38 @@
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from user_company_rel from department_user
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from user_company_rel delete from department_user
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</delete> </delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.UserCompanyRelExample"> <delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DepartmentUserExample">
delete from user_company_rel delete from department_user
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.UserCompanyRel" useGeneratedKeys="true"> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DepartmentUser" useGeneratedKeys="true">
insert into user_company_rel (user_id, company_id, manager, insert into department_user (user_id, department_id, position_id,
create_time, update_time) manager, create_time, update_time
values (#{userId,jdbcType=BIGINT}, #{companyId,jdbcType=INTEGER}, #{manager,jdbcType=BIT}, )
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) values (#{userId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER}, #{positionId,jdbcType=INTEGER},
#{manager,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.UserCompanyRel" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DepartmentUser" useGeneratedKeys="true">
insert into user_company_rel insert into department_user
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null"> <if test="userId != null">
user_id, user_id,
</if> </if>
<if test="companyId != null"> <if test="departmentId != null">
company_id, department_id,
</if>
<if test="positionId != null">
position_id,
</if> </if>
<if test="manager != null"> <if test="manager != null">
manager, manager,
@ -137,8 +143,11 @@
<if test="userId != null"> <if test="userId != null">
#{userId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT},
</if> </if>
<if test="companyId != null"> <if test="departmentId != null">
#{companyId,jdbcType=INTEGER}, #{departmentId,jdbcType=INTEGER},
</if>
<if test="positionId != null">
#{positionId,jdbcType=INTEGER},
</if> </if>
<if test="manager != null"> <if test="manager != null">
#{manager,jdbcType=BIT}, #{manager,jdbcType=BIT},
@ -151,14 +160,14 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.UserCompanyRelExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="club.joylink.rtss.entity.DepartmentUserExample" resultType="java.lang.Long">
select count(*) from user_company_rel select count(*) from department_user
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update user_company_rel update department_user
<set> <set>
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=BIGINT}, id = #{record.id,jdbcType=BIGINT},
@ -166,8 +175,11 @@
<if test="record.userId != null"> <if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT}, user_id = #{record.userId,jdbcType=BIGINT},
</if> </if>
<if test="record.companyId != null"> <if test="record.departmentId != null">
company_id = #{record.companyId,jdbcType=INTEGER}, department_id = #{record.departmentId,jdbcType=INTEGER},
</if>
<if test="record.positionId != null">
position_id = #{record.positionId,jdbcType=INTEGER},
</if> </if>
<if test="record.manager != null"> <if test="record.manager != null">
manager = #{record.manager,jdbcType=BIT}, manager = #{record.manager,jdbcType=BIT},
@ -184,10 +196,11 @@
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update user_company_rel update department_user
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,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}, manager = #{record.manager,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP} update_time = #{record.updateTime,jdbcType=TIMESTAMP}
@ -195,14 +208,17 @@
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.UserCompanyRel"> <update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.DepartmentUser">
update user_company_rel update department_user
<set> <set>
<if test="userId != null"> <if test="userId != null">
user_id = #{userId,jdbcType=BIGINT}, user_id = #{userId,jdbcType=BIGINT},
</if> </if>
<if test="companyId != null"> <if test="departmentId != null">
company_id = #{companyId,jdbcType=INTEGER}, department_id = #{departmentId,jdbcType=INTEGER},
</if>
<if test="positionId != null">
position_id = #{positionId,jdbcType=INTEGER},
</if> </if>
<if test="manager != null"> <if test="manager != null">
manager = #{manager,jdbcType=BIT}, manager = #{manager,jdbcType=BIT},
@ -216,24 +232,67 @@
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.UserCompanyRel"> <update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.DepartmentUser">
update user_company_rel update department_user
set user_id = #{userId,jdbcType=BIGINT}, 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}, manager = #{manager,jdbcType=BIT},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<!-- 额外添加 -->
<update id="batchUpdate" parameterType="list">
update user_company_rel set <!-- <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="list" useGeneratedKeys="true">
<foreach collection="ucrList" item="record" open="(" separator="," close=")"> insert into department_user (user_id, department_id,
user_id = #{record.userId,jdbcType=BIGINT}, position_id, manager,
company_id = #{record.companyId,jdbcType=INTEGER}, create_time, update_time)
manager = #{record.manager,jdbcType=BIT}, values
create_time = #{record.createTime,jdbcType=TIMESTAMP}, <foreach collection="list" item="item" separator=",">
update_time = #{record.updateTime,jdbcType=TIMESTAMP} (#{item.userId,jdbcType=BIGINT}, #{item.departmentId,jdbcType=INTEGER},
#{item.positionId,jdbcType=INTEGER}, #{item.manager,jdbcType=BIT})
</foreach> </foreach>
</update> </insert>-->
<resultMap id="CompanyUserInfo" type="club.joylink.rtss.vo.client.company.CompanyDepartUserVO">
<!-- <id column="id" jdbcType="BIGINT" property="id"/>-->
<result column="companyId" jdbcType="INTEGER" property="companyId"/>
<result column="companyName" jdbcType="VARCHAR" property="companyName"/>
<result column="departmentId" jdbcType="INTEGER" property="departmentId"/>
<result column="departmentName" jdbcType="VARCHAR" property="departmentName"/>
<result column="manager" jdbcType="BIT" property="manager"/>
<result column="userId" jdbcType="BIGINT" property="userId"/>
<result column="account" jdbcType="VARCHAR" property="account"/>
<result column="userName" jdbcType="VARCHAR" property="name"/>
</resultMap>
<select id="getCompanyDepartUsers" parameterType="club.joylink.rtss.vo.client.company.CompanyUserQueryVO" resultMap ="CompanyUserInfo">
select
ucr.user_id as userId, account, su.`name` as userName, nickname, mobile,
c.id as companyId, c.`name` as companyName,
cd.id as departmentId, cd.`name` as departmentName,
ucr.manager as manager
from department_user ucr join sys_user su on su.id = ucr.user_id and ucr.manager = false
left join company_department cd on cd.id = ucr.department_id
left join company c on cd.company_id = c.id
<where>
<if test="name != null and name != ''">
and su.`name` like concat('%', #{name}, '%')
</if>
<if test="account != null and account != ''">
and su.`account` = #{account}
</if>
<if test="departmentId != null and departmentId != ''">
and cd.id = #{departmentId}
</if>
</where>
</select>
<select id="getUserCompanyDeparts" resultMap="CompanyUserInfo">
SELECT du.department_id as departmentId,cd.name as departmentName,du.manager FROM department_user du JOIN company_department cd ON du.department_id = cd.id WHERE cd.company_id = #{companyId} AND du.user_id = #{userId}
</select>
</mapper> </mapper>

View File

@ -415,7 +415,6 @@
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<!--额外添加--> <!--额外添加-->
<resultMap id="WithCompanyMap" type="club.joylink.rtss.vo.UserVO"> <resultMap id="WithCompanyMap" type="club.joylink.rtss.vo.UserVO">
<id column="userId" jdbcType="BIGINT" property="id" /> <id column="userId" jdbcType="BIGINT" property="id" />
@ -435,30 +434,49 @@
<result column="sys_user.create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="sys_user.create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="companyId" property="companyId"/> <result column="companyId" property="companyId"/>
<result column="companyName" property="companyName"/> <result column="companyName" property="companyName"/>
<result column="admin" property="companyAdmin"/>
</resultMap> </resultMap>
<select id="pagedQueryWithCompany" parameterType="club.joylink.rtss.vo.UserQueryVO" resultMap="WithCompanyMap"> <select id="queryUsersWithCompany" parameterType="club.joylink.rtss.vo.UserQueryVO" resultMap="WithCompanyMap">
select SELECT
sys_user.id as userId, account, sys_user.`name` as userName, nickname, avatar_path, `password`, mobile, nationcode, email, 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`, sys_user.create_time, update_user_id, wx_id, wx_union_id, wm_open_id, `status`, roles, `offline`, s.create_time, update_user_id,
sys_user.update_time, company.id as companyId, company.`name` as companyName s.update_time, c.id as companyId, c.`name` as companyName,cu.admin as admin
from sys_user left join user_company_rel ucr on sys_user.id = ucr.user_id left join company on ucr.company_id = company.id 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
<where> <where>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and sys_user.`name` like concat('%', #{name}, '%') and s.`name` like concat('%', #{name}, '%')
</if> </if>
<if test="nickname != null and nickname != ''"> <if test="nickname != null and nickname != ''">
and sys_user.`nickname` like concat('%', #{nickname}, '%') and s.`nickname` like concat('%', #{nickname}, '%')
</if> </if>
<if test="mobile != null and mobile != ''"> <if test="mobile != null and mobile != ''">
and sys_user.`mobile` like concat('%', #{mobile}, '%') and s.`mobile` like concat('%', #{mobile}, '%')
</if> </if>
<if test="rolesStr != null and rolesStr != ''"> <if test="rolesStr != null and rolesStr != ''">
and sys_user.`roles` like concat('%', #{rolesStr}, '%') and s.`roles` like concat('%', #{rolesStr}, '%')
</if> </if>
<if test="companyId != null"> <if test="companyId != null">
and company.id = #{companyId} and c.id = #{companyId}
</if> </if>
</where> </where>
order by sys_user.id order by s.id
</select>
<select id="queryUserWithCompany" resultMap="WithCompanyMap">
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
where s.id = #{userId}
</select>
<select id="queryCompanyUserByAccount" resultMap="WithCompanyMap">
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
where s.account = #{account} and c.id = #{companyId}
</select> </select>
</mapper> </mapper>