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

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. 12
      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 = "发布成绩--修改教师签名")
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 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 = "成绩管理:虚拟仿真实验成绩管理")

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

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

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

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

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

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

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

@ -284,9 +284,24 @@ public class AchievementManagementServiceImpl extends ServiceImpl<AchievementMan
@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();
}

@ -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<ExperimentalTeachingDao, ExperimentalTeachingEntity> implements ExperimentalTeachingService {
@ -50,4 +52,12 @@ public class ExperimentalTeachingServiceImpl extends ServiceImpl<ExperimentalTea
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 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
WHERE systemId = #{systemId}
AND hpm.isdel = 0
<if test="projectPermissions!=null and projectPermissions!=''">AND hpm.projectPermissions =
#{projectPermissions}
</if>
AND hpm.projectPermissions = #{projectPermissions}
<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
@ -420,14 +418,14 @@
pm.projectName,
pm.projectPermissions,
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
tms_experimental_teaching et,
hr_project_management pm
WHERE
user_id = #{userId}
AND et.project_id = pm.projectId
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},'%')

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

@ -11,7 +11,7 @@
project_id,
project_name,
(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,
type,
start_time,

Loading…
Cancel
Save