diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100644 index a45eb6b..0000000 --- a/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2007-present the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import java.net.*; -import java.io.*; -import java.nio.channels.*; -import java.util.Properties; - -public class MavenWrapperDownloader { - - private static final String WRAPPER_VERSION = "0.5.6"; - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" - + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to - * use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = - ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = - ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if (mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } catch (IOException e) { - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } finally { - try { - if (mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); - if (!outputFile.getParentFile().exists()) { - if (!outputFile.getParentFile().mkdirs()) { - System.out.println( - "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) throws Exception { - if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { - String username = System.getenv("MVNW_USERNAME"); - char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); - Authenticator.setDefault(new Authenticator() { - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(username, password); - } - }); - } - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 2cc7d4a..0000000 Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index 642d572..0000000 --- a/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1,2 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/README.md b/README.md deleted file mode 100644 index 107f8bf..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# msdw_tms - -测评管理系统 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 0d3ac1b..1888f60 100644 --- a/pom.xml +++ b/pom.xml @@ -225,6 +225,19 @@ pagehelper 5.1.2 + + + + com.baomidou + mybatis-plus-generator + 3.3.1 + + + org.freemarker + freemarker + 2.3.28 + compile + diff --git a/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java b/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java index e5c9351..f6c28a0 100644 --- a/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java +++ b/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java @@ -2,12 +2,9 @@ package com.msdw.tms.api; import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.ExperimentalTeachingEntity; -import com.msdw.tms.entity.UserEntity; -import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.springframework.web.bind.annotation.GetMapping; import java.text.ParseException; @@ -20,6 +17,7 @@ public interface ExperimentalTeachingControllerApi { @ApiParam(name = "month", value = "月份:1、近一个月内 3、近三个月内 6、近六个月内", required = false) Integer month, @ApiParam(name = "type", value = "类型:1、手动发布 2、定时发布", required = false) Integer type, @ApiParam(name = "status", value = "状态:1、待开始 2、进行中 3、已结束", required = false) Integer status, + @ApiParam(name = "systemId", value = "系统id", required = false) Integer systemId, @ApiParam(name = "startTime", value = "开始时间", required = false) String startTime, @ApiParam(name = "stopTime", value = "结束时间", required = false) String stopTime, @ApiParam(name = "searchContent", value = "搜索内容", required = false) String searchContent, diff --git a/src/main/java/com/msdw/tms/common/exception/ExceptionCatch.java b/src/main/java/com/msdw/tms/common/exception/ExceptionCatch.java index fdbea6f..5043a2d 100644 --- a/src/main/java/com/msdw/tms/common/exception/ExceptionCatch.java +++ b/src/main/java/com/msdw/tms/common/exception/ExceptionCatch.java @@ -7,6 +7,7 @@ import com.msdw.tms.entity.response.ResultCode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; @@ -59,4 +60,16 @@ public class ExceptionCatch { ResultCode resultCode = customException.getResultCode(); return new ResponseResult(resultCode); } + + @ExceptionHandler(MethodArgumentNotValidException.class)//捕获CustomException类型异常 + @ResponseBody + public ResponseResult MethodArgumentNotValidException(MethodArgumentNotValidException customException) { + customException.printStackTrace(); + //记录日志 + LOGGER.error("catch exception:{}", customException.getMessage()); + String message = customException.getBindingResult().getAllErrors().get(0).getDefaultMessage(); + int code =402; + + return ResponseResult.FAIL(code,message); + } } diff --git a/src/main/java/com/msdw/tms/controller/ClassTeachingController.java b/src/main/java/com/msdw/tms/controller/ClassTeachingController.java index 64d7282..d6fe70b 100644 --- a/src/main/java/com/msdw/tms/controller/ClassTeachingController.java +++ b/src/main/java/com/msdw/tms/controller/ClassTeachingController.java @@ -43,58 +43,61 @@ public class ClassTeachingController implements ClassTeachingApi { */ @Override @GetMapping("userRecord") - public R queryTestRecord(@RequestParam Integer page, @RequestParam Integer size, Integer month,String startTime,String endTime, - String condition, @RequestParam Integer status,@RequestParam Integer schoolId){ + public R queryTestRecord(@RequestParam Integer page, @RequestParam Integer size, Integer month, String startTime, String endTime, + String condition, @RequestParam Integer status, @RequestParam Integer schoolId) { ProjectRecordVo recordVo = new ProjectRecordVo(); - if (status==1||status==2||status==3) {//限定实验状态 - recordVo.setStatus(status); - }else{//不限定实验状态 - recordVo.setStatus(null); - } - if(!StringUtils.isEmpty(condition)){ - recordVo.setCondition(condition); + if (status == 1 || status == 2 || status == 3) {//限定实验状态 + recordVo.setStatus(status); + } else {//不限定实验状态 + recordVo.setStatus(null); + } + if (!StringUtils.isEmpty(condition)) { + recordVo.setCondition(condition); + } + if (!StringUtils.isEmpty(month)) { + recordVo.setMonth(month); + } else { + recordVo.setMonth(null); + if (!StringUtils.isEmpty(startTime)) { + recordVo.setStartTime(startTime); } - if(!StringUtils.isEmpty(month)) { - recordVo.setMonth(month); - }else { - recordVo.setMonth(null); - if(!StringUtils.isEmpty(startTime)) { - recordVo.setStartTime(startTime); - }if(!StringUtils.isEmpty(endTime)) { - recordVo.setEndTime(endTime); - } + if (!StringUtils.isEmpty(endTime)) { + recordVo.setEndTime(endTime); } - recordVo.setSchoolId(schoolId); - PageUtils page1 = classTeachingService.queryClassRecord(page,size,recordVo); - return R.ok().put("page", page1); + } + recordVo.setSchoolId(schoolId); + PageUtils page1 = classTeachingService.queryClassRecord(page, size, recordVo); + return R.ok().put("page", page1); } /** * 校验是否需要输入邀请码 + * * @param userId * @param projectId * @return */ @Override @GetMapping("/checkInvitationCode") - public R check(@RequestParam Integer userId,@RequestParam("id") Integer projectId){ - List o = experimentalStudentService.queryIsCode(userId,projectId); - if (o.size()>0){ + public R check(@RequestParam Integer userId, @RequestParam("id") Integer projectId) { + List o = experimentalStudentService.queryIsCode(userId, projectId); + if (o.size() > 0) { return R.ok(); - }else{ - return R.error(200,"false"); + } else { + return R.error(200, "false"); } } /** * 通过邀请码进入实验 + * * @param * @return */ @Override @Transactional @PostMapping("/joinPractice") - public R joinPractice(@RequestBody ExperimentalTeachingEntity entity1){ + public R joinPractice(@RequestBody ExperimentalTeachingEntity entity1) { //获取参数 Integer projectId = entity1.getProjectId(); Integer id = entity1.getId(); @@ -106,58 +109,61 @@ public class ClassTeachingController implements ClassTeachingApi { // Integer ICode = experimentalStudentService.queryIsCode(userId);//获取iscode信息, //if (isCode==0) - if (invitationCode!=null){ - entity.setId(id); + if (invitationCode != null) { + entity.setId(id); // entity.setProjectId(projectId); - ExperimentalTeachingEntity result= classTeachingService.queryInvitationcode(entity);//邀请码唯一 - Integer code = result.getInvitationCode(); - if (invitationCode.equals(code)==true){ - ExperimentalStudentEntity student = studentEntity.setUserId(userId).setProjectId(id); - experimentalStudentService.saveCode(student); - return R.ok(); - }else{ - return R.error("邀请码错误,验证失败!!!"); - } - }else{ - return R.error(400,"邀请码格式错误!!!"); + ExperimentalTeachingEntity result = classTeachingService.queryInvitationcode(entity);//邀请码唯一 + Integer code = result.getInvitationCode(); + if (invitationCode.equals(code) == true) { + ExperimentalStudentEntity student = studentEntity.setUserId(userId).setProjectId(id); + experimentalStudentService.saveCode(student); + return R.ok(); + } else { + return R.error("邀请码错误,验证失败!!!"); } + } else { + return R.error(400, "邀请码格式错误!!!"); } + } /** * 查看虚拟仿真课程列表信息 + * * @param page * @param size * @return */ @Override @GetMapping("/simulationPlayList") - public R querySimulationPlayList(@RequestParam Integer page,@RequestParam Integer size){ - PageUtils page1 = classTeachingService.querySimulationPlayList(page,size); - return R.ok().put("data",page1); + public R querySimulationPlayList(@RequestParam Integer page, @RequestParam Integer size) { + PageUtils page1 = classTeachingService.querySimulationPlayList(page, size); + return R.ok().put("data", page1); } /** - * 学生查看实验报告 + * 学生查看实验报告(教学) + * * @param * @return */ @Override @GetMapping("/queryExperimentalReport") - public R queryExperimentalReport(@RequestParam Integer studentId,@RequestParam Integer projectId,@RequestParam Integer recordId,@RequestParam Integer reportId){ + public R queryExperimentalReport(@RequestParam Integer studentId, @RequestParam Integer projectId, @RequestParam Integer recordId, @RequestParam Integer reportId) { ExperimentalReportVo entity = new ExperimentalReportVo(); - R result = experimentalReportService.queryReport(studentId,projectId,recordId,reportId); + R result = experimentalReportService.queryReport(studentId, projectId, recordId, reportId); return result; } /** - * 学生查看虚拟实验报告 + * 学生查看虚拟实验报告(虚仿) + * * @param * @return */ @Override @GetMapping("/queryVirtualReport") - public R queryVirtualReport(@RequestParam Integer recordId){ + public R queryVirtualReport(@RequestParam Integer recordId) { R result = experimentalReportService.queryVirtualReport(recordId); return result; } diff --git a/src/main/java/com/msdw/tms/controller/ExperimentalProjectController.java b/src/main/java/com/msdw/tms/controller/ExperimentalProjectController.java index 049eed6..31799c7 100644 --- a/src/main/java/com/msdw/tms/controller/ExperimentalProjectController.java +++ b/src/main/java/com/msdw/tms/controller/ExperimentalProjectController.java @@ -2,26 +2,16 @@ package com.msdw.tms.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.msdw.tms.api.ExperimentalProjectControllerApi; -import com.msdw.tms.api.ExperimentalTeachingControllerApi; -import com.msdw.tms.api.UserControllerApi; import com.msdw.tms.common.utils.Constant; import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.ExperimentalProjectEntity; -import com.msdw.tms.entity.ExperimentalTeachingEntity; -import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.vo.ExperimentalProjectEntityVO; -import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; -import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.service.ExperimentalProjectService; -import com.msdw.tms.service.UserService; -import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; -import java.util.List; -import java.util.Map; @RestController @RequestMapping("tms/project") @@ -40,7 +30,7 @@ public class ExperimentalProjectController implements ExperimentalProjectControl return R.ok().put("experimental_project_name", one); } - /** + /**nm * 根据id查询实验班级详情 */ @GetMapping("/getById/{id}") diff --git a/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java b/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java index 7dd84ce..f070234 100644 --- a/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java +++ b/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java @@ -2,24 +2,20 @@ package com.msdw.tms.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.msdw.tms.api.ExperimentalTeachingControllerApi; -import com.msdw.tms.api.UserControllerApi; import com.msdw.tms.common.utils.Constant; import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.ExperimentalTeachingEntity; -import com.msdw.tms.entity.UserEntity; -import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; import com.msdw.tms.entity.vo.ExperimentalTeachingVO; -import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.service.ExperimentalTeachingService; -import com.msdw.tms.service.UserService; -import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; @RestController @RequestMapping("tms/exp") @@ -32,6 +28,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr /** * 根据id查询实验班级详情 */ + @Override @GetMapping("/getById/{id}") public R getById(@PathVariable("id") Integer id){ ExperimentalTeachingEntity et = experimentalTeachingService.getById(id); @@ -40,6 +37,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr /** * 根据邀请码查询 */ + @Override @GetMapping("/getInvitationCode") public R getInvitationCode(@RequestParam Integer invitationCode) { ExperimentalTeachingEntity one = experimentalTeachingService.getOne(new QueryWrapper().eq("invitation_code", invitationCode) @@ -49,15 +47,19 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr /** * 查询 */ + @Override @GetMapping("/list") - public R list(@RequestParam Integer page, - @RequestParam Integer size, - Integer month, Integer type, Integer status, String startTime, String stopTime, String searchContent,@RequestParam Integer schoolId){ + public R list(@RequestParam Integer page, @RequestParam Integer size, + Integer month, Integer type, Integer status,Integer systemId, String startTime, + String stopTime, String searchContent,@RequestParam Integer schoolId){ ExperimentalTeachingVO vo = new ExperimentalTeachingVO(); vo.setSchoolId(schoolId); if (month!=null){ vo.setMonth(month); } + if (systemId!=null){ + vo.setSystemId(systemId); + } if (type!=null){ vo.setType(type); } @@ -80,6 +82,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr /** * 保存 */ + @Override @PostMapping("/save") public R save(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity){ experimentalTeachingService.save(experimentalTeachingEntity); @@ -89,6 +92,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr /** * 修改 */ + @Override @PostMapping("/update") public R update(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity) throws ParseException { //添加实验结束时间 @@ -117,6 +121,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr /** * 删除 */ + @Override @PostMapping("/delete") public R delete(@RequestBody Integer[] ids){ experimentalTeachingService.removeByIds(Arrays.asList(ids)); diff --git a/src/main/java/com/msdw/tms/controller/SysPermissionController.java b/src/main/java/com/msdw/tms/controller/SysPermissionController.java new file mode 100644 index 0000000..879d0a2 --- /dev/null +++ b/src/main/java/com/msdw/tms/controller/SysPermissionController.java @@ -0,0 +1,156 @@ +package com.msdw.tms.controller; + + +import com.msdw.tms.common.exception.ExceptionCast; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.entity.SysPermission; +import com.msdw.tms.entity.SysRole; +import com.msdw.tms.entity.SysRolePermission; +import com.msdw.tms.entity.request.RolePermissionRequest; +import com.msdw.tms.entity.response.CommonCode; +import com.msdw.tms.entity.response.ResponseResult; +import com.msdw.tms.entity.response.RolePermissionResponse; +import com.msdw.tms.service.ISysPermissionService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 菜单权限表 前端控制器 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@RestController +@RequestMapping("/sys-permission") +@Api(tags = {"角色权限管理"}) +public class SysPermissionController { + + @Autowired + private ISysPermissionService permissionService; + + /** + * 权限菜单树形列表展示 + * @return + */ + @GetMapping("/tree") + public ResponseResult tree(){ + List list = permissionService.listWithTree(); + return new ResponseResult>().SUCCESS(list); + } + + /** + * 新增角色权限 + */ + @Transactional + @PostMapping("/saveRolePermission") + public ResponseResult saveRolePermission(@Valid @RequestBody RolePermissionRequest rolePermission) { + Date date = new Date(); + rolePermission.setCreateTime(date); + rolePermission.setMotifyTime(date); + //此处要判重,新增的角色名称要唯一 + int count = permissionService.uniqueRoleName(rolePermission.getName()); + if(count >0){ + ExceptionCast.cast(CommonCode.ROLE_NAME_EXIST); + } + //新增角色到角色表 + int request = permissionService.addHrmsRole(rolePermission); + //根据选中的permissionId批量新增数据到hrms_role_permission + List asList = Arrays.asList(rolePermission.getPermissionIds()); + List rolePermissionList = getRolePermissionList(asList, rolePermission.getRoleId()); + boolean result = permissionService.addHrmsRolePermission(rolePermissionList); + + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); + } + + private List getRolePermissionList(List asList, Long roleId) { + return asList.stream().map(permissionId -> { + RolePermissionRequest request = new RolePermissionRequest(); + request.setRoleId(roleId); + request.setPermissionId(permissionId); + return request; + }).collect(Collectors.toList()); + } + + /** + * 修改角色权限 + */ + @Transactional + @PostMapping("/updateRolePermission") + public ResponseResult updateRolePermission(@Valid @RequestBody RolePermissionRequest rolePermission) { + Date date = new Date(); + rolePermission.setMotifyTime(date); + //根据角色Id修改角色内容 + int request = permissionService.updateHrmsRole(rolePermission); + //删除该角色Id对应的所有权限 + List asList = Arrays.asList(rolePermission.getPermissionIds()); + permissionService.deleteHrmsRolePermission(rolePermission.getRoleId()); + //根据选中的permissionId批量新增数据到hrms_role_permission + List rolePermissionList = getRolePermissionList(asList, rolePermission.getRoleId()); + boolean result = permissionService.addHrmsRolePermission(rolePermissionList); + + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); + } + + /** + * 删除用户角色权限 + */ + @Transactional + @PostMapping("/delRolePermission") + public ResponseResult delRolePermission(@RequestBody RolePermissionRequest rolePermission) { + //根据角色Id查询该角色是否有用户关联 + int count = permissionService.queryCountByRoleId(rolePermission.getRoleIds()); + if(count >0){ + ExceptionCast.cast(CommonCode.ROLE_EMP_EXIST); + } + //没有关联则根据roleId删除hrms_role表对应记录 + boolean b = permissionService.deleteHrmsRoleByRoleId(rolePermission.getRoleIds()); + //根据角色id删除对应所有权限 + boolean result = permissionService.deleteHrmsRolePermission(rolePermission.getRoleIds()); + + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); + } + + /** + * 查看权限数组 + * @param roleId + * @return + */ + @GetMapping("/queryPermissionArrById") + public ResponseResult queryPermissionArrById(@RequestParam("roleId") Long roleId) { + List list = permissionService.queryPermissionArrById(roleId); + ArrayList sb = new ArrayList(); + for (SysRolePermission rolePermission:list) { + sb.add(rolePermission.getPermissionId().intValue()); + } + Integer[] ids = sb.toArray(new Integer[sb.size()]); + //根据roleId查询角色名称和角色描述 + SysRole roleMsg = permissionService.queryRoleMsg(roleId); + Map map = new HashMap(); + map.put("permissionIds",ids); + map.put("name",roleMsg.getName()); + map.put("description",roleMsg.getDescription()); + return new ResponseResult>().SUCCESS(map); + } + + /** + * 角色权限列表展示 + * @param page + * @param size + * @return + */ + @GetMapping("/rolePermissionList") + public ResponseResult rolePermissionList(@RequestParam("page") Integer page, + @RequestParam("size") Integer size,@RequestParam("name")String name) { + PageUtils data = permissionService.queryPage(page, size, name); + return new ResponseResult().SUCCESS(data); + } + +} diff --git a/src/main/java/com/msdw/tms/controller/SystemSettingController.java b/src/main/java/com/msdw/tms/controller/SystemSettingController.java index cf67939..93331e6 100644 --- a/src/main/java/com/msdw/tms/controller/SystemSettingController.java +++ b/src/main/java/com/msdw/tms/controller/SystemSettingController.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -32,7 +33,7 @@ public class SystemSettingController implements SystemSetttingApi { */ @Override @PostMapping("/addStaff") - public R addStaff(@RequestBody StaffVo staffVo){ + public R addStaff(@RequestBody @Valid StaffVo staffVo){ R r = systemSetttingService.addStaff(staffVo); return r; } @@ -153,4 +154,15 @@ public class SystemSettingController implements SystemSetttingApi { R result = systemSetttingService.queryAccount(account,schoolId); return result; } + + /** + * 重置密码 + * @param userId + * @return + */ + @GetMapping("/resetPwd") + public R resetPwd(@RequestParam Integer userId,String newPwd){ + R r = systemSetttingService.resetPwd(userId,newPwd); + return r; + } } diff --git a/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java b/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java index e1f10c7..4d4f96b 100644 --- a/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java +++ b/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.msdw.tms.entity.ExperimentalProjectEntity; import com.msdw.tms.entity.ExperimentalReportEntity; import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.entity.resp.GetByUserRecordResp; import com.msdw.tms.entity.vo.ProjectRecordExportVo; import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.entity.vo.RecordVo; @@ -15,26 +16,24 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * - * - * @author - * @email + * @author + * @email * @date 2020-08-19 16:07:02 */ @Mapper public interface ProjectRecordDao extends BaseMapper { - IPage getByUserRecord(Page page,@Param("pro") ProjectRecordEntity projectRecordEntity,Integer projectPermissions); + IPage getByUserRecord(Page page, @Param("userId") Integer userId, @Param("projectPermissions") Integer projectPermissions); - IPage getByUserExperimentRecord(Page page,@Param("pro") ProjectRecordEntity projectRecordEntity); + IPage getByUserExperimentRecord(Page page, @Param("pro") ProjectRecordEntity projectRecordEntity); List getByUserRecordImport(ProjectRecordEntity projectRecordEntity); - ProjectRecordVo getByUserScore(@Param("userid") Integer userId,@Param("isdel") Integer isdel); + ProjectRecordVo getByUserScore(@Param("userid") Integer userId, @Param("isdel") Integer isdel); ProjectRecordVo queryScore(@Param("userId") Integer userId); - IPage getBySchoolRecord(Page page,@Param("pro") ProjectRecordVo projectRecord); + IPage getBySchoolRecord(Page page, @Param("pro") ProjectRecordVo projectRecord); boolean updateUserRecord(ProjectRecordEntity projectRecord); diff --git a/src/main/java/com/msdw/tms/dao/SysPermissionMapper.java b/src/main/java/com/msdw/tms/dao/SysPermissionMapper.java new file mode 100644 index 0000000..266a038 --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/SysPermissionMapper.java @@ -0,0 +1,22 @@ +package com.msdw.tms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.msdw.tms.entity.SysPermission; +import com.msdw.tms.entity.response.RolePermissionResponse; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 菜单权限表 Mapper 接口 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Mapper +public interface SysPermissionMapper extends BaseMapper { + + IPage pageByCondition(Page page,String name); +} diff --git a/src/main/java/com/msdw/tms/dao/SysRoleMapper.java b/src/main/java/com/msdw/tms/dao/SysRoleMapper.java new file mode 100644 index 0000000..01c2c70 --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/SysRoleMapper.java @@ -0,0 +1,28 @@ +package com.msdw.tms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.msdw.tms.entity.SysRole; +import com.msdw.tms.entity.request.RolePermissionRequest; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 用户角色表 Mapper 接口 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Mapper +public interface SysRoleMapper extends BaseMapper { + + int addHrmsRole(RolePermissionRequest rolePermission); + + int updateHrmsRole(RolePermissionRequest rolePermission); + + boolean deleteHrmsRoleByRoleId(@Param("roleIds") List roleIds); + +} diff --git a/src/main/java/com/msdw/tms/dao/SysRolePermissionMapper.java b/src/main/java/com/msdw/tms/dao/SysRolePermissionMapper.java new file mode 100644 index 0000000..7cce2f8 --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/SysRolePermissionMapper.java @@ -0,0 +1,31 @@ +package com.msdw.tms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.msdw.tms.entity.SysRolePermission; +import com.msdw.tms.entity.request.RolePermissionRequest; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 角色权限中间表 Mapper 接口 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Mapper +public interface SysRolePermissionMapper extends BaseMapper { + + int uniqueRoleName(String name); + + boolean addHrmsRolePermission(@Param("rolePermissionList") List rolePermissionList); + + boolean deleteHrmsRolePermission(@Param("roleIds") List roleIds); + + boolean deleteHrmsRolePermissionSingle(Long roleId); + + List queryPermissionArrById(Long roleId); +} diff --git a/src/main/java/com/msdw/tms/dao/SysUserRoleMapper.java b/src/main/java/com/msdw/tms/dao/SysUserRoleMapper.java new file mode 100644 index 0000000..b37ac13 --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/SysUserRoleMapper.java @@ -0,0 +1,22 @@ +package com.msdw.tms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.msdw.tms.entity.SysUserRole; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 用户角色中间表 Mapper 接口 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Mapper +public interface SysUserRoleMapper extends BaseMapper { + + int queryCountByRoleId(@Param("roleIds") List roleIds); +} diff --git a/src/main/java/com/msdw/tms/entity/ExperimentalTeachingEntity.java b/src/main/java/com/msdw/tms/entity/ExperimentalTeachingEntity.java index c6f3795..78033be 100644 --- a/src/main/java/com/msdw/tms/entity/ExperimentalTeachingEntity.java +++ b/src/main/java/com/msdw/tms/entity/ExperimentalTeachingEntity.java @@ -45,6 +45,8 @@ public class ExperimentalTeachingEntity { private Integer isCode; //绑定用户Id private Integer userId; + //绑定系统Id + private Integer systemId; //创建时间 private String creationTime; //实验倒计时 diff --git a/src/main/java/com/msdw/tms/entity/SysPermission.java b/src/main/java/com/msdw/tms/entity/SysPermission.java new file mode 100644 index 0000000..cb3851e --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/SysPermission.java @@ -0,0 +1,100 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 菜单权限表 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Data +@TableName("sys_permission") +public class SysPermission implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 权限标识符 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 父权限id + */ + private Long parentId; + + /** + * 层级 + */ + private Integer level; + + /** + * 是否是菜单:1、是,0、不是(0目前为按钮) + */ + private Integer menuOrNot; + + /** + * 状态:0、启用,1、禁用 + */ + private Integer status; + + /** + * 路径 + */ + private String url; + + /** + * 页面路径 + */ + private String menuUrl; + + /** + * 排序 + */ + private Integer sort; + + /** + * 图标 + */ + private String icon; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date motifyTime; + + /** + * 子权限 + */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private List children; +} diff --git a/src/main/java/com/msdw/tms/entity/SysRole.java b/src/main/java/com/msdw/tms/entity/SysRole.java new file mode 100644 index 0000000..6a6ffac --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/SysRole.java @@ -0,0 +1,60 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 用户角色表 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Data +@TableName("sys_role") +public class SysRole implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 角色名称 + */ + private String name; + + /** + * 角色描述 + */ + private String description; + + /** + * 是否删除:0、未删除,1、删除 + */ + private Integer delOrNot; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date motifyTime; + + /** + * 编码 + */ + private String code; +} diff --git a/src/main/java/com/msdw/tms/entity/SysRolePermission.java b/src/main/java/com/msdw/tms/entity/SysRolePermission.java new file mode 100644 index 0000000..b4add0e --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/SysRolePermission.java @@ -0,0 +1,39 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 角色权限中间表 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Data +@TableName("sys_role_permission") +public class SysRolePermission implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 角色id + */ + private Long roleId; + + /** + * 权限id + */ + private Long permissionId; +} diff --git a/src/main/java/com/msdw/tms/entity/SysUserRole.java b/src/main/java/com/msdw/tms/entity/SysUserRole.java new file mode 100644 index 0000000..aa886f5 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/SysUserRole.java @@ -0,0 +1,39 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 用户角色中间表 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Data +@TableName("sys_user_role") +public class SysUserRole implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 角色id + */ + private Long roleId; +} diff --git a/src/main/java/com/msdw/tms/entity/UserInfoEntity.java b/src/main/java/com/msdw/tms/entity/UserInfoEntity.java index 7a2b646..a0f2a63 100644 --- a/src/main/java/com/msdw/tms/entity/UserInfoEntity.java +++ b/src/main/java/com/msdw/tms/entity/UserInfoEntity.java @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.constraints.Pattern; + @Accessors(chain = true) @Data @TableName("hr_user_info") @@ -15,6 +17,7 @@ public class UserInfoEntity { //用户姓名 private String userName; //用户账号 + @Pattern(regexp = "/^[1-9]([0-9]{1,5})?$/", message = "账号只能为数字!") private String account; //用户密码 private String password; @@ -60,4 +63,6 @@ public class UserInfoEntity { private Integer schoolAppellationId; //token private String token; + //最后登录时间 + private String lastLoginTime; } diff --git a/src/main/java/com/msdw/tms/entity/request/RolePermissionRequest.java b/src/main/java/com/msdw/tms/entity/request/RolePermissionRequest.java new file mode 100644 index 0000000..9354095 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/request/RolePermissionRequest.java @@ -0,0 +1,83 @@ +package com.msdw.tms.entity.request; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 记录菜单权限 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 17:12:14 + */ +@Data +public class RolePermissionRequest implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 角色id + */ + private Long roleId; + + /** + * 角色ids + */ + private Long[] roleIds; + /** + * 角色名称 + */ + private String name; + + /** + * 角色描述 + */ + private String description; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date motifyTime; + + /** + * 权限ids + */ + @NotEmpty(message = "权限至少选中一项!") + private Long[] permissionIds; + + private Long permissionId; + + /** + * 拥有权限名称 + */ + private String permissionName; + + /** + * 父级id + */ + private Long parentId; + + /** + * 子权限 + */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private List children; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/src/main/java/com/msdw/tms/entity/resp/GetByUserRecordResp.java b/src/main/java/com/msdw/tms/entity/resp/GetByUserRecordResp.java new file mode 100644 index 0000000..5155336 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/resp/GetByUserRecordResp.java @@ -0,0 +1,89 @@ +package com.msdw.tms.entity.resp; + +import lombok.Data; + +/** + * @ProjectName: tms + * @Package: com.msdw.tms.entity.resp + * @ClassName: GetByUserRecordResp + * @Description: java类作用描述 + * @Author: Maureen.Rong + * @CreateDate: 2021/2/25 15:26 + * @UpdateDate: 2021/2/25 15:26 + * @Version: 1.0 + */ + +public class GetByUserRecordResp { + private String projectName; + private Integer recordId; + private Integer score; + private Integer codeId; + private String startingTime; + private String submitTime; + private Integer timeSum; + private Integer userId; + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public Integer getRecordId() { + return recordId; + } + + public void setRecordId(Integer recordId) { + this.recordId = recordId; + } + + public Integer getScore() { + return score; + } + + public void setScore(Integer score) { + this.score = score; + } + + public Integer getCodeId() { + return codeId; + } + + public void setCodeId(Integer codeId) { + this.codeId = codeId; + } + + public String getStartingTime() { + return startingTime; + } + + public void setStartingTime(String startingTime) { + this.startingTime = startingTime; + } + + public String getSubmitTime() { + return submitTime; + } + + public void setSubmitTime(String submitTime) { + this.submitTime = submitTime; + } + + public Integer getTimeSum() { + return timeSum; + } + + public void setTimeSum(Integer timeSum) { + this.timeSum = timeSum; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } +} diff --git a/src/main/java/com/msdw/tms/entity/response/CommonCode.java b/src/main/java/com/msdw/tms/entity/response/CommonCode.java index d3374b6..c8aa3ce 100644 --- a/src/main/java/com/msdw/tms/entity/response/CommonCode.java +++ b/src/main/java/com/msdw/tms/entity/response/CommonCode.java @@ -18,6 +18,9 @@ public enum CommonCode implements ResultCode { REPEAT_INEXCEL(false, 10010, "试题在excel表中重复!"), EVALUATION_QUESTION_NUM_INVALID(false, 10011, "当前测评题数设置为0,请先设置测评题数!"), FAIL(false, 11111, "操作失败!"), + + ROLE_NAME_EXIST(false,20001,"该角色名称已存在,请重新输入!"), + ROLE_EMP_EXIST(false,44001,"该角色有用户关联,不能删除!"), SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"); //操作是否成功 boolean success; diff --git a/src/main/java/com/msdw/tms/entity/response/ResponseResult.java b/src/main/java/com/msdw/tms/entity/response/ResponseResult.java index c05f8ed..2b2464b 100644 --- a/src/main/java/com/msdw/tms/entity/response/ResponseResult.java +++ b/src/main/java/com/msdw/tms/entity/response/ResponseResult.java @@ -1,22 +1,46 @@ package com.msdw.tms.entity.response; +import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; +/** + * @Author: gongsj. + * @Description: 统一返回的结果集。 + * @Date:Created in 2020/09/07 12:28. + * @Modified By: + */ @Data @ToString @NoArgsConstructor -public class ResponseResult implements Response { +@AllArgsConstructor +public class ResponseResult { + /** + * 操作是否成功 + */ + private boolean success; - //操作是否成功 - boolean success = SUCCESS; + /** + * 状态码 + */ + private int code; - //操作代码 - int code = SUCCESS_CODE; + /** + * 返回的数据 + */ + private T data; - //提示信息 - String message; + /** + * 提示信息 + */ + private String message; + + public ResponseResult(boolean success, int code, String message) { + this.success = success; + this.code = code; + this.message = message; + } public ResponseResult(ResultCode resultCode) { this.success = resultCode.success(); @@ -28,8 +52,24 @@ public class ResponseResult implements Response { return new ResponseResult(CommonCode.SUCCESS); } + public static ResponseResult SUCCESS(Object t) { + return new ResponseResult<>(true, 10000, t, "操作成功!"); + } + + public static ResponseResult FAIL(Object t) { + return new ResponseResult<>(false, 99999, t, "操作失败,请检查客户名称是否已存在或者文件和数据格式是否正确!"); + } + + public ResponseResult SUCCESS_DATA(T t) { + return new ResponseResult<>(false, 20000, t, "操作失败!"); + } + public static ResponseResult FAIL() { return new ResponseResult(CommonCode.FAIL); } + public static ResponseResult FAIL(int code, String message) { + return new ResponseResult<>(false, code, null, message); + } + } diff --git a/src/main/java/com/msdw/tms/entity/response/RolePermissionResponse.java b/src/main/java/com/msdw/tms/entity/response/RolePermissionResponse.java new file mode 100644 index 0000000..e3c9748 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/response/RolePermissionResponse.java @@ -0,0 +1,80 @@ +package com.msdw.tms.entity.response; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 记录菜单权限 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 17:12:14 + */ +@Data +@TableName("hrms_permission") +public class RolePermissionResponse implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 角色id + */ + @ApiModelProperty("id") + private Long roleId; + /** + * 角色名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 角色描述 + */ + @ApiModelProperty("角色描述") + private String description; + + /** + * 权限id + */ + @ApiModelProperty("权限id") + private Long permissionId; + + /** + * 拥有权限名称 + */ + @ApiModelProperty("权限名称") + private String permissionName; + + /** + * 父级id + */ + @ApiModelProperty("父级id") + private Long parentId; + + /** + * 子权限 + */ + @ApiModelProperty("子权限") + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private List children; + + /** + * 排序 + */ + @ApiModelProperty("子权限") + private Integer sort; + + /** + * 权限标识 + */ + private String code; + + private boolean disabled=true; + +} diff --git a/src/main/java/com/msdw/tms/entity/vo/ExperimentalTeachingVO.java b/src/main/java/com/msdw/tms/entity/vo/ExperimentalTeachingVO.java index 270246f..b3370c1 100644 --- a/src/main/java/com/msdw/tms/entity/vo/ExperimentalTeachingVO.java +++ b/src/main/java/com/msdw/tms/entity/vo/ExperimentalTeachingVO.java @@ -18,4 +18,6 @@ public class ExperimentalTeachingVO { private Integer status; //学校id private Integer schoolId; + //绑定系统Id + private Integer systemId; } diff --git a/src/main/java/com/msdw/tms/service/ISysPermissionService.java b/src/main/java/com/msdw/tms/service/ISysPermissionService.java new file mode 100644 index 0000000..eae3794 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/ISysPermissionService.java @@ -0,0 +1,45 @@ +package com.msdw.tms.service; + +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.entity.SysPermission; +import com.baomidou.mybatisplus.extension.service.IService; +import com.msdw.tms.entity.SysRole; +import com.msdw.tms.entity.SysRolePermission; +import com.msdw.tms.entity.request.RolePermissionRequest; + +import java.util.List; + +/** + *

+ * 菜单权限表 服务类 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +public interface ISysPermissionService extends IService { + + List listWithTree(); + + int uniqueRoleName(String name); + + int addHrmsRole(RolePermissionRequest rolePermission); + + boolean addHrmsRolePermission(List rolePermissionList); + + int updateHrmsRole(RolePermissionRequest rolePermission); + + boolean deleteHrmsRolePermission(Long roleId); + + boolean deleteHrmsRolePermission(Long[] roleIds); + + int queryCountByRoleId(Long[] roleIds); + + boolean deleteHrmsRoleByRoleId(Long[] roleIds); + + List queryPermissionArrById(Long roleId); + + SysRole queryRoleMsg(Long roleId); + + PageUtils queryPage(Integer page, Integer size, String name); +} diff --git a/src/main/java/com/msdw/tms/service/ISysRolePermissionService.java b/src/main/java/com/msdw/tms/service/ISysRolePermissionService.java new file mode 100644 index 0000000..08bfc35 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/ISysRolePermissionService.java @@ -0,0 +1,16 @@ +package com.msdw.tms.service; + +import com.msdw.tms.entity.SysRolePermission; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 角色权限中间表 服务类 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +public interface ISysRolePermissionService extends IService { + +} diff --git a/src/main/java/com/msdw/tms/service/ISysRoleService.java b/src/main/java/com/msdw/tms/service/ISysRoleService.java new file mode 100644 index 0000000..8d5af9c --- /dev/null +++ b/src/main/java/com/msdw/tms/service/ISysRoleService.java @@ -0,0 +1,16 @@ +package com.msdw.tms.service; + +import com.msdw.tms.entity.SysRole; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 用户角色表 服务类 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +public interface ISysRoleService extends IService { + +} diff --git a/src/main/java/com/msdw/tms/service/ISysUserRoleService.java b/src/main/java/com/msdw/tms/service/ISysUserRoleService.java new file mode 100644 index 0000000..dc900c5 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/ISysUserRoleService.java @@ -0,0 +1,16 @@ +package com.msdw.tms.service; + +import com.msdw.tms.entity.SysUserRole; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 用户角色中间表 服务类 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +public interface ISysUserRoleService extends IService { + +} diff --git a/src/main/java/com/msdw/tms/service/ProjectRecordService.java b/src/main/java/com/msdw/tms/service/ProjectRecordService.java index 74edc2a..780ad3d 100644 --- a/src/main/java/com/msdw/tms/service/ProjectRecordService.java +++ b/src/main/java/com/msdw/tms/service/ProjectRecordService.java @@ -11,27 +11,25 @@ import java.util.HashMap; import java.util.List; /** - * - * - * @author - * @email + * @author + * @email * @date 2020-08-19 16:07:02 */ public interface ProjectRecordService extends IService { - PageUtils queryPage(Integer page,Integer size,Integer userId,Integer projectPermissions); + PageUtils queryPage(Integer page, Integer size, Integer userId, Integer projectPermissions); - PageUtils queryExperimentPage(Integer page,Integer size,Integer userid); + PageUtils queryExperimentPage(Integer page, Integer size, Integer userid); ProjectRecordVo queryUserScore(Integer userId); ProjectRecordVo queryScore(Integer userId); - void exportProjectRecord(HttpServletResponse response, Integer userId)throws Exception; + void exportProjectRecord(HttpServletResponse response, Integer userId) throws Exception; - void exportExperimentProjectRecord(HttpServletResponse response, Integer userId)throws Exception; + void exportExperimentProjectRecord(HttpServletResponse response, Integer userId) throws Exception; - PageUtils querySchoolRecord(Integer page,Integer size,ProjectRecordVo projectRecord); + PageUtils querySchoolRecord(Integer page, Integer size, ProjectRecordVo projectRecord); boolean updateUserRecord(ProjectRecordEntity projectRecord); diff --git a/src/main/java/com/msdw/tms/service/SystemSetttingService.java b/src/main/java/com/msdw/tms/service/SystemSetttingService.java index 6bd9838..7b0d6e6 100644 --- a/src/main/java/com/msdw/tms/service/SystemSetttingService.java +++ b/src/main/java/com/msdw/tms/service/SystemSetttingService.java @@ -34,4 +34,6 @@ public interface SystemSetttingService { void downloadFiles(HttpServletResponse response) throws IOException; R queryAccount(String account,Integer schoolId); + + R resetPwd(Integer userId,String newPwd); } diff --git a/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java index b419d62..80ced2d 100644 --- a/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java @@ -15,7 +15,7 @@ import java.util.HashMap; import java.util.List; @Service -public class ExperimentalReportServiceImpl extends ServiceImpl implements ExperimentalReportService { +public class ExperimentalReportServiceImpl extends ServiceImpl implements ExperimentalReportService { @Autowired private ExperimentalReportDao reportDao; @@ -23,37 +23,47 @@ public class ExperimentalReportServiceImpl extends ServiceImpl map = new HashMap<>(); - map.put("report",result); - if(systemId==1|systemId==4|systemId==5){ + map.put("report", result); + if (systemId == 1 | systemId == 4 | systemId == 5) { List data = achievementManagementDao.queryPythonTest(recordId); - map.put("data",data); - return R.ok().put("data",map); + map.put("data", data); + return R.ok().put("data", map); } - return R.ok().put("data",map); + return R.ok().put("data", map); } + //虚拟实验 @Override public R queryVirtualReport(Integer recordId) { ExperimentalReportVo result = reportDao.queryVirtualReport(recordId); - Integer systemId =reportDao.querySystemId(recordId); + Integer systemId = reportDao.querySystemId(recordId); //python实验 - if(systemId==1|systemId==4|systemId==5){ + if (systemId == 1 | systemId == 4 | systemId == 5) { List data = achievementManagementDao.queryPythonTest(recordId); HashMap map = new HashMap<>(); - map.put("data",data); - map.put("report",result); - return R.ok().put("data",map); + map.put("data", data); + map.put("report", result); + return R.ok().put("data", map); } - return R.ok().put("data",result); + return R.ok().put("data", result); } } diff --git a/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java index 140fa2c..1265737 100644 --- a/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java @@ -1,31 +1,20 @@ package com.msdw.tms.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.msdw.tms.common.utils.Constant; import com.msdw.tms.common.utils.PageUtils; -import com.msdw.tms.common.utils.Query; import com.msdw.tms.dao.ClassTeachingDao; import com.msdw.tms.dao.ExperimentalTeachingDao; -import com.msdw.tms.dao.UserDao; import com.msdw.tms.entity.ExperimentalTeachingEntity; -import com.msdw.tms.entity.UserEntity; -import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; import com.msdw.tms.entity.vo.ExperimentalTeachingVO; import com.msdw.tms.entity.vo.ProjectRecordVo; -import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.service.ExperimentalTeachingService; -import com.msdw.tms.service.UserService; import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; -import java.util.Map; - @Service("experimentalTeachingService") public class ExperimentalTeachingServiceImpl extends ServiceImpl implements ExperimentalTeachingService { diff --git a/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java index 020f208..8343694 100644 --- a/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java @@ -12,6 +12,7 @@ import com.msdw.tms.entity.ExperimentalReportEntity; import com.msdw.tms.entity.ProjectRecordEntity; import com.msdw.tms.entity.request.ExperimentProjectRecordImportRequest; import com.msdw.tms.entity.request.ProjectRecordImportRequest; +import com.msdw.tms.entity.resp.GetByUserRecordResp; import com.msdw.tms.entity.vo.ProjectRecordExportVo; import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.service.ProjectRecordService; @@ -37,14 +38,15 @@ public class ProjectRecordServiceImpl extends ServiceImpl page1 = new Page<>(page, size); - IPage projectRecordVos = this.baseMapper.getByUserRecord(page1,projectRecord,projectPermissions); + IPage projectRecordVos = this.baseMapper.getByUserRecord(page1, userId, projectPermissions); PageUtils questionsPage = new PageUtils(projectRecordVos); @@ -59,7 +61,7 @@ public class ProjectRecordServiceImpl extends ServiceImpl page1 = new Page<>(page, size); - IPage projectRecordVos = this.baseMapper.getByUserExperimentRecord(page1,projectRecord); + IPage projectRecordVos = this.baseMapper.getByUserExperimentRecord(page1, projectRecord); PageUtils questionsPage = new PageUtils(projectRecordVos); @@ -70,9 +72,9 @@ public class ProjectRecordServiceImpl extends ServiceImpl + * 菜单权限表 服务实现类 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Service +public class SysPermissionServiceImpl extends ServiceImpl implements ISysPermissionService { + + @Resource + private SysRolePermissionMapper rolePermissionMapper; + + @Resource + private SysRoleMapper roleMapper; + + @Resource + private SysUserRoleMapper userRoleMapper; + + @Override + public List listWithTree() { +/* Listlist = this.getBaseMapper().queryPermissionTree(); + return getPermissionTreeList(list,0L);*/ + System.out.println("this.list()=================="+this.list()); + return getPermissionTreeList(this.list(), 0L); + } + + private List getPermissionTreeList(List list, Long parentId){ + return list.stream() + .filter(item -> parentId.equals(item.getParentId())) + .peek(item -> item.setChildren(getPermissionTreeList(list, item.getId()))) + .sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))) + .collect(Collectors.toList()); + } + + @Override + public int uniqueRoleName(String name) { + return rolePermissionMapper.uniqueRoleName(name); + } + + @Override + public int addHrmsRole(RolePermissionRequest rolePermission) { + int request = roleMapper.addHrmsRole(rolePermission); + return request; + } + + @Override + public boolean addHrmsRolePermission(List rolePermissionList) { + return rolePermissionMapper.addHrmsRolePermission(rolePermissionList); + } + + @Override + public int updateHrmsRole(RolePermissionRequest rolePermission) { + return roleMapper.updateHrmsRole(rolePermission); + } + + @Override + public boolean deleteHrmsRolePermission(Long roleId) { + return rolePermissionMapper.deleteHrmsRolePermissionSingle(roleId); + } + + @Override + public boolean deleteHrmsRolePermission(Long[] roleIds) { + return rolePermissionMapper.deleteHrmsRolePermission(Arrays.asList(roleIds)); + } + + @Override + public int queryCountByRoleId(Long[] roleIds) { + int count = userRoleMapper.queryCountByRoleId(Arrays.asList(roleIds)); + return count; + } + + @Override + public boolean deleteHrmsRoleByRoleId(Long[] roleIds) { + return roleMapper.deleteHrmsRoleByRoleId(Arrays.asList(roleIds)); + } + + @Override + public List queryPermissionArrById(Long roleId) { + return rolePermissionMapper.queryPermissionArrById(roleId); + } + + @Override + public SysRole queryRoleMsg(Long roleId) { + return roleMapper.selectById(roleId); + } + + @Override + public PageUtils queryPage(Integer page, Integer size, String name) { + //分页参数 + if (page <= 0) { + page = 1; + } + if (size <= 0) { + size = 10; + } + IPage systemLogVo = this.getBaseMapper().pageByCondition(new Page(page, size),name); + + return new PageUtils(systemLogVo); + } +} diff --git a/src/main/java/com/msdw/tms/service/impl/SysRolePermissionServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/SysRolePermissionServiceImpl.java new file mode 100644 index 0000000..713fac2 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/SysRolePermissionServiceImpl.java @@ -0,0 +1,20 @@ +package com.msdw.tms.service.impl; + +import com.msdw.tms.dao.SysRolePermissionMapper; +import com.msdw.tms.entity.SysRolePermission; +import com.msdw.tms.service.ISysRolePermissionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 角色权限中间表 服务实现类 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Service +public class SysRolePermissionServiceImpl extends ServiceImpl implements ISysRolePermissionService { + +} diff --git a/src/main/java/com/msdw/tms/service/impl/SysRoleServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/SysRoleServiceImpl.java new file mode 100644 index 0000000..58b4856 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/SysRoleServiceImpl.java @@ -0,0 +1,20 @@ +package com.msdw.tms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.msdw.tms.dao.SysRoleMapper; +import com.msdw.tms.entity.SysRole; +import com.msdw.tms.service.ISysRoleService; +import org.springframework.stereotype.Service; + +/** + *

+ * 用户角色表 服务实现类 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Service +public class SysRoleServiceImpl extends ServiceImpl implements ISysRoleService { + +} diff --git a/src/main/java/com/msdw/tms/service/impl/SysUserRoleServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/SysUserRoleServiceImpl.java new file mode 100644 index 0000000..336895a --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/SysUserRoleServiceImpl.java @@ -0,0 +1,20 @@ +package com.msdw.tms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.msdw.tms.dao.SysUserRoleMapper; +import com.msdw.tms.entity.SysUserRole; +import com.msdw.tms.service.ISysUserRoleService; +import org.springframework.stereotype.Service; + +/** + *

+ * 用户角色中间表 服务实现类 + *

+ * + * @author Qyq + * @since 2021-02-24 + */ +@Service +public class SysUserRoleServiceImpl extends ServiceImpl implements ISysUserRoleService { + +} diff --git a/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java index 879d031..0c7db4e 100644 --- a/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java @@ -2,6 +2,7 @@ package com.msdw.tms.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -497,4 +498,18 @@ public class SystemSettingServiceImpl implements SystemSetttingService { } return R.ok(); } + + @Override + @Transactional + public R resetPwd(Integer userId,String newPwd) { + UserInfoEntity user = new UserInfoEntity(); + user.setPassword(newPwd); + int count = userInfoDao.update(user, new QueryWrapper().eq("userId", userId)); + if(count > 0){ + return R.ok(); + }else{ + return R.error(20002,"重置失败"); + } + } + } \ No newline at end of file diff --git a/src/main/java/com/msdw/tms/util/MyBatisPlusCodeGenerator.java b/src/main/java/com/msdw/tms/util/MyBatisPlusCodeGenerator.java new file mode 100644 index 0000000..e7f58ca --- /dev/null +++ b/src/main/java/com/msdw/tms/util/MyBatisPlusCodeGenerator.java @@ -0,0 +1,115 @@ +package com.msdw.tms.util; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.core.toolkit.StringPool; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.InjectionConfig; +import com.baomidou.mybatisplus.generator.config.*; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: LvFang + * @Date: Created in 2019/6/11. + * @Description: + */ +public class MyBatisPlusCodeGenerator { + + //包名 + public static final String PACKAGE_NAME = "com.msdw.tms"; + + public static void main(String[] args) { + String[] tables = new String[] {"sys_role","sys_role_permission","sys_user_role"};//表名数组 + String[] tablePrefixs = new String[] {""};//去掉前缀 + executeCode(PACKAGE_NAME,tables,tablePrefixs); + } + + private static void executeCode(String pack, String[] tables, String[] tablePrefixs) { + // 代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 全局配置 + GlobalConfig gc = new GlobalConfig(); + // 是否覆盖已有文件 + gc.setFileOverride(false); + // 生成文件的输出目录 + String projectPath = System.getProperty("user.dir");//user.dir 表示当前工程路径无需替换 + gc.setOutputDir(projectPath + "/src/main/java"); + //设置bean命名规范 + gc.setEntityName("%s"); + // 开发人员 + gc.setAuthor("Qyq"); + // 是否打开输出目录 + gc.setOpen(false); + // 开启 BaseResultMap + gc.setBaseResultMap(true); + // 指定生成的主键的ID类型 + gc.setIdType(IdType.ID_WORKER); + // 时间类型对应策略: 只使用 java.util.date 代替 + gc.setDateType(DateType.ONLY_DATE); + mpg.setGlobalConfig(gc); + + // 数据源配置 + DataSourceConfig config= new DataSourceConfig(); + // 从试图获取 + config.setUrl("jdbc:mysql://localhost:3306/msdw_tms?serverTimezone=UTC"); + config.setDriverName("com.mysql.cj.jdbc.Driver"); + config.setUsername("root"); + config.setPassword("root"); + mpg.setDataSource(config); + + // 包配置 + PackageConfig pc = new PackageConfig(); + // 父包名。如果为空,将下面子包名必须写全部, 否则就只需写子包名 + pc.setParent(pack); + // Entity包名 + pc.setEntity("entity"); + mpg.setPackageInfo(pc); + + // 自定义配置 + InjectionConfig cfg = new InjectionConfig() { + @Override + public void initMap() { + // to do nothing + } + }; + List focList = new ArrayList<>(); + focList.add(new FileOutConfig("/templates/mapper.xml.ftl") { + public String outputFile(TableInfo tableInfo) { + // 自定义输入文件名称 + if (StringUtils.isEmpty(pc.getModuleName())) { + return projectPath + "/src/main/resources/mapper/tms/" + tableInfo.getXmlName() + StringPool.DOT_XML; + }else { + return projectPath + "/src/main/resources/mapper/tms/" + pc.getModuleName() + "/" + tableInfo.getXmlName() + StringPool.DOT_XML; + } + } + }); + cfg.setFileOutConfigList(focList); + mpg.setCfg(cfg); + mpg.setTemplate(new TemplateConfig().setXml(null)); + + // 策略配置 + StrategyConfig strategy = new StrategyConfig(); + // 数据库表映射到实体的命名策略: 下划线转驼峰命名 + strategy.setNaming(NamingStrategy.underline_to_camel); + // 数据库表字段映射到实体的命名策略: 下划线转驼峰命名 + strategy.setColumnNaming(NamingStrategy.underline_to_camel); + // 【实体】是否为lombok模型(默认 false) + strategy.setEntityLombokModel(false); + // 需要包含的表名,允许正则表达式(与exclude二选一配置) + strategy.setInclude(tables); + // 驼峰转连字符 + strategy.setControllerMappingHyphenStyle(true); + // 表前缀 + strategy.setTablePrefix(tablePrefixs); + mpg.setStrategy(strategy); + mpg.setTemplateEngine(new FreemarkerTemplateEngine()); + mpg.execute(); + } +} diff --git a/src/main/resources/mapper/tms/AchievementManagementDao.xml b/src/main/resources/mapper/tms/AchievementManagementDao.xml index 64f16a1..8b21be1 100644 --- a/src/main/resources/mapper/tms/AchievementManagementDao.xml +++ b/src/main/resources/mapper/tms/AchievementManagementDao.xml @@ -2,378 +2,442 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + SELECT her.*, pm.projectName, s.workNumber + FROM hr_experimental_report her, + hr_project_management pm, + student s + WHERE her.reportId = #{reportId} + and her.studentId = #{studentId} + and her.projectId = pm.projectId + and her.studentId = s.userId - + - - - - - INSERT INTO hr_experimental_report( projectId, content, principle, step, analysis, summarize, improvement, - commentId, studentId, period,laboratory,className,steps1,steps2,steps3,steps4,steps5,steps6,steps7,steps8,steps9,steps10,timeConsuming,startTime,creationTime,purpose,teacherName) - VALUES - (#{projectId},#{content}, #{principle}, #{step}, #{analysis}, #{summarize}, #{improvement}, #{commentId}, #{studentId}, - #{period}, #{laboratory},#{className},#{steps1},#{steps2},#{steps3},#{steps4},#{steps5},#{steps6},#{steps7},#{steps8},#{steps9},#{steps10},#{timeConsuming},#{startTime},#{creationTime},#{purpose},#{teacherName}) + + + + + INSERT INTO hr_experimental_report(projectId, content, principle, step, analysis, summarize, improvement, + commentId, studentId, period, laboratory, className, steps1, steps2, steps3, + steps4, steps5, steps6, steps7, steps8, steps9, steps10, timeConsuming, + startTime, creationTime, purpose, teacherName) + VALUES (#{projectId}, #{content}, #{principle}, #{step}, #{analysis}, #{summarize}, #{improvement}, + #{commentId}, #{studentId}, + #{period}, #{laboratory}, #{className}, #{steps1}, #{steps2}, #{steps3}, #{steps4}, #{steps5}, + #{steps6}, #{steps7}, #{steps8}, #{steps9}, #{steps10}, #{timeConsuming}, #{startTime}, #{creationTime}, + #{purpose}, #{teacherName}) - - UPDATE tms_project_record tpr,hr_experimental_report tcr SET tpr.isdel = 1 , tcr.isdel = 1 WHERE tpr.recordId = tcr.eventId AND tcr.reportId = #{reportId} + + UPDATE tms_project_record tpr,hr_experimental_report tcr + SET tpr.isdel = 1, tcr.isdel = 1 + WHERE tpr.recordId = tcr.eventId AND tcr.reportId = #{reportId} + + + UPDATE tms_experimental_report + SET `comment` = #{comment} + WHERE reportId = #{reportId} - - UPDATE tms_experimental_report SET `comment` = #{comment} WHERE reportId = #{reportId} - - -UPDATE tms_experimental_report SET isSignature = #{isSignature} , signatureId = #{signatureId}, `comment` = #{comment} WHERE reportId = #{reportId} - - + SELECT ter.reportId, + IFNULL(ter.`comment`, (SELECT `comment` FROM tms_comment WHERE id = commentId)) AS comment, + ter.projectId, + ter.principle, + ter.content, + ter.step, + ter.`data`, + ter.analysis, + ter.conclusion, + ter.summarize, + ter.improvement, + ter.commentId, + ter.studentId, + ter.teacherName, + ter.period, + ter.laboratory, + ter.eventId, + ter.isSignature, + ter.signatureId, + ter.isdel, + hpm.projectName, + hpm.systemId, + ts.signature_name AS signatureName, + ts.signature_url AS signatureUrl, + tc.`level` + FROM tms_experimental_report ter + LEFT JOIN tms_signature ts ON signatureId = ts.id + LEFT JOIN tms_comment tc ON commentId = tc.id + LEFT JOIN tms_project_record AS tpr ON tpr.recordId = ter.eventId + LEFT JOIN hr_project_management AS hpm ON hpm.projectId = tpr.projectId + WHERE reportId = #{reportId} + + + + + - + + + + + + - SELECT - u.userName, - sch.schoolName, - s.workNumber, - tpr.score, - tpr.submitTime, - tpr.recordId, - tcr.reportId - FROM - hr_project_management hpm, - hr_user_info u, - student s, - tms_project_record tpr, - tms_experimental_report tcr, - school sch - WHERE - hpm.projectId = tpr.projectId - AND tpr.userId = u.userId - AND u.userId = s.userId - AND sch.schoolId = u.schoolId - AND tcr.eventId = tpr.recordId - AND tpr.isdel = 0 - AND tcr.isdel = 0 - AND u.isdel = 0 - - AND recordId IN ( - - #{recordId} - - ) - - GROUP BY - tcr.reportId - ORDER BY tpr.submitTime DESC - - - - - - - - + AND hjp.isdel = 0 + AND hec.recordId = #{recordId} + GROUP BY hec.codeId + + SELECT hpm.creationTime,hpm.projectId,hpm.projectName,hpm.projectPermissions,hpm.systemId,(SELECT count(*) FROM + hr_experimental_report her where hpm.projectId = her.projectId ) as number + FROM hr_project_management hpm WHERE systemId = #{systemId} + AND hpm.isdel = 0 + AND hpm.projectPermissions = + #{projectPermissions} + + and hpm.projectName like concat('%',#{searchContant},'%') + + and hpm.creationTime between + #{endTime} and #{startTime} + + and DATE_SUB(CURDATE(), INTERVAL #{month} month ) <= + date(hpm.creationTime) + + ORDER BY hpm.creationTime DESC + - + - + - + - + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/ClassTeachingDao.xml b/src/main/resources/mapper/tms/ClassTeachingDao.xml index 8bb0cd6..17756c1 100644 --- a/src/main/resources/mapper/tms/ClassTeachingDao.xml +++ b/src/main/resources/mapper/tms/ClassTeachingDao.xml @@ -27,7 +27,7 @@ AND (user_id in (select userId FROM staff WHERE schoolId = #{cla.schoolId} AND isdel = 0 AND FIND_IN_SET(roleId,'1,2,3') ) OR user_id IN ( SELECT userId FROM hr_user_info WHERE disableAccount = 0 AND isdel = 0 AND FIND_IN_SET( roleId, '1' ) ) ) and `status` = #{cla.status} - and ( project_name like concat('%',#{cla.condition},'%') or experimental_class_name like concat('%',#{cla.condition},'%') ) + and ( experimental_name like concat('%',#{cla.condition},'%') or experimental_class_name like concat('%',#{cla.condition},'%') ) and stop_time between #{cla.endTime} and #{cla.startTime} and DATE_SUB(CURDATE(), INTERVAL #{cla.month} month ) <= date(creation_time) ORDER BY creation_time DESC diff --git a/src/main/resources/mapper/tms/ExperimentalReportDao.xml b/src/main/resources/mapper/tms/ExperimentalReportDao.xml index 6052511..7f087d8 100644 --- a/src/main/resources/mapper/tms/ExperimentalReportDao.xml +++ b/src/main/resources/mapper/tms/ExperimentalReportDao.xml @@ -1,85 +1,75 @@ - - - - - - - + + + + + + + + + - - \ No newline at end of file diff --git a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml index 9add2b8..3891647 100644 --- a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml +++ b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml @@ -31,7 +31,9 @@ AND `status`=#{exp.status,jdbcType=INTEGER} - + + AND `system_id`=#{exp.systemId,jdbcType=INTEGER} + AND creation_time between #{exp.startTime} and #{exp.stopTime} diff --git a/src/main/resources/mapper/tms/ProjectRecordDao.xml b/src/main/resources/mapper/tms/ProjectRecordDao.xml index 3fa668a..5b67e32 100644 --- a/src/main/resources/mapper/tms/ProjectRecordDao.xml +++ b/src/main/resources/mapper/tms/ProjectRecordDao.xml @@ -14,16 +14,16 @@ - + -INSERT INTO tms_project_record ( userId, projectId, score, startingTime, endTime, timeSum, submitTime ) -VALUES - (#{userid}, #{projectid}, #{score}, #{startingtime}, now(), #{timeSum}, now()) + INSERT INTO tms_project_record (userId, projectId, score, startingTime, endTime, timeSum, submitTime) + VALUES (#{userid}, #{projectid}, #{score}, #{startingtime}, now(), #{timeSum}, now()) - + SELECT projectName, + c.recordId, + r.score, + c.codeId, + r.startingTime, + r.submitTime, + r.timeSum, + c.userId + FROM hr_experiment_code c + INNER JOIN hr_project_management t ON t.projectId = c.projectId + INNER JOIN tms_project_record r ON r.recordId = c.recordId + WHERE c.userId = #{userId} + and r.isdel = 0 + and projectPermissions = #{projectPermissions} + GROUP BY c.recordId desc - + SELECT tet.id, + ter.reportId, + tpr.recordId, + tpr.projectId, + projectName, + score, + timeSum, + startingTime as startTime, + endTime, + recordState, + tet.experimental_class_name as experimentalClassName + FROM tms_project_record tpr + LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId + LEFT JOIN tms_experimental_teaching tet ON tet.project_id = tpr.projectId + LEFT JOIN tms_experimental_report ter ON ter.projectId = tet.id + WHERE tpr.userId = #{pro.userid} + AND tpr.isdel = #{pro.isdel} + AND tp.projectPermissions !=0 AND ter.eventId = tpr.recordId ORDER BY - tpr.submitTime DESC + tpr.recordId DESC - + SELECT tpr.projectId, + projectName, + score, + timeSum, + startingTime as startTime, + endTime, + recordState, + tet.experimental_class_name + FROM tms_project_record tpr + LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId + LEFT JOIN tms_experimental_teaching tet ON tpr.projectId = tet.project_id + WHERE tpr.userId = #{userid} + AND tpr.isdel = #{isdel} + AND tpr.projectId = tet.project_id + AND tp.projectPermissions != 0 ORDER BY - tpr.submitTime DESC + tpr.submitTime DESC - + update tms_project_record set isdel = #{isdel} ,recordstate = #{recordstate} @@ -184,6 +189,8 @@ VALUES - UPDATE tms_project_record SET score = #{score} WHERE recordId = #{recordid} + UPDATE tms_project_record + SET score = #{score} + WHERE recordId = #{recordid} \ No newline at end of file diff --git a/src/main/resources/mapper/tms/SysPermissionMapper.xml b/src/main/resources/mapper/tms/SysPermissionMapper.xml new file mode 100644 index 0000000..c7256e9 --- /dev/null +++ b/src/main/resources/mapper/tms/SysPermissionMapper.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/tms/SysRoleMapper.xml b/src/main/resources/mapper/tms/SysRoleMapper.xml new file mode 100644 index 0000000..050e8eb --- /dev/null +++ b/src/main/resources/mapper/tms/SysRoleMapper.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + INSERT INTO sys_role + (`name`,description,create_time,motify_time) + values (#{name},#{description},#{createTime},#{motifyTime}); + + + + UPDATE sys_role + + `name`=#{name}, + description=#{description}, + motify_time=#{motifyTime}, + + WHERE id = #{roleId} + + + + update sys_role set del_or_not = 1 where id IN + + #{item} + + + + diff --git a/src/main/resources/mapper/tms/SysRolePermissionMapper.xml b/src/main/resources/mapper/tms/SysRolePermissionMapper.xml new file mode 100644 index 0000000..17949cd --- /dev/null +++ b/src/main/resources/mapper/tms/SysRolePermissionMapper.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + INSERT INTO sys_role_permission (role_id,permission_id) values + + (#{item.roleId},#{item.permissionId}) + + + + + delete from sys_role_permission where role_id in + + #{item} + + + + + delete from sys_role_permission where role_id=#{roleId} + + + + + diff --git a/src/main/resources/mapper/tms/SysUserRoleMapper.xml b/src/main/resources/mapper/tms/SysUserRoleMapper.xml new file mode 100644 index 0000000..b4f032e --- /dev/null +++ b/src/main/resources/mapper/tms/SysUserRoleMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/tms/SystemSetting.xml b/src/main/resources/mapper/tms/SystemSetting.xml index a48e684..86f6802 100644 --- a/src/main/resources/mapper/tms/SystemSetting.xml +++ b/src/main/resources/mapper/tms/SystemSetting.xml @@ -96,12 +96,14 @@ s.staffId, s.workNumber, s.staffProfessionalArchitectureId, - s.staffProfessionalArchitectureName, + spa.staffProfessionalArchitectureName, s.staffGradeId, - s.staffGradeName + sg.staffGradeName FROM hr_user_info u LEFT JOIN staff s ON u.userId = s.userId + LEFT JOIN staff_professional_architecture spa on spa.staffProfessionalArchitectureId = s.staffProfessionalArchitectureId + LEFT JOIN staff_grade sg on sg.staffGradeId = s.staffGradeId WHERE s.schoolId = #{schoolId} AND @@ -109,8 +111,8 @@ AND s.isdel=0 AND (u.userName LIKE CONCAT('%',#{searchContent},'%') OR s.workNumber LIKE CONCAT('%',#{searchContent},'%') OR u.account LIKE CONCAT('%',#{searchContent},'%') ) - AND FIND_IN_SET(staffGradeId,#{staffGradeIds}) - AND FIND_IN_SET(staffProfessionalArchitectureId,#{staffProfessionalArchitectureIds}) + AND FIND_IN_SET(s.staffGradeId,#{staffGradeIds}) + AND FIND_IN_SET(s.staffProfessionalArchitectureId,#{staffProfessionalArchitectureIds}) GROUP BY s.userId ORDER BY u.updateTime DESC,u.lastLoginTime DESC,creationTime DESC