增加批量删除功能

hehai
jiakun.lin 4 years ago
parent 01a1a999b8
commit 798802ccd8
  1. 7
      src/main/java/com/msdw/tms/api/AchievementManagementApi.java
  2. 9
      src/main/java/com/msdw/tms/controller/AchievementManagementController.java
  3. 2
      src/main/java/com/msdw/tms/service/AchievementManagementService.java
  4. 28
      src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.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,10 +80,10 @@ public interface AchievementManagementApi {
@ApiOperation(value = "发布成绩", notes = "发布成绩--修改教师签名")
R updateSignatrue(@ApiParam(value = "实验报告主键reportId + 是否使用教师签名isSignature + 教师签名id signatureId + 教师评语comment") ExperimentalReportEntity entity);
@ApiOperation(value = "成绩管理删除项目", notes = "将项目管理下的成绩管理删除")
R deleteReportById(@ApiParam(value = "项目id", required = true) Integer projectId,
@ApiOperation(value = "成绩管理批量删除项目", notes = "将项目管理下的成绩管理批量删除")
R deleteReportByIds(@ApiParam(value = "项目id", required = true) List<Integer> projectIds,
@ApiParam(value = "项目类型(0练习,1考核)", required = true) Integer projectPermissions,
@ApiParam(value = "教学实验id",required = false) Integer id);
@ApiParam(value = "教学实验id",required = false) List<Integer> ids);
@ApiOperation(value = "成绩管理:虚拟仿真实验成绩管理", notes = "成绩管理:虚拟仿真实验成绩管理")

@ -275,16 +275,15 @@ public class AchievementManagementController implements AchievementManagementApi
/**
* 删除成绩管理中的项目
* 批量删除成绩管理中的项目
*
* @param projectId
* @return
*/
@Override
@PostMapping("/deleteReportById")
public R deleteReportById(@RequestParam Integer projectId,@RequestParam Integer projectPermissions,
@RequestParam(required = false) Integer id) {
return service.deleteReportById(projectId,projectPermissions,id);
public R deleteReportByIds(@RequestParam List<Integer> projectIds,@RequestParam Integer projectPermissions,
@RequestParam(required = false) List<Integer> ids) {
return service.deleteReportById(projectIds,projectPermissions,ids);
}
/**

@ -44,7 +44,7 @@ public interface AchievementManagementService extends IService<ExperimentalRepor
void updateSignatrue(ExperimentalReportEntity entity);
R deleteReportById(Integer projectId,Integer projectPermissions, Integer id);
R deleteReportById(List<Integer> projectId,Integer projectPermissions, List<Integer> id);
List<AchievementManagementVO> getImitationAchievement(Integer projectId);

@ -305,20 +305,24 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
@Override
public R deleteReportById(Integer projectId,Integer projectPermissions, Integer id) {
if (id != null && projectPermissions == 1){
List<AchievementManagementVO> teachAchievements = achievementManagementDao.getTeachAchievement(id);
for (AchievementManagementVO teachAchievement :teachAchievements) {
Integer reportId = teachAchievement.getReportId();
Integer recordId = teachAchievement.getRecordId();
achievementManagementDao.deleteReport(reportId,recordId);
public R deleteReportById(List<Integer> projectIds,Integer projectPermissions, List<Integer> ids) {
if (projectPermissions == 1){//实验教学
for (Integer id: ids) {
List<AchievementManagementVO> teachAchievements = achievementManagementDao.getTeachAchievement(id);
for (AchievementManagementVO teachAchievement : teachAchievements) {
Integer reportId = teachAchievement.getReportId();
Integer recordId = teachAchievement.getRecordId();
achievementManagementDao.deleteReport(reportId, recordId);
}
}
}else {
List<AchievementManagementVO> imitationAchievements = achievementManagementDao.getImitationAchievement(projectId);
for (AchievementManagementVO imitationAchievement: imitationAchievements) {
Integer reportId = imitationAchievement.getReportId();
Integer recordId = imitationAchievement.getRecordId();
achievementManagementDao.deleteReport(reportId,recordId);
for (Integer projectId: projectIds) {//虚仿实验
List<AchievementManagementVO> imitationAchievements = achievementManagementDao.getImitationAchievement(projectId);
for (AchievementManagementVO imitationAchievement: imitationAchievements) {
Integer reportId = imitationAchievement.getReportId();
Integer recordId = imitationAchievement.getRecordId();
achievementManagementDao.deleteReport(reportId,recordId);
}
}
}

Loading…
Cancel
Save