diff --git a/src/main/java/com/msdw/tms/api/AchievementManagementApi.java b/src/main/java/com/msdw/tms/api/AchievementManagementApi.java index b6a7e74..42ff62a 100644 --- a/src/main/java/com/msdw/tms/api/AchievementManagementApi.java +++ b/src/main/java/com/msdw/tms/api/AchievementManagementApi.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiParam; import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpServletResponse; +import java.util.List; @Api(value = "成绩管理", tags = "成绩管理") public interface AchievementManagementApi { @@ -79,8 +80,10 @@ public interface AchievementManagementApi { @ApiOperation(value = "发布成绩", notes = "发布成绩--修改教师签名") R updateSignatrue(@ApiParam(value = "实验报告主键reportId + 是否使用教师签名isSignature + 教师签名id signatureId + 教师评语comment") ExperimentalReportEntity entity); - @ApiOperation(value = "成绩管理删除项目", notes = "将项目管理表isdel置1") - R deleteReportByProjectId(@ApiParam(value = "项目id", required = true) Integer projectId); + @ApiOperation(value = "成绩管理批量删除项目", notes = "将项目管理下的成绩管理批量删除") + R deleteReportByIds(@ApiParam(value = "项目id", required = true) List projectIds, + @ApiParam(value = "项目类型(0练习,1考核)", required = true) Integer projectPermissions, + @ApiParam(value = "教学实验id",required = false) List ids); @ApiOperation(value = "成绩管理:虚拟仿真实验成绩管理", notes = "成绩管理:虚拟仿真实验成绩管理") diff --git a/src/main/java/com/msdw/tms/controller/AchievementManagementController.java b/src/main/java/com/msdw/tms/controller/AchievementManagementController.java index 4b027b8..3b2f903 100644 --- a/src/main/java/com/msdw/tms/controller/AchievementManagementController.java +++ b/src/main/java/com/msdw/tms/controller/AchievementManagementController.java @@ -275,15 +275,15 @@ public class AchievementManagementController implements AchievementManagementApi /** - * 删除成绩管理中的项目 + * 批量删除成绩管理中的项目 * - * @param projectId * @return */ @Override @PostMapping("/deleteReportById") - public R deleteReportByProjectId(@RequestParam Integer projectId) { - return service.deleteReportByProjectId(projectId); + public R deleteReportByIds(@RequestParam List projectIds,@RequestParam Integer projectPermissions, + @RequestParam(required = false) List ids) { + return service.deleteReportById(projectIds,projectPermissions,ids); } /** diff --git a/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java b/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java index f070234..9b0d5ac 100644 --- a/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java +++ b/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java @@ -124,7 +124,8 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr @Override @PostMapping("/delete") public R delete(@RequestBody Integer[] ids){ - experimentalTeachingService.removeByIds(Arrays.asList(ids)); + //改为假删除tms_experimental_teaching + experimentalTeachingService.deleteTeachByIds(Arrays.asList(ids)); return R.ok(); } diff --git a/src/main/java/com/msdw/tms/dao/ClassTeachingDao.java b/src/main/java/com/msdw/tms/dao/ClassTeachingDao.java index 5cbc435..3ad2f27 100644 --- a/src/main/java/com/msdw/tms/dao/ClassTeachingDao.java +++ b/src/main/java/com/msdw/tms/dao/ClassTeachingDao.java @@ -26,4 +26,6 @@ public interface ClassTeachingDao { int updateExperimentalNumber(Integer number, Integer id); + + void updateIsDel(Integer id); } diff --git a/src/main/java/com/msdw/tms/entity/ResultsEntity.java b/src/main/java/com/msdw/tms/entity/ResultsEntity.java index 715cd3a..4ec085d 100644 --- a/src/main/java/com/msdw/tms/entity/ResultsEntity.java +++ b/src/main/java/com/msdw/tms/entity/ResultsEntity.java @@ -48,6 +48,8 @@ public class ResultsEntity{ //实验名称 private String experimentalName; + private Integer isdel; + } diff --git a/src/main/java/com/msdw/tms/entity/request/AchievementImportRequest.java b/src/main/java/com/msdw/tms/entity/request/AchievementImportRequest.java index eb3bf1f..8c4751f 100644 --- a/src/main/java/com/msdw/tms/entity/request/AchievementImportRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/AchievementImportRequest.java @@ -15,24 +15,24 @@ public class AchievementImportRequest { @ExcelAttribute(sort = 0) private String schoolName; - //实验班级 + /* //实验班级 @ExcelAttribute(sort = 1) - private String experimentalClassName; + private String experimentalClassName;*/ //学生姓名 - @ExcelAttribute(sort = 2) + @ExcelAttribute(sort = 1) private String userName; //学号 - @ExcelAttribute(sort = 3) + @ExcelAttribute(sort = 2) private String workNumber; //分数 - @ExcelAttribute(sort = 4) + @ExcelAttribute(sort = 3) private String score; //提交时间 - @ExcelAttribute(sort = 5) + @ExcelAttribute(sort = 4) private String submitTime; } diff --git a/src/main/java/com/msdw/tms/entity/vo/ResultsVo.java b/src/main/java/com/msdw/tms/entity/vo/ResultsVo.java index 791c06e..cb68385 100644 --- a/src/main/java/com/msdw/tms/entity/vo/ResultsVo.java +++ b/src/main/java/com/msdw/tms/entity/vo/ResultsVo.java @@ -40,4 +40,6 @@ public class ResultsVo { //用户id private Integer userId; + private Integer isdel; + } diff --git a/src/main/java/com/msdw/tms/service/AchievementManagementService.java b/src/main/java/com/msdw/tms/service/AchievementManagementService.java index 4b78743..b142c80 100644 --- a/src/main/java/com/msdw/tms/service/AchievementManagementService.java +++ b/src/main/java/com/msdw/tms/service/AchievementManagementService.java @@ -44,7 +44,7 @@ public interface AchievementManagementService extends IService projectId,Integer projectPermissions, List id); List getImitationAchievement(Integer projectId); diff --git a/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java b/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java index 3bea116..491c511 100644 --- a/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java +++ b/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java @@ -16,4 +16,5 @@ public interface ExperimentalTeachingService extends IService asList); } diff --git a/src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java index bfc6608..40089a4 100644 --- a/src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java @@ -78,9 +78,26 @@ public class AchievementManagementServiceImpl extends ServiceImpl list(ResultsVo vo, Integer page, Integer size) { + + List list = achievementManagementDao.list(vo); + + for (ResultsEntity entity : list) { + Integer number = achievementManagementDao.getImitationAchievement(entity.getProjectId()).size(); + entity.setNumber(number); + } + + return list; } @@ -93,6 +110,10 @@ public class AchievementManagementServiceImpl extends ServiceImpl newList(ResultsVo vo, Integer page, Integer size) { List newList = achievementManagementDao.newList(vo); + for (ResultsEntity entity : newList) { + Integer number = achievementManagementDao.getTeachAchievement(entity.getId()).size(); + entity.setNumber(number); + } return newList; } @@ -199,7 +220,7 @@ public class AchievementManagementServiceImpl extends ServiceImpl achievement = achievementManagementDao.queryAchievement(list); //2.加载模板流数据 - ClassPathResource resource = new ClassPathResource("excel-template/川大成绩管理实验记录导出模板.xlsx"); + ClassPathResource resource = new ClassPathResource("excel-template/川大成绩管理实验记录导出模板 (1).xlsx"); InputStream inputStream = resource.getInputStream(); //3、通过工具类下载文件 @@ -284,9 +305,28 @@ public class AchievementManagementServiceImpl extends ServiceImpl projectIds,Integer projectPermissions, List ids) { + if (projectPermissions == 1){//实验教学 + for (Integer id: ids) { + List teachAchievements = achievementManagementDao.getTeachAchievement(id); + for (AchievementManagementVO teachAchievement : teachAchievements) { + Integer reportId = teachAchievement.getReportId(); + Integer recordId = teachAchievement.getRecordId(); + achievementManagementDao.deleteReport(reportId, recordId); + } + } + }else { + for (Integer projectId: projectIds) {//虚仿实验 + List imitationAchievements = achievementManagementDao.getImitationAchievement(projectId); + for (AchievementManagementVO imitationAchievement: imitationAchievements) { + Integer reportId = imitationAchievement.getReportId(); + Integer recordId = imitationAchievement.getRecordId(); + achievementManagementDao.deleteReport(reportId,recordId); + } + } + } + - achievementManagementDao.deleteReportById(projectId); return R.ok(); } @@ -295,6 +335,7 @@ public class AchievementManagementServiceImpl extends ServiceImpl getImitationAchievement(Integer projectId) { List list = achievementManagementDao.getImitationAchievement(projectId); + return list; } diff --git a/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java index 0e6843f..73df989 100644 --- a/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java @@ -15,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + @Service("experimentalTeachingService") public class ExperimentalTeachingServiceImpl extends ServiceImpl implements ExperimentalTeachingService { @@ -50,4 +52,12 @@ public class ExperimentalTeachingServiceImpl extends ServiceImpl asList) { + int size = asList.size(); + for (int i = 0; i < size; i++) { + classTeachingDao.updateIsDel(asList.get(i)); + } + } + } diff --git a/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java index 255a4ba..7848c47 100644 --- a/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java @@ -75,7 +75,7 @@ public class ProjectRecordServiceImpl extends ServiceImpl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - SELECT schoolName, experimental_class_name, @@ -538,7 +612,7 @@ report.reportId, r.submitTime, stu.studentId, - t.id as projectId + t.id as projectId FROM tms_experimental_teaching t INNER JOIN tms_experimental_report report ON report.projectId = t.id INNER JOIN tms_project_record r ON r.recordId = report.eventId @@ -546,12 +620,7 @@ INNER JOIN school s ON s.schoolId = u.schoolId INNER JOIN student stu ON stu.userId = u.userId WHERE t.id = #{id} - AND t.is_del = 0 AND report.isdel = 0 - AND r.isdel = 0 - AND u.isdel = 0 - AND s.isdel = 0 - AND stu.isdel = 0; diff --git a/src/main/resources/mapper/tms/ClassTeachingDao.xml b/src/main/resources/mapper/tms/ClassTeachingDao.xml index 3265d03..6a54760 100644 --- a/src/main/resources/mapper/tms/ClassTeachingDao.xml +++ b/src/main/resources/mapper/tms/ClassTeachingDao.xml @@ -117,4 +117,11 @@ WHERE id = #{id} + + + UPDATE tms_experimental_teaching + SET is_del = 1 + WHERE + id = #{id} + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml index 84d123d..20f318c 100644 --- a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml +++ b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml @@ -3,29 +3,75 @@ + +