增加批量删除功能

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. 12
      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 org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Api(value = "成绩管理", tags = "成绩管理") @Api(value = "成绩管理", tags = "成绩管理")
public interface AchievementManagementApi { public interface AchievementManagementApi {
@ -79,10 +80,10 @@ public interface AchievementManagementApi {
@ApiOperation(value = "发布成绩", notes = "发布成绩--修改教师签名") @ApiOperation(value = "发布成绩", notes = "发布成绩--修改教师签名")
R updateSignatrue(@ApiParam(value = "实验报告主键reportId + 是否使用教师签名isSignature + 教师签名id signatureId + 教师评语comment") ExperimentalReportEntity entity); R updateSignatrue(@ApiParam(value = "实验报告主键reportId + 是否使用教师签名isSignature + 教师签名id signatureId + 教师评语comment") ExperimentalReportEntity entity);
@ApiOperation(value = "成绩管理删除项目", notes = "将项目管理下的成绩管理删除") @ApiOperation(value = "成绩管理批量删除项目", notes = "将项目管理下的成绩管理批量删除")
R deleteReportById(@ApiParam(value = "项目id", required = true) Integer projectId, R deleteReportByIds(@ApiParam(value = "项目id", required = true) List<Integer> projectIds,
@ApiParam(value = "项目类型(0练习,1考核)", required = true) Integer projectPermissions, @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 = "成绩管理:虚拟仿真实验成绩管理") @ApiOperation(value = "成绩管理:虚拟仿真实验成绩管理", notes = "成绩管理:虚拟仿真实验成绩管理")

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

@ -44,7 +44,7 @@ public interface AchievementManagementService extends IService<ExperimentalRepor
void updateSignatrue(ExperimentalReportEntity entity); 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); List<AchievementManagementVO> getImitationAchievement(Integer projectId);

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

Loading…
Cancel
Save