删除接口修改,教学实验改为假删除

hehai
jiakun.lin 4 years ago
parent 624b427853
commit cdf31a09f8
  1. 6
      src/main/java/com/msdw/tms/api/AchievementManagementApi.java
  2. 5
      src/main/java/com/msdw/tms/controller/AchievementManagementController.java
  3. 3
      src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java
  4. 2
      src/main/java/com/msdw/tms/dao/ClassTeachingDao.java
  5. 2
      src/main/java/com/msdw/tms/entity/ResultsEntity.java
  6. 2
      src/main/java/com/msdw/tms/entity/vo/ResultsVo.java
  7. 2
      src/main/java/com/msdw/tms/service/AchievementManagementService.java
  8. 1
      src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java
  9. 19
      src/main/java/com/msdw/tms/service/impl/AchievementManagementServiceImpl.java
  10. 10
      src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java
  11. 14
      src/main/resources/mapper/tms/AchievementManagementDao.xml
  12. 7
      src/main/resources/mapper/tms/ClassTeachingDao.xml
  13. 2
      src/main/resources/mapper/tms/ExperimentalTeachingDao.xml

@ -79,8 +79,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 = "将项目管理表isdel置1") @ApiOperation(value = "成绩管理删除项目", notes = "将项目管理下的成绩管理删除")
R deleteReportByProjectId(@ApiParam(value = "项目id", required = true) Integer projectId); R deleteReportById(@ApiParam(value = "项目id", required = true) Integer projectId,
@ApiParam(value = "项目类型(0练习,1考核)", required = true) Integer projectPermissions,
@ApiParam(value = "教学实验id",required = false) Integer id);
@ApiOperation(value = "成绩管理:虚拟仿真实验成绩管理", notes = "成绩管理:虚拟仿真实验成绩管理") @ApiOperation(value = "成绩管理:虚拟仿真实验成绩管理", notes = "成绩管理:虚拟仿真实验成绩管理")

@ -282,8 +282,9 @@ public class AchievementManagementController implements AchievementManagementApi
*/ */
@Override @Override
@PostMapping("/deleteReportById") @PostMapping("/deleteReportById")
public R deleteReportByProjectId(@RequestParam Integer projectId) { public R deleteReportById(@RequestParam Integer projectId,@RequestParam Integer projectPermissions,
return service.deleteReportByProjectId(projectId); @RequestParam(required = false) Integer id) {
return service.deleteReportById(projectId,projectPermissions,id);
} }
/** /**

@ -124,7 +124,8 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr
@Override @Override
@PostMapping("/delete") @PostMapping("/delete")
public R delete(@RequestBody Integer[] ids){ public R delete(@RequestBody Integer[] ids){
experimentalTeachingService.removeByIds(Arrays.asList(ids)); //改为假删除tms_experimental_teaching
experimentalTeachingService.deleteTeachByIds(Arrays.asList(ids));
return R.ok(); return R.ok();
} }

@ -26,4 +26,6 @@ public interface ClassTeachingDao {
int updateExperimentalNumber(Integer number, Integer id); int updateExperimentalNumber(Integer number, Integer id);
void updateIsDel(Integer id);
} }

@ -48,6 +48,8 @@ public class ResultsEntity{
//实验名称 //实验名称
private String experimentalName; private String experimentalName;
private Integer isdel;
} }

@ -40,4 +40,6 @@ public class ResultsVo {
//用户id //用户id
private Integer userId; private Integer userId;
private Integer isdel;
} }

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

@ -16,4 +16,5 @@ public interface ExperimentalTeachingService extends IService<ExperimentalTeachi
PageUtils queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingVO vo); PageUtils queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingVO vo);
void deleteTeachByIds(List<Integer> asList);
} }

@ -284,9 +284,24 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
@Override @Override
public R deleteReportByProjectId(Integer projectId) { 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);
}
}else {
List<AchievementManagementVO> 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(); return R.ok();
} }

@ -15,6 +15,8 @@ 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;
@Service("experimentalTeachingService") @Service("experimentalTeachingService")
public class ExperimentalTeachingServiceImpl extends ServiceImpl<ExperimentalTeachingDao, ExperimentalTeachingEntity> implements ExperimentalTeachingService { public class ExperimentalTeachingServiceImpl extends ServiceImpl<ExperimentalTeachingDao, ExperimentalTeachingEntity> implements ExperimentalTeachingService {
@ -50,4 +52,12 @@ public class ExperimentalTeachingServiceImpl extends ServiceImpl<ExperimentalTea
return pageUtils; return pageUtils;
} }
@Override
public void deleteTeachByIds(List<Integer> asList) {
int size = asList.size();
for (int i = 0; i < size; i++) {
classTeachingDao.updateIsDel(asList.get(i));
}
}
} }

@ -393,13 +393,11 @@
<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 SELECT hpm.creationTime,hpm.projectId,hpm.projectName,hpm.projectPermissions,hpm.systemId,(SELECT count(*) FROM
tms_project_record her where hpm.projectId = her.projectId and her.isdel = 0 ) as number tms_project_record her where hpm.projectId = her.projectId and her.isdel = 0 ) as number,
hpm.isdel
FROM hr_project_management hpm FROM hr_project_management hpm
WHERE systemId = #{systemId} WHERE systemId = #{systemId}
AND hpm.isdel = 0 AND hpm.projectPermissions = #{projectPermissions}
<if test="projectPermissions!=null and projectPermissions!=''">AND hpm.projectPermissions =
#{projectPermissions}
</if>
<if test="searchContant!=null and searchContant!=''">and hpm.projectName like concat('%',#{searchContant},'%') <if test="searchContant!=null and searchContant!=''">and hpm.projectName like concat('%',#{searchContant},'%')
</if> </if>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime != ''">and hpm.creationTime between <if test="startTime!=null and startTime!='' and endTime!=null and endTime != ''">and hpm.creationTime between
@ -420,14 +418,14 @@
pm.projectName, pm.projectName,
pm.projectPermissions, pm.projectPermissions,
et.creation_time AS creationTime, et.creation_time AS creationTime,
( SELECT count( * ) FROM tms_experimental_report her WHERE et.id = her.projectId AND her.isdel = 0 ) AS number ( SELECT count( * ) FROM tms_experimental_report her WHERE et.id = her.projectId AND her.isdel = 0 ) AS number,
et.is_del
FROM FROM
tms_experimental_teaching et, tms_experimental_teaching et,
hr_project_management pm hr_project_management pm
WHERE WHERE
user_id = #{userId} user_id = #{userId}
AND et.project_id = pm.projectId AND et.project_id = pm.projectId
AND pm.isdel = 0
<if test="searchContant!=null and searchContant!=''">and et.experimental_class_name like <if test="searchContant!=null and searchContant!=''">and et.experimental_class_name like
concat('%',#{searchContant},'%') or et.experimental_name like concat('%',#{searchContant},'%') or concat('%',#{searchContant},'%') or et.experimental_name like concat('%',#{searchContant},'%') or
pm.projectName like concat('%',#{searchContant},'%') pm.projectName like concat('%',#{searchContant},'%')
@ -538,7 +536,7 @@
report.reportId, report.reportId,
r.submitTime, r.submitTime,
stu.studentId, stu.studentId,
t.id as projectId t.id as projectId
FROM tms_experimental_teaching t FROM tms_experimental_teaching t
INNER JOIN tms_experimental_report report ON report.projectId = t.id INNER JOIN tms_experimental_report report ON report.projectId = t.id
INNER JOIN tms_project_record r ON r.recordId = report.eventId INNER JOIN tms_project_record r ON r.recordId = report.eventId

@ -117,4 +117,11 @@
WHERE WHERE
id = #{id} id = #{id}
</update> </update>
<update id="updateIsDel">
UPDATE tms_experimental_teaching
SET is_del = 1
WHERE
id = #{id}
</update>
</mapper> </mapper>

@ -11,7 +11,7 @@
project_id, project_id,
project_name, project_name,
(select count(*) (select count(*)
from tms_project_record WHERE projectId = project_id) as experimental_number, from tms_project_record WHERE projectId = project_id AND tms_project_record.isdel = 0) as experimental_number,
experiment_duration, experiment_duration,
type, type,
start_time, start_time,

Loading…
Cancel
Save