Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/test/java/com/msdw/tms/service/AchievementManagementTest.java
hehai
zhiyong.ning 4 years ago
commit 2e0414c791
  1. 118
      .mvn/wrapper/MavenWrapperDownloader.java
  2. BIN
      .mvn/wrapper/maven-wrapper.jar
  3. 2
      .mvn/wrapper/maven-wrapper.properties
  4. 3
      README.md
  5. 13
      pom.xml
  6. 4
      src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java
  7. 13
      src/main/java/com/msdw/tms/common/exception/ExceptionCatch.java
  8. 12
      src/main/java/com/msdw/tms/controller/ClassTeachingController.java
  9. 12
      src/main/java/com/msdw/tms/controller/ExperimentalProjectController.java
  10. 25
      src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java
  11. 156
      src/main/java/com/msdw/tms/controller/SysPermissionController.java
  12. 14
      src/main/java/com/msdw/tms/controller/SystemSettingController.java
  13. 5
      src/main/java/com/msdw/tms/dao/ProjectRecordDao.java
  14. 22
      src/main/java/com/msdw/tms/dao/SysPermissionMapper.java
  15. 28
      src/main/java/com/msdw/tms/dao/SysRoleMapper.java
  16. 31
      src/main/java/com/msdw/tms/dao/SysRolePermissionMapper.java
  17. 22
      src/main/java/com/msdw/tms/dao/SysUserRoleMapper.java
  18. 2
      src/main/java/com/msdw/tms/entity/ExperimentalTeachingEntity.java
  19. 100
      src/main/java/com/msdw/tms/entity/SysPermission.java
  20. 60
      src/main/java/com/msdw/tms/entity/SysRole.java
  21. 39
      src/main/java/com/msdw/tms/entity/SysRolePermission.java
  22. 39
      src/main/java/com/msdw/tms/entity/SysUserRole.java
  23. 5
      src/main/java/com/msdw/tms/entity/UserInfoEntity.java
  24. 83
      src/main/java/com/msdw/tms/entity/request/RolePermissionRequest.java
  25. 89
      src/main/java/com/msdw/tms/entity/resp/GetByUserRecordResp.java
  26. 3
      src/main/java/com/msdw/tms/entity/response/CommonCode.java
  27. 54
      src/main/java/com/msdw/tms/entity/response/ResponseResult.java
  28. 80
      src/main/java/com/msdw/tms/entity/response/RolePermissionResponse.java
  29. 2
      src/main/java/com/msdw/tms/entity/vo/ExperimentalTeachingVO.java
  30. 45
      src/main/java/com/msdw/tms/service/ISysPermissionService.java
  31. 16
      src/main/java/com/msdw/tms/service/ISysRolePermissionService.java
  32. 16
      src/main/java/com/msdw/tms/service/ISysRoleService.java
  33. 16
      src/main/java/com/msdw/tms/service/ISysUserRoleService.java
  34. 2
      src/main/java/com/msdw/tms/service/ProjectRecordService.java
  35. 2
      src/main/java/com/msdw/tms/service/SystemSetttingService.java
  36. 10
      src/main/java/com/msdw/tms/service/impl/ExperimentalReportServiceImpl.java
  37. 11
      src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java
  38. 6
      src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java
  39. 127
      src/main/java/com/msdw/tms/service/impl/SysPermissionServiceImpl.java
  40. 20
      src/main/java/com/msdw/tms/service/impl/SysRolePermissionServiceImpl.java
  41. 20
      src/main/java/com/msdw/tms/service/impl/SysRoleServiceImpl.java
  42. 20
      src/main/java/com/msdw/tms/service/impl/SysUserRoleServiceImpl.java
  43. 15
      src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java
  44. 115
      src/main/java/com/msdw/tms/util/MyBatisPlusCodeGenerator.java
  45. 216
      src/main/resources/mapper/tms/AchievementManagementDao.xml
  46. 2
      src/main/resources/mapper/tms/ClassTeachingDao.xml
  47. 30
      src/main/resources/mapper/tms/ExperimentalReportDao.xml
  48. 4
      src/main/resources/mapper/tms/ExperimentalTeachingDao.xml
  49. 109
      src/main/resources/mapper/tms/ProjectRecordDao.xml
  50. 36
      src/main/resources/mapper/tms/SysPermissionMapper.xml
  51. 40
      src/main/resources/mapper/tms/SysRoleMapper.xml
  52. 38
      src/main/resources/mapper/tms/SysRolePermissionMapper.xml
  53. 19
      src/main/resources/mapper/tms/SysUserRoleMapper.xml
  54. 10
      src/main/resources/mapper/tms/SystemSetting.xml
  55. 277
      src/test/java/com/msdw/tms/service/AchievementManagementTest.java

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

Binary file not shown.

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

@ -1,3 +0,0 @@
# msdw_tms
测评管理系统

@ -225,6 +225,19 @@
<artifactId>pagehelper</artifactId> <artifactId>pagehelper</artifactId>
<version>5.1.2</version> <version>5.1.2</version>
</dependency> </dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.28</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

@ -2,12 +2,9 @@ package com.msdw.tms.api;
import com.msdw.tms.common.utils.R; import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.ExperimentalTeachingEntity; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import java.text.ParseException; import java.text.ParseException;
@ -20,6 +17,7 @@ public interface ExperimentalTeachingControllerApi {
@ApiParam(name = "month", value = "月份:1、近一个月内 3、近三个月内 6、近六个月内", required = false) Integer month, @ApiParam(name = "month", value = "月份:1、近一个月内 3、近三个月内 6、近六个月内", required = false) Integer month,
@ApiParam(name = "type", value = "类型:1、手动发布 2、定时发布", required = false) Integer type, @ApiParam(name = "type", value = "类型:1、手动发布 2、定时发布", required = false) Integer type,
@ApiParam(name = "status", value = "状态:1、待开始 2、进行中 3、已结束", required = false) Integer status, @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 = "startTime", value = "开始时间", required = false) String startTime,
@ApiParam(name = "stopTime", value = "结束时间", required = false) String stopTime, @ApiParam(name = "stopTime", value = "结束时间", required = false) String stopTime,
@ApiParam(name = "searchContent", value = "搜索内容", required = false) String searchContent, @ApiParam(name = "searchContent", value = "搜索内容", required = false) String searchContent,

@ -7,6 +7,7 @@ import com.msdw.tms.entity.response.ResultCode;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.converter.HttpMessageNotReadableException; 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.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -59,4 +60,16 @@ public class ExceptionCatch {
ResultCode resultCode = customException.getResultCode(); ResultCode resultCode = customException.getResultCode();
return new ResponseResult(resultCode); 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);
}
} }

@ -60,7 +60,8 @@ public class ClassTeachingController implements ClassTeachingApi {
recordVo.setMonth(null); recordVo.setMonth(null);
if (!StringUtils.isEmpty(startTime)) { if (!StringUtils.isEmpty(startTime)) {
recordVo.setStartTime(startTime); recordVo.setStartTime(startTime);
}if(!StringUtils.isEmpty(endTime)) { }
if (!StringUtils.isEmpty(endTime)) {
recordVo.setEndTime(endTime); recordVo.setEndTime(endTime);
} }
} }
@ -71,6 +72,7 @@ public class ClassTeachingController implements ClassTeachingApi {
/** /**
* 校验是否需要输入邀请码 * 校验是否需要输入邀请码
*
* @param userId * @param userId
* @param projectId * @param projectId
* @return * @return
@ -88,6 +90,7 @@ public class ClassTeachingController implements ClassTeachingApi {
/** /**
* 通过邀请码进入实验 * 通过邀请码进入实验
*
* @param * @param
* @return * @return
*/ */
@ -125,6 +128,7 @@ public class ClassTeachingController implements ClassTeachingApi {
/** /**
* 查看虚拟仿真课程列表信息 * 查看虚拟仿真课程列表信息
*
* @param page * @param page
* @param size * @param size
* @return * @return
@ -137,7 +141,8 @@ public class ClassTeachingController implements ClassTeachingApi {
} }
/** /**
* 学生查看实验报告 * 学生查看实验报告(教学)
*
* @param * @param
* @return * @return
*/ */
@ -151,7 +156,8 @@ public class ClassTeachingController implements ClassTeachingApi {
} }
/** /**
* 学生查看虚拟实验报告 * 学生查看虚拟实验报告(虚仿)
*
* @param * @param
* @return * @return
*/ */

@ -2,26 +2,16 @@ package com.msdw.tms.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.msdw.tms.api.ExperimentalProjectControllerApi; 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.Constant;
import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.R; import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.ExperimentalProjectEntity; 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.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.ExperimentalProjectService;
import com.msdw.tms.service.UserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping("tms/project") @RequestMapping("tms/project")
@ -40,7 +30,7 @@ public class ExperimentalProjectController implements ExperimentalProjectControl
return R.ok().put("experimental_project_name", one); return R.ok().put("experimental_project_name", one);
} }
/** /**nm
* 根据id查询实验班级详情 * 根据id查询实验班级详情
*/ */
@GetMapping("/getById/{id}") @GetMapping("/getById/{id}")

@ -2,24 +2,20 @@ package com.msdw.tms.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.msdw.tms.api.ExperimentalTeachingControllerApi; 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.Constant;
import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.R; import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.ExperimentalTeachingEntity; 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.ExperimentalTeachingVO;
import com.msdw.tms.entity.vo.UserEntityVo;
import com.msdw.tms.service.ExperimentalTeachingService; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
@RestController @RestController
@RequestMapping("tms/exp") @RequestMapping("tms/exp")
@ -32,6 +28,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr
/** /**
* 根据id查询实验班级详情 * 根据id查询实验班级详情
*/ */
@Override
@GetMapping("/getById/{id}") @GetMapping("/getById/{id}")
public R getById(@PathVariable("id") Integer id){ public R getById(@PathVariable("id") Integer id){
ExperimentalTeachingEntity et = experimentalTeachingService.getById(id); ExperimentalTeachingEntity et = experimentalTeachingService.getById(id);
@ -40,6 +37,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr
/** /**
* 根据邀请码查询 * 根据邀请码查询
*/ */
@Override
@GetMapping("/getInvitationCode") @GetMapping("/getInvitationCode")
public R getInvitationCode(@RequestParam Integer invitationCode) { public R getInvitationCode(@RequestParam Integer invitationCode) {
ExperimentalTeachingEntity one = experimentalTeachingService.getOne(new QueryWrapper<ExperimentalTeachingEntity>().eq("invitation_code", invitationCode) ExperimentalTeachingEntity one = experimentalTeachingService.getOne(new QueryWrapper<ExperimentalTeachingEntity>().eq("invitation_code", invitationCode)
@ -49,15 +47,19 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr
/** /**
* 查询 * 查询
*/ */
@Override
@GetMapping("/list") @GetMapping("/list")
public R list(@RequestParam Integer page, public R list(@RequestParam Integer page, @RequestParam Integer size,
@RequestParam Integer size, Integer month, Integer type, Integer status,Integer systemId, String startTime,
Integer month, Integer type, Integer status, String startTime, String stopTime, String searchContent,@RequestParam Integer schoolId){ String stopTime, String searchContent,@RequestParam Integer schoolId){
ExperimentalTeachingVO vo = new ExperimentalTeachingVO(); ExperimentalTeachingVO vo = new ExperimentalTeachingVO();
vo.setSchoolId(schoolId); vo.setSchoolId(schoolId);
if (month!=null){ if (month!=null){
vo.setMonth(month); vo.setMonth(month);
} }
if (systemId!=null){
vo.setSystemId(systemId);
}
if (type!=null){ if (type!=null){
vo.setType(type); vo.setType(type);
} }
@ -80,6 +82,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr
/** /**
* 保存 * 保存
*/ */
@Override
@PostMapping("/save") @PostMapping("/save")
public R save(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity){ public R save(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity){
experimentalTeachingService.save(experimentalTeachingEntity); experimentalTeachingService.save(experimentalTeachingEntity);
@ -89,6 +92,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr
/** /**
* 修改 * 修改
*/ */
@Override
@PostMapping("/update") @PostMapping("/update")
public R update(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity) throws ParseException { public R update(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity) throws ParseException {
//添加实验结束时间 //添加实验结束时间
@ -117,6 +121,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr
/** /**
* 删除 * 删除
*/ */
@Override
@PostMapping("/delete") @PostMapping("/delete")
public R delete(@RequestBody Integer[] ids){ public R delete(@RequestBody Integer[] ids){
experimentalTeachingService.removeByIds(Arrays.asList(ids)); experimentalTeachingService.removeByIds(Arrays.asList(ids));

@ -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;
/**
* <p>
* 菜单权限表 前端控制器
* </p>
*
* @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<SysPermission> list = permissionService.listWithTree();
return new ResponseResult<List<SysPermission>>().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<Long> asList = Arrays.asList(rolePermission.getPermissionIds());
List<RolePermissionRequest> rolePermissionList = getRolePermissionList(asList, rolePermission.getRoleId());
boolean result = permissionService.addHrmsRolePermission(rolePermissionList);
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
}
private List<RolePermissionRequest> getRolePermissionList(List<Long> 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<Long> asList = Arrays.asList(rolePermission.getPermissionIds());
permissionService.deleteHrmsRolePermission(rolePermission.getRoleId());
//根据选中的permissionId批量新增数据到hrms_role_permission
List<RolePermissionRequest> 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<SysRolePermission> list = permissionService.queryPermissionArrById(roleId);
ArrayList<Integer> sb = new ArrayList<Integer>();
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<List<RolePermissionResponse>>().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<PageUtils>().SUCCESS(data);
}
}

@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -32,7 +33,7 @@ public class SystemSettingController implements SystemSetttingApi {
*/ */
@Override @Override
@PostMapping("/addStaff") @PostMapping("/addStaff")
public R addStaff(@RequestBody StaffVo staffVo){ public R addStaff(@RequestBody @Valid StaffVo staffVo){
R r = systemSetttingService.addStaff(staffVo); R r = systemSetttingService.addStaff(staffVo);
return r; return r;
} }
@ -153,4 +154,15 @@ public class SystemSettingController implements SystemSetttingApi {
R result = systemSetttingService.queryAccount(account,schoolId); R result = systemSetttingService.queryAccount(account,schoolId);
return result; return result;
} }
/**
* 重置密码
* @param userId
* @return
*/
@GetMapping("/resetPwd")
public R resetPwd(@RequestParam Integer userId,String newPwd){
R r = systemSetttingService.resetPwd(userId,newPwd);
return r;
}
} }

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.msdw.tms.entity.ExperimentalProjectEntity; import com.msdw.tms.entity.ExperimentalProjectEntity;
import com.msdw.tms.entity.ExperimentalReportEntity; import com.msdw.tms.entity.ExperimentalReportEntity;
import com.msdw.tms.entity.ProjectRecordEntity; 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.ProjectRecordExportVo;
import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.entity.vo.RecordVo; import com.msdw.tms.entity.vo.RecordVo;
@ -15,8 +16,6 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
*
*
* @author * @author
* @email * @email
* @date 2020-08-19 16:07:02 * @date 2020-08-19 16:07:02
@ -24,7 +23,7 @@ import java.util.List;
@Mapper @Mapper
public interface ProjectRecordDao extends BaseMapper<ProjectRecordEntity> { public interface ProjectRecordDao extends BaseMapper<ProjectRecordEntity> {
IPage<ProjectRecordVo> getByUserRecord(Page page,@Param("pro") ProjectRecordEntity projectRecordEntity,Integer projectPermissions); IPage<GetByUserRecordResp> getByUserRecord(Page page, @Param("userId") Integer userId, @Param("projectPermissions") Integer projectPermissions);
IPage<ProjectRecordVo> getByUserExperimentRecord(Page page, @Param("pro") ProjectRecordEntity projectRecordEntity); IPage<ProjectRecordVo> getByUserExperimentRecord(Page page, @Param("pro") ProjectRecordEntity projectRecordEntity);

@ -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;
/**
* <p>
* 菜单权限表 Mapper 接口
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
@Mapper
public interface SysPermissionMapper extends BaseMapper<SysPermission> {
IPage<RolePermissionResponse> pageByCondition(Page page,String name);
}

@ -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;
/**
* <p>
* 用户角色表 Mapper 接口
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
@Mapper
public interface SysRoleMapper extends BaseMapper<SysRole> {
int addHrmsRole(RolePermissionRequest rolePermission);
int updateHrmsRole(RolePermissionRequest rolePermission);
boolean deleteHrmsRoleByRoleId(@Param("roleIds") List<Long> roleIds);
}

@ -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;
/**
* <p>
* 角色权限中间表 Mapper 接口
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
@Mapper
public interface SysRolePermissionMapper extends BaseMapper<SysRolePermission> {
int uniqueRoleName(String name);
boolean addHrmsRolePermission(@Param("rolePermissionList") List<RolePermissionRequest> rolePermissionList);
boolean deleteHrmsRolePermission(@Param("roleIds") List<Long> roleIds);
boolean deleteHrmsRolePermissionSingle(Long roleId);
List<SysRolePermission> queryPermissionArrById(Long roleId);
}

@ -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;
/**
* <p>
* 用户角色中间表 Mapper 接口
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
@Mapper
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
int queryCountByRoleId(@Param("roleIds") List<Long> roleIds);
}

@ -45,6 +45,8 @@ public class ExperimentalTeachingEntity {
private Integer isCode; private Integer isCode;
//绑定用户Id //绑定用户Id
private Integer userId; private Integer userId;
//绑定系统Id
private Integer systemId;
//创建时间 //创建时间
private String creationTime; private String creationTime;
//实验倒计时 //实验倒计时

@ -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;
/**
* <p>
* 菜单权限表
* </p>
*
* @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;
/**
* 是否是菜单10不是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<SysPermission> children;
}

@ -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;
/**
* <p>
* 用户角色表
* </p>
*
* @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;
}

@ -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;
/**
* <p>
* 角色权限中间表
* </p>
*
* @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;
}

@ -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;
/**
* <p>
* 用户角色中间表
* </p>
*
* @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;
}

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import javax.validation.constraints.Pattern;
@Accessors(chain = true) @Accessors(chain = true)
@Data @Data
@TableName("hr_user_info") @TableName("hr_user_info")
@ -15,6 +17,7 @@ public class UserInfoEntity {
//用户姓名 //用户姓名
private String userName; private String userName;
//用户账号 //用户账号
@Pattern(regexp = "/^[1-9]([0-9]{1,5})?$/", message = "账号只能为数字!")
private String account; private String account;
//用户密码 //用户密码
private String password; private String password;
@ -60,4 +63,6 @@ public class UserInfoEntity {
private Integer schoolAppellationId; private Integer schoolAppellationId;
//token //token
private String token; private String token;
//最后登录时间
private String lastLoginTime;
} }

@ -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<RolePermissionRequest> children;
/**
* 排序
*/
private Integer sort;
}

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

@ -18,6 +18,9 @@ public enum CommonCode implements ResultCode {
REPEAT_INEXCEL(false, 10010, "试题在excel表中重复!"), REPEAT_INEXCEL(false, 10010, "试题在excel表中重复!"),
EVALUATION_QUESTION_NUM_INVALID(false, 10011, "当前测评题数设置为0,请先设置测评题数!"), EVALUATION_QUESTION_NUM_INVALID(false, 10011, "当前测评题数设置为0,请先设置测评题数!"),
FAIL(false, 11111, "操作失败!"), FAIL(false, 11111, "操作失败!"),
ROLE_NAME_EXIST(false,20001,"该角色名称已存在,请重新输入!"),
ROLE_EMP_EXIST(false,44001,"该角色有用户关联,不能删除!"),
SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"); SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!");
//操作是否成功 //操作是否成功
boolean success; boolean success;

@ -1,22 +1,46 @@
package com.msdw.tms.entity.response; package com.msdw.tms.entity.response;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
/**
* @Author: gongsj.
* @Description: 统一返回的结果集
* @Date:Created in 2020/09/07 12:28.
* @Modified By:
*/
@Data @Data
@ToString @ToString
@NoArgsConstructor @NoArgsConstructor
public class ResponseResult implements Response { @AllArgsConstructor
public class ResponseResult<T> {
/**
* 操作是否成功
*/
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) { public ResponseResult(ResultCode resultCode) {
this.success = resultCode.success(); this.success = resultCode.success();
@ -28,8 +52,24 @@ public class ResponseResult implements Response {
return new ResponseResult(CommonCode.SUCCESS); 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() { public static ResponseResult FAIL() {
return new ResponseResult(CommonCode.FAIL); return new ResponseResult(CommonCode.FAIL);
} }
public static ResponseResult FAIL(int code, String message) {
return new ResponseResult<>(false, code, null, message);
}
} }

@ -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<RolePermissionResponse> children;
/**
* 排序
*/
@ApiModelProperty("子权限")
private Integer sort;
/**
* 权限标识
*/
private String code;
private boolean disabled=true;
}

@ -18,4 +18,6 @@ public class ExperimentalTeachingVO {
private Integer status; private Integer status;
//学校id //学校id
private Integer schoolId; private Integer schoolId;
//绑定系统Id
private Integer systemId;
} }

@ -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;
/**
* <p>
* 菜单权限表 服务类
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
public interface ISysPermissionService extends IService<SysPermission> {
List<SysPermission> listWithTree();
int uniqueRoleName(String name);
int addHrmsRole(RolePermissionRequest rolePermission);
boolean addHrmsRolePermission(List<RolePermissionRequest> rolePermissionList);
int updateHrmsRole(RolePermissionRequest rolePermission);
boolean deleteHrmsRolePermission(Long roleId);
boolean deleteHrmsRolePermission(Long[] roleIds);
int queryCountByRoleId(Long[] roleIds);
boolean deleteHrmsRoleByRoleId(Long[] roleIds);
List<SysRolePermission> queryPermissionArrById(Long roleId);
SysRole queryRoleMsg(Long roleId);
PageUtils queryPage(Integer page, Integer size, String name);
}

@ -0,0 +1,16 @@
package com.msdw.tms.service;
import com.msdw.tms.entity.SysRolePermission;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 角色权限中间表 服务类
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
public interface ISysRolePermissionService extends IService<SysRolePermission> {
}

@ -0,0 +1,16 @@
package com.msdw.tms.service;
import com.msdw.tms.entity.SysRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 用户角色表 服务类
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
public interface ISysRoleService extends IService<SysRole> {
}

@ -0,0 +1,16 @@
package com.msdw.tms.service;
import com.msdw.tms.entity.SysUserRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 用户角色中间表 服务类
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
public interface ISysUserRoleService extends IService<SysUserRole> {
}

@ -11,8 +11,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
*
*
* @author * @author
* @email * @email
* @date 2020-08-19 16:07:02 * @date 2020-08-19 16:07:02

@ -34,4 +34,6 @@ public interface SystemSetttingService {
void downloadFiles(HttpServletResponse response) throws IOException; void downloadFiles(HttpServletResponse response) throws IOException;
R queryAccount(String account,Integer schoolId); R queryAccount(String account,Integer schoolId);
R resetPwd(Integer userId,String newPwd);
} }

@ -23,6 +23,15 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
@Autowired @Autowired
private AchievementManagementDao achievementManagementDao; private AchievementManagementDao achievementManagementDao;
/**
* 学生查看实验报告(教学)
*
* @param studentId
* @param projectId
* @param recordId
* @param reportId
* @return
*/
@Override @Override
public R queryReport(Integer studentId, Integer projectId, Integer recordId, Integer reportId) { public R queryReport(Integer studentId, Integer projectId, Integer recordId, Integer reportId) {
Integer systemId = reportDao.querySystemId(recordId); Integer systemId = reportDao.querySystemId(recordId);
@ -40,6 +49,7 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
return R.ok().put("data", map); return R.ok().put("data", map);
} }
//虚拟实验
@Override @Override
public R queryVirtualReport(Integer recordId) { public R queryVirtualReport(Integer recordId) {
ExperimentalReportVo result = reportDao.queryVirtualReport(recordId); ExperimentalReportVo result = reportDao.queryVirtualReport(recordId);

@ -1,31 +1,20 @@
package com.msdw.tms.service.impl; 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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.PageUtils;
import com.msdw.tms.common.utils.Query;
import com.msdw.tms.dao.ClassTeachingDao; import com.msdw.tms.dao.ClassTeachingDao;
import com.msdw.tms.dao.ExperimentalTeachingDao; import com.msdw.tms.dao.ExperimentalTeachingDao;
import com.msdw.tms.dao.UserDao;
import com.msdw.tms.entity.ExperimentalTeachingEntity; 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.ExperimentalTeachingVO;
import com.msdw.tms.entity.vo.ProjectRecordVo; 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.ExperimentalTeachingService;
import com.msdw.tms.service.UserService;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
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 java.util.List;
import java.util.Map;
@Service("experimentalTeachingService") @Service("experimentalTeachingService")
public class ExperimentalTeachingServiceImpl extends ServiceImpl<ExperimentalTeachingDao, ExperimentalTeachingEntity> implements ExperimentalTeachingService { public class ExperimentalTeachingServiceImpl extends ServiceImpl<ExperimentalTeachingDao, ExperimentalTeachingEntity> implements ExperimentalTeachingService {

@ -12,6 +12,7 @@ import com.msdw.tms.entity.ExperimentalReportEntity;
import com.msdw.tms.entity.ProjectRecordEntity; import com.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.request.ExperimentProjectRecordImportRequest; import com.msdw.tms.entity.request.ExperimentProjectRecordImportRequest;
import com.msdw.tms.entity.request.ProjectRecordImportRequest; 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.ProjectRecordExportVo;
import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.service.ProjectRecordService; import com.msdw.tms.service.ProjectRecordService;
@ -39,12 +40,13 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
@Override @Override
public PageUtils queryPage(Integer page, Integer size, Integer userId, Integer projectPermissions) { public PageUtils queryPage(Integer page, Integer size, Integer userId, Integer projectPermissions) {
ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userId); /*GetByUserRecordResp projectRecord = new GetByUserRecordResp();
projectRecord.setUserId(userId);*/
//分页对象 //分页对象
Page<T> page1 = new Page<>(page, size); Page<T> page1 = new Page<>(page, size);
IPage<ProjectRecordVo> projectRecordVos = this.baseMapper.getByUserRecord(page1,projectRecord,projectPermissions); IPage<GetByUserRecordResp> projectRecordVos = this.baseMapper.getByUserRecord(page1, userId, projectPermissions);
PageUtils questionsPage = new PageUtils(projectRecordVos); PageUtils questionsPage = new PageUtils(projectRecordVos);

@ -0,0 +1,127 @@
package com.msdw.tms.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.dao.SysPermissionMapper;
import com.msdw.tms.dao.SysRoleMapper;
import com.msdw.tms.dao.SysRolePermissionMapper;
import com.msdw.tms.dao.SysUserRoleMapper;
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.RolePermissionResponse;
import com.msdw.tms.service.ISysPermissionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 菜单权限表 服务实现类
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
@Service
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements ISysPermissionService {
@Resource
private SysRolePermissionMapper rolePermissionMapper;
@Resource
private SysRoleMapper roleMapper;
@Resource
private SysUserRoleMapper userRoleMapper;
@Override
public List<SysPermission> listWithTree() {
/* List<SysPermission>list = this.getBaseMapper().queryPermissionTree();
return getPermissionTreeList(list,0L);*/
System.out.println("this.list()=================="+this.list());
return getPermissionTreeList(this.list(), 0L);
}
private List<SysPermission> getPermissionTreeList(List<SysPermission> 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<RolePermissionRequest> 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<SysRolePermission> 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<RolePermissionResponse> systemLogVo = this.getBaseMapper().pageByCondition(new Page(page, size),name);
return new PageUtils(systemLogVo);
}
}

@ -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;
/**
* <p>
* 角色权限中间表 服务实现类
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
@Service
public class SysRolePermissionServiceImpl extends ServiceImpl<SysRolePermissionMapper, SysRolePermission> implements ISysRolePermissionService {
}

@ -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;
/**
* <p>
* 用户角色表 服务实现类
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
}

@ -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;
/**
* <p>
* 用户角色中间表 服务实现类
* </p>
*
* @author Qyq
* @since 2021-02-24
*/
@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {
}

@ -2,6 +2,7 @@ package com.msdw.tms.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference; 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.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -497,4 +498,18 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
} }
return R.ok(); 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<UserInfoEntity>().eq("userId", userId));
if(count > 0){
return R.ok();
}else{
return R.error(20002,"重置失败");
}
}
} }

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

@ -40,14 +40,30 @@
</resultMap> </resultMap>
<select id="getReport" resultMap="BaseResultMap" parameterType="com.msdw.tms.entity.ExperimentalReportEntity"> <select id="getReport" resultMap="BaseResultMap" parameterType="com.msdw.tms.entity.ExperimentalReportEntity">
SELECT her.*,pm.projectName,s.workNumber FROM SELECT her.*, pm.projectName, s.workNumber
hr_experimental_report her,hr_project_management pm,student s FROM hr_experimental_report her,
WHERE her.reportId = #{reportId} and her.studentId = #{studentId} and her.projectId = pm.projectId and her.studentId = s.userId hr_project_management pm,
student s
WHERE her.reportId = #{reportId}
and her.studentId = #{studentId}
and her.projectId = pm.projectId
and her.studentId = s.userId
</select> </select>
<select id="getScore" resultType="com.msdw.tms.entity.vo.UserScoreVO" parameterType="com.msdw.tms.entity.vo.UserScoreVO"> <select id="getScore" resultType="com.msdw.tms.entity.vo.UserScoreVO"
SELECT id,score,tradingJudgmentPointsId,projectId,systemId,userId,isCorrect,reportId,userAnswers parameterType="com.msdw.tms.entity.vo.UserScoreVO">
FROM hr_user_score WHERE reportId = #{reportId} and userId = #{userId} SELECT id,
score,
tradingJudgmentPointsId,
projectId,
systemId,
userId,
isCorrect,
reportId,
userAnswers
FROM hr_user_score
WHERE reportId = #{reportId}
and userId = #{userId}
</select> </select>
<!-- <resultMap id="achievementMap" type="com.msdw.tms.entity.ExperimentalReportEntity">--> <!-- <resultMap id="achievementMap" type="com.msdw.tms.entity.ExperimentalReportEntity">-->
@ -55,25 +71,36 @@
<!-- </resultMap>--> <!-- </resultMap>-->
<insert id="addReport" useGeneratedKeys="true" keyProperty="reportId"> <insert id="addReport" useGeneratedKeys="true" keyProperty="reportId">
INSERT INTO hr_experimental_report(projectId, content, principle, step, analysis, summarize, improvement, 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) commentId, studentId, period, laboratory, className, steps1, steps2, steps3,
VALUES steps4, steps5, steps6, steps7, steps8, steps9, steps10, timeConsuming,
(#{projectId},#{content}, #{principle}, #{step}, #{analysis}, #{summarize}, #{improvement}, #{commentId}, #{studentId}, startTime, creationTime, purpose, teacherName)
#{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> </insert>
<update id="deleteReport"> <update id="deleteReport">
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> </update>
<update id="updateComment"> <update id="updateComment">
UPDATE tms_experimental_report SET `comment` = #{comment} WHERE reportId = #{reportId} UPDATE tms_experimental_report
SET `comment` = #{comment}
WHERE reportId = #{reportId}
</update> </update>
<update id="updateSignatrue"> <update id="updateSignatrue">
UPDATE tms_experimental_report SET isSignature = #{isSignature} , signatureId = #{signatureId}, `comment` = #{comment} WHERE reportId = #{reportId} UPDATE tms_experimental_report
SET isSignature = #{isSignature},
signatureId = #{signatureId},
`comment` = #{comment}
WHERE reportId = #{reportId}
</update> </update>
<select id="queryReport" resultType="com.msdw.tms.entity.vo.AchievementManagementVO"> <select id="queryReport" resultType="com.msdw.tms.entity.vo.AchievementManagementVO">
SELECT SELECT ter.reportId,
ter.reportId,
IFNULL(ter.`comment`, (SELECT `comment` FROM tms_comment WHERE id = commentId)) AS comment, IFNULL(ter.`comment`, (SELECT `comment` FROM tms_comment WHERE id = commentId)) AS comment,
ter.projectId, ter.projectId,
ter.principle, ter.principle,
@ -98,14 +125,12 @@ SELECT
ts.signature_name AS signatureName, ts.signature_name AS signatureName,
ts.signature_url AS signatureUrl, ts.signature_url AS signatureUrl,
tc.`level` tc.`level`
FROM FROM tms_experimental_report ter
tms_experimental_report ter
LEFT JOIN tms_signature ts ON signatureId = ts.id LEFT JOIN tms_signature ts ON signatureId = ts.id
LEFT JOIN tms_comment tc ON commentId = tc.id LEFT JOIN tms_comment tc ON commentId = tc.id
LEFT JOIN tms_project_record AS tpr ON tpr.recordId = ter.eventId LEFT JOIN tms_project_record AS tpr ON tpr.recordId = ter.eventId
LEFT JOIN hr_project_management AS hpm ON hpm.projectId = tpr.projectId LEFT JOIN hr_project_management AS hpm ON hpm.projectId = tpr.projectId
WHERE WHERE reportId = #{reportId}
reportId = #{reportId}
</select> </select>
<select id="queryEvaluationReport" resultType="com.msdw.tms.entity.vo.AchievementManagementVO"> <select id="queryEvaluationReport" resultType="com.msdw.tms.entity.vo.AchievementManagementVO">
SELECT SELECT
@ -133,7 +158,9 @@ WHERE
AND tcr.isdel = 0 AND tcr.isdel = 0
AND u.isdel = 0 AND u.isdel = 0
AND tpr.projectId = #{projectId} AND tpr.projectId = #{projectId}
<if test="searchContant!=null and searchContant!=''"> AND (sch.schoolName LIKE CONCAT('%',#{searchContant},'%') OR u.userName LIKE CONCAT('%',#{searchContant},'%') )</if> <if test="searchContant!=null and searchContant!=''">AND (sch.schoolName LIKE CONCAT('%',#{searchContant},'%')
OR u.userName LIKE CONCAT('%',#{searchContant},'%') )
</if>
GROUP BY GROUP BY
tcr.reportId tcr.reportId
ORDER BY tpr.submitTime DESC ORDER BY tpr.submitTime DESC
@ -193,15 +220,21 @@ WHERE
AND tcr.isdel = 0 AND tcr.isdel = 0
AND hpm.projectPermissions = 0 AND hpm.projectPermissions = 0
<if test="systemId!=null and systemId!=''">AND hpm.systemId = #{systemId}</if> <if test="systemId!=null and systemId!=''">AND hpm.systemId = #{systemId}</if>
<if test="searchContant!=null and searchContant!=''"> and hpm.projectName like concat('%',#{searchContant},'%')</if> <if test="searchContant!=null and searchContant!=''">and hpm.projectName like concat('%',#{searchContant},'%')
<if test="startingtime!=null and startingtime!='' and endtime!=null and endtime != ''"> and hpm.creationTime between #{endtime} and #{startingtime}</if> </if>
<if test="month!=null and month != ''">and DATE_SUB(CURDATE(), INTERVAL #{month} month ) &lt;= date(hpm.creationTime)</if> <if test="startingtime!=null and startingtime!='' and endtime!=null and endtime != ''">and hpm.creationTime
between #{endtime} and #{startingtime}
</if>
<if test="month!=null and month != ''">and DATE_SUB(CURDATE(), INTERVAL #{month} month ) &lt;=
date(hpm.creationTime)
</if>
<if test="projectIds.size!=null"> <if test="projectIds.size!=null">
AND tpr.projectId IN ( AND tpr.projectId IN (
<foreach collection="projectIds" separator="," item="projectId"> <foreach collection="projectIds" separator="," item="projectId">
#{projectId} #{projectId}
</foreach> </foreach>
) </if> )
</if>
GROUP BY GROUP BY
tcr.reportId tcr.reportId
ORDER BY ORDER BY
@ -227,15 +260,22 @@ WHERE
AND hpm.projectPermissions = 1 AND hpm.projectPermissions = 1
AND tcr.isdel = 0 AND tcr.isdel = 0
<if test="systemId!=null and systemId!=''">AND hpm.systemId = #{systemId}</if> <if test="systemId!=null and systemId!=''">AND hpm.systemId = #{systemId}</if>
<if test="searchContant!=null and searchContant!=''"> and (hpm.projectName like concat('%',#{searchContant},'%') OR tet.experimental_class_name like concat('%',#{searchContant},'%') )</if> <if test="searchContant!=null and searchContant!=''">and (hpm.projectName like concat('%',#{searchContant},'%')
<if test="startingtime!=null and startingtime!='' and endtime!=null and endtime != ''"> and hpm.creationTime between #{endtime} and #{startingtime}</if> OR tet.experimental_class_name like concat('%',#{searchContant},'%') )
<if test="month!=null and month != ''">and DATE_SUB(CURDATE(), INTERVAL #{month} month ) &lt;= date(creation_time)</if> </if>
<if test="startingtime!=null and startingtime!='' and endtime!=null and endtime != ''">and hpm.creationTime
between #{endtime} and #{startingtime}
</if>
<if test="month!=null and month != ''">and DATE_SUB(CURDATE(), INTERVAL #{month} month ) &lt;=
date(creation_time)
</if>
<if test="projectIds.size!=null"> <if test="projectIds.size!=null">
AND tet.id IN ( AND tet.id IN (
<foreach collection="projectIds" separator="," item="projectId"> <foreach collection="projectIds" separator="," item="projectId">
#{projectId} #{projectId}
</foreach> </foreach>
) </if> )
</if>
GROUP BY GROUP BY
tcr.reportId tcr.reportId
ORDER BY ORDER BY
@ -267,113 +307,137 @@ WHERE
AND tcr.isdel = 0 AND tcr.isdel = 0
AND u.isdel = 0 AND u.isdel = 0
AND tpr.projectId = #{projectId} AND tpr.projectId = #{projectId}
<if test="searchContant!=null and searchContant!=''"> AND (sch.schoolName LIKE CONCAT('%',#{searchContant},'%') OR u.userName LIKE CONCAT('%',#{searchContant},'%') )</if> <if test="searchContant!=null and searchContant!=''">AND (sch.schoolName LIKE CONCAT('%',#{searchContant},'%')
OR u.userName LIKE CONCAT('%',#{searchContant},'%') )
</if>
GROUP BY GROUP BY
tcr.reportId tcr.reportId
ORDER BY tpr.submitTime DESC ORDER BY tpr.submitTime DESC
</select> </select>
<select id="countEducationProjectId" resultType="java.lang.Integer"> <select id="countEducationProjectId" resultType="java.lang.Integer">
SELECT SELECT ter.projectId
ter.projectId FROM tms_experimental_report ter
FROM
tms_experimental_report ter
LEFT JOIN tms_experimental_teaching tet ON tet.id = ter.projectId LEFT JOIN tms_experimental_teaching tet ON tet.id = ter.projectId
LEFT JOIN hr_project_management hpm ON tet.project_id = hpm.projectId LEFT JOIN hr_project_management hpm ON tet.project_id = hpm.projectId
WHERE WHERE ter.isdel = 0
ter.isdel = 0
AND hpm.projectPermissions = 1 AND hpm.projectPermissions = 1
AND ter.projectId IS NOT NULL AND ter.projectId IS NOT NULL
GROUP BY GROUP BY ter.projectId
ter.projectId
</select> </select>
<select id="countFictitiousProjectId" resultType="java.lang.Integer"> <select id="countFictitiousProjectId" resultType="java.lang.Integer">
SELECT SELECT tpr.projectId
tpr.projectId FROM tms_project_record tpr
FROM
tms_project_record tpr
LEFT JOIN hr_project_management hpm ON tpr.projectId = hpm.projectId LEFT JOIN hr_project_management hpm ON tpr.projectId = hpm.projectId
WHERE WHERE tpr.isdel = 0
tpr.isdel = 0
AND hpm.projectPermissions = 0 AND hpm.projectPermissions = 0
GROUP BY GROUP BY tpr.projectId
tpr.projectId
</select> </select>
<select id="queryEvaluationName" resultType="java.lang.String"> <select id="queryEvaluationName" resultType="java.lang.String">
SELECT project_name AS evaluationName FROM tms_experimental_teaching WHERE project_id = #{projectId} SELECT project_name AS evaluationName
FROM tms_experimental_teaching
WHERE project_id = #{projectId}
</select> </select>
<select id="queryPythonTest" resultType="com.msdw.tms.entity.vo.AchievementManagementVO"> <select id="queryPythonTest" resultType="com.msdw.tms.entity.vo.AchievementManagementVO">
SELECT SELECT hec.`code` AS userAnswer,
hec.`code` AS userAnswer,
hec.codeId, hec.codeId,
if(p.rightAndWrong=0,hsi.score,0) AS codeScore, IF
(p.rightAndWrong = 0, hsi.score, 0) AS codeScore,
hjp.judgmentPointsName, hjp.judgmentPointsName,
hjp.experimentcode AS answer hjp.experimentcode AS answer
FROM FROM hr_experiment_code AS hec,
hr_experiment_code AS hec,
hr_score_index AS hsi, hr_score_index AS hsi,
hr_judgment_points AS hjp, hr_judgment_points AS hjp,
pointrecord p pointrecord p
WHERE WHERE hjp.judgmentPointsId = hsi.judgmentPointsId
hjp.judgmentPointsId = hsi.judgmentPointsId
AND hjp.judgmentPointsId = hec.judgmentPointsId AND hjp.judgmentPointsId = hec.judgmentPointsId
AND p.codeId = hec.codeId AND p.codeId = hec.codeId
AND hsi.isdel = 0
AND hjp.isdel = 0 AND hjp.isdel = 0
AND hec.recordId = #{recordId} AND hec.recordId = #{recordId}
GROUP BY GROUP BY hec.codeId
hec.codeId
ORDER BY
hec.codeId ASC
</select> </select>
<select id="list" resultType="com.msdw.tms.entity.ResultsEntity"> <select id="list" resultType="com.msdw.tms.entity.ResultsEntity">
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 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} FROM hr_project_management hpm WHERE systemId = #{systemId}
AND hpm.isdel = 0 AND hpm.isdel = 0
<if test="projectPermissions!=null and projectPermissions!=''"> AND hpm.projectPermissions = #{projectPermissions} </if> <if test="projectPermissions!=null and projectPermissions!=''">AND hpm.projectPermissions =
<if test="searchContant!=null and searchContant!=''"> and hpm.projectName like concat('%',#{searchContant},'%')</if> #{projectPermissions}
<if test="startTime!=null and startTime!='' and endTime!=null and endTime != ''"> and hpm.creationTime between #{endTime} and #{startTime}</if> </if>
<if test="month!=null and month != ''">and DATE_SUB(CURDATE(), INTERVAL #{month} month ) &lt;= date(hpm.creationTime)</if> <if test="searchContant!=null and searchContant!=''">and hpm.projectName like concat('%',#{searchContant},'%')
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime != ''">and hpm.creationTime between
#{endTime} and #{startTime}
</if>
<if test="month!=null and month != ''">and DATE_SUB(CURDATE(), INTERVAL #{month} month ) &lt;=
date(hpm.creationTime)
</if>
ORDER BY hpm.creationTime DESC ORDER BY hpm.creationTime DESC
</select> </select>
<select id="newList" resultType="com.msdw.tms.entity.ResultsEntity"> <select id="newList" resultType="com.msdw.tms.entity.ResultsEntity">
SELECT et.id,et.experimental_class_name as experimentalClassName,et.experimental_name as experimentalName,et.project_id as projectId, SELECT et.id,et.experimental_class_name as experimentalClassName,et.experimental_name as
pm.projectName,pm.projectPermissions,et.creation_time as creationTime,(SELECT count(*) FROM hr_experimental_report her where et.project_id = her.projectId ) as number experimentalName,et.project_id as projectId,
pm.projectName,pm.projectPermissions,et.creation_time as creationTime,(SELECT count(*) FROM
hr_experimental_report her where et.project_id = her.projectId ) as number
FROM tms_experimental_teaching et,hr_project_management pm FROM tms_experimental_teaching et,hr_project_management pm
WHERE user_id = #{userId} WHERE user_id = #{userId}
AND et.project_id = pm.projectId AND et.project_id = pm.projectId
AND pm.isdel = 0 AND pm.isdel = 0
<if test="searchContant!=null and searchContant!=''"> and et.experimental_class_name like concat('%',#{searchContant},'%') or et.experimental_name like concat('%',#{searchContant},'%') or pm.projectName like concat('%',#{searchContant},'%') </if> <if test="searchContant!=null and searchContant!=''">and et.experimental_class_name like
<if test="startTime!=null and startTime!='' and endTime!=null and endTime != ''"> and et.creation_time between #{endTime} and #{startTime}</if> concat('%',#{searchContant},'%') or et.experimental_name like concat('%',#{searchContant},'%') or
<if test="month!=null and month != ''">and DATE_SUB(CURDATE(), INTERVAL #{month} month ) &lt;= date(et.creation_time)</if> pm.projectName like concat('%',#{searchContant},'%')
</if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime != ''">and et.creation_time between
#{endTime} and #{startTime}
</if>
<if test="month!=null and month != ''">and DATE_SUB(CURDATE(), INTERVAL #{month} month ) &lt;=
date(et.creation_time)
</if>
ORDER BY et.creation_time DESC ORDER BY et.creation_time DESC
</select> </select>
<select id="reportList" resultType="com.msdw.tms.entity.ReportEntity"> <select id="reportList" resultType="com.msdw.tms.entity.ReportEntity">
SELECT hui.userId,her.reportId,hui.userName as studentName,s.schoolName,stu.workNumber,her.score,her.creationTime SELECT hui.userId,her.reportId,hui.userName as
studentName,s.schoolName,stu.workNumber,her.score,her.creationTime
FROM hr_experimental_report her,hr_user_info hui,school s,student stu FROM hr_experimental_report her,hr_user_info hui,school s,student stu
WHERE her.projectId = #{projectId} WHERE her.projectId = #{projectId}
AND her.studentId = hui.userId AND her.studentId = hui.userId
AND her.studentId = stu.userId AND her.studentId = stu.userId
AND hui.schoolId = s.schoolId AND hui.schoolId = s.schoolId
AND her.isdel = 0 AND her.isdel = 0
<if test="searchContant!=null and searchContant!=''"> AND (hui.userName LIKE CONCAT('%',#{searchContant},'%') OR s.schoolName LIKE CONCAT('%',#{searchContant},'%') )</if> <if test="searchContant!=null and searchContant!=''">AND (hui.userName LIKE CONCAT('%',#{searchContant},'%') OR
s.schoolName LIKE CONCAT('%',#{searchContant},'%') )
</if>
ORDER BY her.creationTime desc ORDER BY her.creationTime desc
</select> </select>
<select id="getTeacher" resultType="java.lang.String"> <select id="getTeacher" resultType="java.lang.String">
SELECT hui.userName FROM hr_project_management pm,hr_user_info hui SELECT hui.userName
WHERE pm.projectId = #{projectId} and pm.userId = hui.userId FROM hr_project_management pm,
hr_user_info hui
WHERE pm.projectId = #{projectId}
and pm.userId = hui.userId
</select> </select>
<select id="queryTradingJudgmentPointsId" resultType="java.lang.Integer"> <select id="queryTradingJudgmentPointsId" resultType="java.lang.Integer">
SELECT tradingJudgmentPointsId FROM hr_user_score SELECT tradingJudgmentPointsId
FROM hr_user_score
WHERE reportId = #{reportId} WHERE reportId = #{reportId}
</select> </select>
<select id="getUserAnswers" resultType="com.msdw.tms.entity.vo.JudgmentPointsRuleVO"> <select id="getUserAnswers" resultType="com.msdw.tms.entity.vo.JudgmentPointsRuleVO">
SELECT tjp.judgment_points_name as judgmentPointsName,ru.type,ru.id,ru.level_one as levelOne,ru.level_two as levelTwo,ru.level_three as levelThree,ru.level_four as levelFour,ru.trading_judgment_points_id as tradingJudgmentPointsId SELECT tjp.judgment_points_name as judgmentPointsName,
FROM hr_trading_judgment_points_rule ru,hr_trading_judgment_points tjp ru.type,
WHERE ru.trading_judgment_points_id = #{tradingJudgmentPointsId} and ru.trading_judgment_points_id = tjp.id ru.id,
ru.level_one as levelOne,
ru.level_two as levelTwo,
ru.level_three as levelThree,
ru.level_four as levelFour,
ru.trading_judgment_points_id as tradingJudgmentPointsId
FROM hr_trading_judgment_points_rule ru,
hr_trading_judgment_points tjp
WHERE ru.trading_judgment_points_id = #{tradingJudgmentPointsId}
and ru.trading_judgment_points_id = tjp.id
</select> </select>
</mapper> </mapper>

@ -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') ) 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' ) ) ) OR user_id IN ( SELECT userId FROM hr_user_info WHERE disableAccount = 0 AND isdel = 0 AND FIND_IN_SET( roleId, '1' ) ) )
<if test="cla.status!=null">and `status` = #{cla.status}</if> <if test="cla.status!=null">and `status` = #{cla.status}</if>
<if test="cla.condition!=null">and ( project_name like concat('%',#{cla.condition},'%') or experimental_class_name like concat('%',#{cla.condition},'%') )</if> <if test="cla.condition!=null">and ( experimental_name like concat('%',#{cla.condition},'%') or experimental_class_name like concat('%',#{cla.condition},'%') )</if>
<if test="cla.startTime!=null and cla.endTime!=null">and stop_time between #{cla.endTime} and #{cla.startTime}</if> <if test="cla.startTime!=null and cla.endTime!=null">and stop_time between #{cla.endTime} and #{cla.startTime}</if>
<if test="cla.month!=null">and DATE_SUB(CURDATE(), INTERVAL #{cla.month} month ) &lt;= date(creation_time)</if> <if test="cla.month!=null">and DATE_SUB(CURDATE(), INTERVAL #{cla.month} month ) &lt;= date(creation_time)</if>
ORDER BY creation_time DESC ORDER BY creation_time DESC

@ -9,8 +9,7 @@
</resultMap> </resultMap>
<select id="queryReport" resultType="com.msdw.tms.entity.vo.ExperimentalReportVo"> <select id="queryReport" resultType="com.msdw.tms.entity.vo.ExperimentalReportVo">
SELECT SELECT u.userId,
u.userId,
u.userName, u.userName,
stu.workNumber, stu.workNumber,
tet.project_name, tet.project_name,
@ -19,7 +18,6 @@ SELECT
hpm.experimentalGoal AS experiment_goal, hpm.experimentalGoal AS experiment_goal,
tpr.submitTime, tpr.submitTime,
tpr.score, tpr.score,
ter.teacherName,
ter.period, ter.period,
ter.laboratory, ter.laboratory,
ter.principle, ter.principle,
@ -31,15 +29,13 @@ SELECT
ter.summarize, ter.summarize,
ter.improvement, ter.improvement,
IFNULL(ter.`comment`, (SELECT `comment` FROM tms_comment WHERE id = commentId)) AS comment IFNULL(ter.`comment`, (SELECT `comment` FROM tms_comment WHERE id = commentId)) AS comment
FROM FROM hr_user_info u,
hr_user_info u,
student stu, student stu,
tms_experimental_report ter, tms_experimental_report ter,
hr_project_management hpm, hr_project_management hpm,
tms_experimental_teaching tet, tms_experimental_teaching tet,
tms_project_record tpr tms_project_record tpr
WHERE WHERE u.userId = stu.userId
u.userId = stu.userId
AND stu.studentId = ter.studentId AND stu.studentId = ter.studentId
AND hpm.projectId = tet.project_id AND hpm.projectId = tet.project_id
AND ter.projectId = tet.id AND ter.projectId = tet.id
@ -51,8 +47,7 @@ WHERE
AND ter.projectId = #{projectId} AND ter.projectId = #{projectId}
</select> </select>
<select id="queryVirtualReport" resultType="com.msdw.tms.entity.vo.ExperimentalReportVo"> <select id="queryVirtualReport" resultType="com.msdw.tms.entity.vo.ExperimentalReportVo">
SELECT SELECT tpr.recordId,
tpr.recordId,
u.userId, u.userId,
u.userName, u.userName,
stu.workNumber, stu.workNumber,
@ -60,26 +55,21 @@ SELECT
hpm.experimentalGoal AS experiment_goal, hpm.experimentalGoal AS experiment_goal,
tpr.submitTime, tpr.submitTime,
tpr.score tpr.score
FROM FROM hr_user_info u,
hr_user_info u,
student stu, student stu,
hr_project_management hpm, hr_project_management hpm,
tms_project_record tpr tms_project_record tpr
WHERE WHERE u.userId = stu.userId
u.userId = stu.userId
AND stu.userId = tpr.userId AND stu.userId = tpr.userId
AND hpm.projectId = tpr.projectId AND hpm.projectId = tpr.projectId
AND tpr.recordId = #{recordId}
AND tpr.isdel = 0 AND tpr.isdel = 0
AND tpr.recordId = #{recordId}
</select> </select>
<select id="querySystemId" resultType="java.lang.Integer"> <select id="querySystemId" resultType="java.lang.Integer">
SELECT SELECT systemId
systemId FROM hr_project_management hpm,
FROM
hr_project_management hpm,
tms_project_record tpr tms_project_record tpr
WHERE WHERE tpr.projectId = hpm.projectId
tpr.projectId = hpm.projectId
AND tpr.recordId = #{recordId} AND tpr.recordId = #{recordId}
</select> </select>
</mapper> </mapper>

@ -31,7 +31,9 @@
<if test="exp.status!=null"> <if test="exp.status!=null">
AND `status`=#{exp.status,jdbcType=INTEGER} AND `status`=#{exp.status,jdbcType=INTEGER}
</if> </if>
<if test="exp.systemId!=null">
AND `system_id`=#{exp.systemId,jdbcType=INTEGER}
</if>
<if test='exp.startTime!=null and exp.stopTime!=null'> <if test='exp.startTime!=null and exp.stopTime!=null'>
AND creation_time between #{exp.startTime} and #{exp.stopTime} AND creation_time between #{exp.startTime} and #{exp.stopTime}
</if> </if>

@ -18,11 +18,11 @@
</resultMap> </resultMap>
<insert id="addReport" useGeneratedKeys="true" keyProperty="eventId" keyColumn="recordId"> <insert id="addReport" useGeneratedKeys="true" keyProperty="eventId" keyColumn="recordId">
INSERT INTO tms_project_record (userId, projectId, score, startingTime, endTime, timeSum, submitTime) INSERT INTO tms_project_record (userId, projectId, score, startingTime, endTime, timeSum, submitTime)
VALUES VALUES (#{userid}, #{projectid}, #{score}, #{startingtime}, now(), #{timeSum}, now())
(#{userid}, #{projectid}, #{score}, #{startingtime}, now(), #{timeSum}, now())
</insert> </insert>
<select id="getByUserRecord" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
<!--
SELECT SELECT
her.reportId as reportId, her.reportId as reportId,
her.projectId, her.projectId,
@ -42,12 +42,29 @@ VALUES
AND AND
tp.projectPermissions = #{projectPermissions} tp.projectPermissions = #{projectPermissions}
order by her.creationTime desc order by her.creationTime desc
-->
<select id="getByUserRecord" resultType="com.msdw.tms.entity.resp.GetByUserRecordResp"
parameterType="java.lang.Integer">
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> </select>
<!-- --> <!-- -->
<select id="getByUserExperimentRecord" resultType="com.msdw.tms.entity.vo.ProjectRecordVo"> <select id="getByUserExperimentRecord" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
SELECT SELECT tet.id,
tet.id,
ter.reportId, ter.reportId,
tpr.recordId, tpr.recordId,
tpr.projectId, tpr.projectId,
@ -58,26 +75,21 @@ VALUES
endTime, endTime,
recordState, recordState,
tet.experimental_class_name as experimentalClassName tet.experimental_class_name as experimentalClassName
FROM FROM tms_project_record tpr
tms_project_record tpr
LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId 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_teaching tet ON tet.project_id = tpr.projectId
LEFT JOIN tms_experimental_report ter ON ter.projectId = tet.id LEFT JOIN tms_experimental_report ter ON ter.projectId = tet.id
WHERE WHERE tpr.userId = #{pro.userid}
tpr.userId = #{pro.userid} AND tpr.isdel = #{pro.isdel}
AND AND tp.projectPermissions !=0
tpr.isdel = #{pro.isdel}
AND
tp.projectPermissions !=0
AND AND
ter.eventId = tpr.recordId ter.eventId = tpr.recordId
ORDER BY ORDER BY
tpr.submitTime DESC tpr.recordId DESC
</select> </select>
<select id="getByUserRecordImport" resultType="com.msdw.tms.entity.vo.ProjectRecordExportVo"> <select id="getByUserRecordImport" resultType="com.msdw.tms.entity.vo.ProjectRecordExportVo">
SELECT SELECT tpr.projectId,
tpr.projectId,
projectName, projectName,
score, score,
timeSum, timeSum,
@ -85,42 +97,34 @@ VALUES
endTime, endTime,
recordState, recordState,
tet.experimental_class_name tet.experimental_class_name
FROM FROM tms_project_record tpr
tms_project_record tpr
LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId
LEFT JOIN tms_experimental_teaching tet ON tpr.projectId = tet.project_id LEFT JOIN tms_experimental_teaching tet ON tpr.projectId = tet.project_id
WHERE WHERE tpr.userId = #{userid}
tpr.userId = #{userid} AND tpr.isdel = #{isdel}
AND AND tpr.projectId = tet.project_id
tpr.isdel = #{isdel} AND tp.projectPermissions != 0
AND
tpr.projectId = tet.project_id
AND
tp.projectPermissions != 0
ORDER BY ORDER BY
tpr.submitTime DESC tpr.submitTime DESC
</select> </select>
<!-- 个人实验预览--> <!-- 个人实验预览-->
<select id="getByUserScore" resultType="com.msdw.tms.entity.vo.ProjectRecordVo"> <select id="getByUserScore" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
SELECT SELECT userName,
userName,
count(*) AS experimentNumber, count(*) AS experimentNumber,
sum(timeSum) AS totalTime, sum(timeSum) AS totalTime,
avg(score) avgScore avg(score) avgScore
FROM FROM tms_project_record pr
tms_project_record pr
LEFT JOIN hr_user_info u ON pr.userId = u.userId LEFT JOIN hr_user_info u ON pr.userId = u.userId
WHERE WHERE pr.userId = #{userid}
pr.userId = #{userid} and pr.isdel = #{isdel}
and and u.isdel = #{isdel}
pr.isdel = #{isdel}
and
u.isdel = #{isdel}
</select> </select>
<!-- 个人实验预览--> <!-- 个人实验预览-->
<select id="queryScore" resultType="com.msdw.tms.entity.vo.ProjectRecordVo"> <select id="queryScore" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
SELECT count(*) as experimentNumber,sum(timeConsuming) as totalTime, avg(score) as avgScore FROM hr_experimental_report where studentId = 547 SELECT count(*) as experimentNumber, sum(timeConsuming) as totalTime, avg(score) as avgScore
FROM hr_experimental_report
where studentId = 547
</select> </select>
<select id="getBySchoolRecord" resultType="com.msdw.tms.entity.vo.ProjectRecordVo"> <select id="getBySchoolRecord" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
@ -149,31 +153,32 @@ VALUES
and and
sc.isdel = #{pro.isdel} sc.isdel = #{pro.isdel}
<if test="pro.month!=null">and DATE_SUB(CURDATE(), INTERVAL #{pro.month} month ) &lt;= date(submitTime)</if> <if test="pro.month!=null">and DATE_SUB(CURDATE(), INTERVAL #{pro.month} month ) &lt;= date(submitTime)</if>
<if test="pro.startTime!=null and pro.endTime!=null">and submitTime between #{pro.startTime} and #{pro.endTime}</if> <if test="pro.startTime!=null and pro.endTime!=null">and submitTime between #{pro.startTime} and
#{pro.endTime}
</if>
<if test="pro.recordState!=null">and recordState=#{pro.recordState}</if> <if test="pro.recordState!=null">and recordState=#{pro.recordState}</if>
<if test="pro.condition!=null">and ( projectName like concat('%',#{pro.condition},'%') or schoolName like concat('%',#{pro.condition},'%') or userName like concat('%',#{pro.condition},'%') )</if> <if test="pro.condition!=null">and ( projectName like concat('%',#{pro.condition},'%') or schoolName like
concat('%',#{pro.condition},'%') or userName like concat('%',#{pro.condition},'%') )
</if>
</select> </select>
<select id="getByRecordImport" resultType="com.msdw.tms.entity.vo.ProjectRecordExportVo"> <select id="getByRecordImport" resultType="com.msdw.tms.entity.vo.ProjectRecordExportVo">
SELECT SELECT tpr.projectId,
tpr.projectId,
projectName, projectName,
score, score,
timeSum, timeSum,
startingTime as startTime, startingTime as startTime,
endTime, endTime,
recordState recordState
FROM FROM tms_project_record tpr
tms_project_record tpr
LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId
WHERE WHERE tpr.userId = #{userid}
tpr.userId = #{userid} AND tpr.isdel = #{isdel}
AND AND tp.projectPermissions = 0
tpr.isdel = #{isdel}
AND
tp.projectPermissions =0
</select> </select>
<select id="queryReport" resultType="com.msdw.tms.entity.ProjectRecordEntity"> <select id="queryReport" resultType="com.msdw.tms.entity.ProjectRecordEntity">
SELECT * FROM tms_project_record WHERE recordId = #{recordId} SELECT *
FROM tms_project_record
WHERE recordId = #{recordId}
</select> </select>
<update id="updateUserRecord" parameterType="com.msdw.tms.entity.ProjectRecordEntity"> <update id="updateUserRecord" parameterType="com.msdw.tms.entity.ProjectRecordEntity">
@ -184,6 +189,8 @@ VALUES
</update> </update>
<update id="updateScore"> <update id="updateScore">
UPDATE tms_project_record SET score = #{score} WHERE recordId = #{recordid} UPDATE tms_project_record
SET score = #{score}
WHERE recordId = #{recordid}
</update> </update>
</mapper> </mapper>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.msdw.tms.dao.SysPermissionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.msdw.tms.entity.SysPermission">
<id column="id" property="id" />
<result column="code" property="code" />
<result column="name" property="name" />
<result column="parent_id" property="parentId" />
<result column="level" property="level" />
<result column="menu_or_not" property="menuOrNot" />
<result column="status" property="status" />
<result column="url" property="url" />
<result column="menu_url" property="menuUrl" />
<result column="sort" property="sort" />
<result column="icon" property="icon" />
<result column="create_time" property="createTime" />
<result column="motify_time" property="motifyTime" />
</resultMap>
<select id="pageByCondition" resultType="com.msdw.tms.entity.response.RolePermissionResponse">
select rp.role_id as roleId, hr.`name`,hr.description,GROUP_CONCAT(hp.`name`separator '/') as permissionName
FROM sys_role_permission rp
LEFT JOIN sys_role hr on hr.id = rp.role_id
LEFT JOIN sys_permission hp on hp.id= rp.permission_id
<where>
hr.del_or_not=0
<if test="name != null and name != ''">
AND hr.name LIKE CONCAT('%' #{name} '%')
</if>
</where>
GROUP BY rp.role_id
</select>
</mapper>

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.msdw.tms.dao.SysRoleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.msdw.tms.entity.SysRole">
<id column="id" property="id" />
<result column="name" property="name" />
<result column="description" property="description" />
<result column="del_or_not" property="delOrNot" />
<result column="create_time" property="createTime" />
<result column="motify_time" property="motifyTime" />
<result column="code" property="code" />
</resultMap>
<insert id="addHrmsRole" parameterType="com.msdw.tms.entity.request.RolePermissionRequest"
useGeneratedKeys="true" keyProperty="roleId" keyColumn="id">
INSERT INTO sys_role
(`name`,description,create_time,motify_time)
values (#{name},#{description},#{createTime},#{motifyTime});
</insert>
<update id="updateHrmsRole" parameterType="com.msdw.tms.entity.request.RolePermissionRequest">
UPDATE sys_role
<set>
`name`=#{name},
description=#{description},
motify_time=#{motifyTime},
</set>
WHERE id = #{roleId}
</update>
<delete id="deleteHrmsRoleByRoleId">
update sys_role set del_or_not = 1 where id IN
<foreach collection="roleIds" index="index" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</delete>
</mapper>

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.msdw.tms.dao.SysRolePermissionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.msdw.tms.entity.SysRolePermission">
<id column="id" property="id" />
<result column="role_id" property="roleId" />
<result column="permission_id" property="permissionId" />
</resultMap>
<select id="uniqueRoleName" parameterType="string" resultType="java.lang.Integer">
select count(0) from sys_role where `name` = #{name}
</select>
<insert id="addHrmsRolePermission" parameterType="com.msdw.tms.entity.request.RolePermissionRequest">
INSERT INTO sys_role_permission (role_id,permission_id) values
<foreach collection="rolePermissionList" index="index" separator="," item="item">
(#{item.roleId},#{item.permissionId})
</foreach>
</insert>
<delete id="deleteHrmsRolePermission">
delete from sys_role_permission where role_id in
<foreach collection="roleIds" index="index" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</delete>
<delete id="deleteHrmsRolePermissionSingle">
delete from sys_role_permission where role_id=#{roleId}
</delete>
<select id="queryPermissionArrById" resultMap="BaseResultMap">
select id, permission_id from sys_role_permission where role_id = #{roleId}
</select>
</mapper>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.msdw.tms.dao.SysUserRoleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.msdw.tms.entity.SysUserRole">
<id column="id" property="id" />
<result column="user_id" property="userId" />
<result column="role_id" property="roleId" />
</resultMap>
<select id="queryCountByRoleId" resultType="java.lang.Integer">
select count(0) from sys_user_role where role_id in
<foreach collection="roleIds" index="index" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</select>
</mapper>

@ -96,12 +96,14 @@
s.staffId, s.staffId,
s.workNumber, s.workNumber,
s.staffProfessionalArchitectureId, s.staffProfessionalArchitectureId,
s.staffProfessionalArchitectureName, spa.staffProfessionalArchitectureName,
s.staffGradeId, s.staffGradeId,
s.staffGradeName sg.staffGradeName
FROM FROM
hr_user_info u hr_user_info u
LEFT JOIN staff s ON u.userId = s.userId 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 WHERE
s.schoolId = #{schoolId} s.schoolId = #{schoolId}
AND AND
@ -109,8 +111,8 @@
AND AND
s.isdel=0 s.isdel=0
<if test="searchContent!=null">AND (u.userName LIKE CONCAT('%',#{searchContent},'%') OR s.workNumber LIKE CONCAT('%',#{searchContent},'%') OR u.account LIKE CONCAT('%',#{searchContent},'%') )</if> <if test="searchContent!=null">AND (u.userName LIKE CONCAT('%',#{searchContent},'%') OR s.workNumber LIKE CONCAT('%',#{searchContent},'%') OR u.account LIKE CONCAT('%',#{searchContent},'%') )</if>
<if test="staffGradeIds!=null and staffGradeIds!='' ">AND FIND_IN_SET(staffGradeId,#{staffGradeIds})</if> <if test="staffGradeIds!=null and staffGradeIds!='' ">AND FIND_IN_SET(s.staffGradeId,#{staffGradeIds})</if>
<if test="staffProfessionalArchitectureIds!=null and staffProfessionalArchitectureIds!=''">AND FIND_IN_SET(staffProfessionalArchitectureId,#{staffProfessionalArchitectureIds})</if> <if test="staffProfessionalArchitectureIds!=null and staffProfessionalArchitectureIds!=''">AND FIND_IN_SET(s.staffProfessionalArchitectureId,#{staffProfessionalArchitectureIds})</if>
GROUP BY s.userId ORDER BY u.updateTime DESC,u.lastLoginTime DESC,creationTime DESC GROUP BY s.userId ORDER BY u.updateTime DESC,u.lastLoginTime DESC,creationTime DESC
</select> </select>
<select id="querystaffDetail" resultType="com.msdw.tms.entity.vo.StaffVo"> <select id="querystaffDetail" resultType="com.msdw.tms.entity.vo.StaffVo">

@ -1,142 +1,145 @@
package com.msdw.tms.service; //package com.msdw.tms.service;
//
import com.msdw.tms.common.utils.R; //import com.msdw.tms.common.utils.R;
import com.msdw.tms.dao.AchievementManagementDao; //import com.msdw.tms.dao.AchievementManagementDao;
import com.msdw.tms.entity.ProjectRecordEntity; //import com.msdw.tms.entity.ProjectEntity;
import com.msdw.tms.entity.request.AchievementImportRequest; //import com.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.vo.AchievementManagementVO; //import com.msdw.tms.entity.request.AchievementImportRequest;
import org.junit.jupiter.api.Test; //import com.msdw.tms.entity.vo.AchievementManagementVo;
import org.springframework.beans.factory.annotation.Autowired; //import com.msdw.tms.entity.vo.SearchAchievementVo;
import org.springframework.boot.test.context.SpringBootTest; //import org.junit.jupiter.api.Test;
//import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList; //import org.springframework.boot.test.context.SpringBootTest;
import java.util.List; //
//import java.util.ArrayList;
@SpringBootTest //import java.util.Date;
public class AchievementManagementTest { //import java.util.List;
//
@Autowired //@SpringBootTest
private AchievementManagementService achievementManagementService; //public class AchievementManagementTest {
//
@Autowired // @Autowired
private ProjectRecordService projectRecordService; // private AchievementManagementService achievementManagementService;
//
@Autowired // @Autowired
AchievementManagementDao achievementManagementDao; // private ProjectRecordService projectRecordService;
//
//测试新增实验记录 // @Autowired
// AchievementManagementDao achievementManagementDao;
//
// //测试新增实验记录
//// @Test
//// public void addReport(){
//// AchievementManagementVo vo = new AchievementManagementVo();
//// ProjectRecordEntity entity = new ProjectRecordEntity();
//// Date date = new Date();
//// //用户id
//// Integer userId = 385;
////
//// entity.setUserid(userId)
//// .setProjectid(368)
//// .setScore(100)
//// .setRecordstate(0)
//// .setStartingtime(date)
//// .setEndtime(date)
//// .setSubmittime(date)
//// .setTimeSum(0)
//// .setIsdel(0);
//// vo.setUserId(userId)
//// .setEvaluationId(158)
//// .setExperimentalGoal("目标2")
//// .setPrinciple("原理2")
//// .setStep("步骤2")
//// .setAnalysis("实验分析2")
//// .setSummarize("实验总结2")
//// .setImprovement("实验建议2")
//// .setCommentId(3)
//// .setTeacherId(178)
//// .setPeriod("学时")
//// .setLaboratory("实验室名称2")
//// .setIsSignature(0)
//// .setSignatureId(4)
//// .setIsdel(0);
//// vo.setEntity(entity);
//// R r = achievementManagementService.addReport(vo);
//// System.out.println(r);
//// }
//
// @Test // @Test
// public void addReport(){ // public void queryReport(){
// AchievementManagementVO vo = new AchievementManagementVO(); // Integer reportId = 4;
// ProjectRecordEntity entity = new ProjectRecordEntity(); // Integer recordId = 100;
// Date date = new Date(); // R r = achievementManagementService.queryReport(reportId);
// //用户id // System.out.println(r);
// Integer userId = 385; // }
// //
// entity.setUserid(userId) // @Test
// .setProjectid(368) // public void updateScore(){
// .setScore(100) // ProjectRecordEntity vo = new ProjectRecordEntity();
// .setRecordstate(0) // Integer recordId = 100;
// .setStartingtime(date) // Integer score = 99;
// .setEndtime(date) // vo.setRecordid(recordId).setScore(score);
// .setSubmittime(date) // projectRecordService.updateScore(vo);
// .setTimeSum(0) // }
// .setIsdel(0); //
// vo.setUserId(userId) // @Test
// .setEvaluationId(158) // public void daleteReport(){
// .setExperimentalGoal("目标2") // Integer reportId = 4;
// .setPrinciple("原理2") // Integer recordId = 100;
// .setStep("步骤2") // AchievementManagementVo vo = new AchievementManagementVo();
// .setAnalysis("实验分析2") // ProjectRecordEntity entity = new ProjectRecordEntity();
// .setSummarize("实验总结2") // entity.setRecordid(recordId);
// .setImprovement("实验建议2") // vo.setReportId(reportId);
// .setCommentId(3)
// .setTeacherId(178)
// .setPeriod("学时")
// .setLaboratory("实验室名称2")
// .setIsSignature(0)
// .setSignatureId(4)
// .setIsdel(0);
// vo.setEntity(entity); // vo.setEntity(entity);
// R r = achievementManagementService.addReport(vo); // R r = achievementManagementService.deleteReport(reportId);
// System.out.println(r);
// }
//
// //测试查询班级实验成绩列表
// @Test
// public void queryEvaluationReport(){
// String searchContant = "michonne";
// // String searchContant = "";
// Integer projectId = 368;
// Integer page = 1;
// Integer size = 2;
// R r = achievementManagementService.queryEvaluationReport(searchContant,projectId,page,size);
// System.out.println(r); // System.out.println(r);
//} //}
//
@Test // //筛选查询-教学实验
public void queryReport(){ // @Test
Integer reportId = 4; // public void queryEvaluationReportByRecordId(){
Integer recordId = 100; // Integer month = 1;
R r = achievementManagementService.queryReport(reportId); // Integer systemId = 1;
System.out.println(r); // String searchContent= "";
} // String staingTime = "";
// String endTime = "";
@Test // List<Integer> list = achievementManagementDao.countEducationProjectId();
public void updateScore(){ // List<AchievementManagementVo> result = achievementManagementDao.queryEducationRecord(systemId, searchContent, staingTime, endTime, month, list);
ProjectRecordEntity vo = new ProjectRecordEntity(); // System.out.println(result);
Integer recordId = 100; // }
Integer score = 99; // //筛选查询-虚拟实验
vo.setRecordid(recordId).setScore(score); // @Test
projectRecordService.updateScore(vo); // public void queryFictitiousReportByRecordId(){
} // Integer month = null;
// Integer systemId = 1;
@Test // String searchContent= "";
public void daleteReport(){ // String staingTime = "";
Integer reportId = 4; // String endTime = "";
Integer recordId = 100; // List<Integer> list = achievementManagementDao.countFictitiousProjectId();
AchievementManagementVO vo = new AchievementManagementVO(); // List<AchievementManagementVo> result = achievementManagementDao.queryFictitiousRecord(systemId, searchContent, staingTime, endTime, month, list);
ProjectRecordEntity entity = new ProjectRecordEntity(); // System.out.println(result);
entity.setRecordid(recordId); // }
vo.setReportId(reportId); //
vo.setEntity(entity); // @Test
R r = achievementManagementService.deleteReport(reportId); // public void testQuery(){
System.out.println(r); //// String str = "184,185";
} // ArrayList<Integer> integers = new ArrayList<>();
// integers.add(184);
//测试查询班级实验成绩列表 // integers.add(185);
@Test //
public void queryEvaluationReport(){ // List<AchievementImportRequest> achievementImportRequests = achievementManagementDao.queryAchievement(integers);
String searchContant = "michonne"; // System.out.println(achievementImportRequests);
// String searchContant = ""; // }
Integer projectId = 368; //}
Integer page = 1;
Integer size = 2;
R r = achievementManagementService.queryEvaluationReport(searchContant,projectId,page,size);
System.out.println(r);
}
//筛选查询-教学实验
@Test
public void queryEvaluationReportByRecordId(){
Integer month = 1;
Integer systemId = 1;
String searchContent= "";
String staingTime = "";
String endTime = "";
List<Integer> list = achievementManagementDao.countEducationProjectId();
List<AchievementManagementVO> result = achievementManagementDao.queryEducationRecord(systemId, searchContent, staingTime, endTime, month, list);
System.out.println(result);
}
//筛选查询-虚拟实验
@Test
public void queryFictitiousReportByRecordId(){
Integer month = null;
Integer systemId = 1;
String searchContent= "";
String staingTime = "";
String endTime = "";
List<Integer> list = achievementManagementDao.countFictitiousProjectId();
List<AchievementManagementVO> result = achievementManagementDao.queryFictitiousRecord(systemId, searchContent, staingTime, endTime, month, list);
System.out.println(result);
}
@Test
public void testQuery(){
// String str = "184,185";
ArrayList<Integer> integers = new ArrayList<>();
integers.add(184);
integers.add(185);
List<AchievementImportRequest> achievementImportRequests = achievementManagementDao.queryAchievement(integers);
System.out.println(achievementImportRequests);
}
}

Loading…
Cancel
Save