【修改已发布实训label信息】

This commit is contained in:
weizhihong 2023-05-05 11:03:22 +08:00
parent 1d4918f52d
commit 0b7ccabb16
4 changed files with 49 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.services.training2.Training2PublishService;
import club.joylink.rtss.services.training2.Training2TypeEnum;
import club.joylink.rtss.vo.LoginUserInfoVO;
@ -106,4 +107,20 @@ public class TrainingV2PublishController {
public PublishedTraining2DetailRspVo findTrainingAllInfo(@PathVariable("trainingId") Long trainingId){
return this.publishService.findTrainingAllInfoById(trainingId);
}
/**
* 更新实训label
*/
@PutMapping("/update/label")
public void updateTrainingLabel(@RequestBody PublishedTraining2 training2) {
publishService.updateTrainingLabel(training2);
}
/**
* 批量更新实训label
*/
@PutMapping("/update/batch/label")
public void updateTrainingLabelList(@RequestBody List<PublishedTraining2> publishedTraining2List) {
publishService.updateTrainingLabelList(publishedTraining2List);
}
}

View File

@ -74,4 +74,6 @@ public interface PublishedTraining2DAO {
List<Long> selectTrainingIdByRuleNameAndMapId(@Param("ruleNameList") List<Map<String,String>> ruleNameMapList, @Param("mapId") Long mapId);
int updateTrainingOrgByMapIdList(@Param("orgId") Long orgId, @Param("mapIdList") List<Long> mapIdList);
void updateTrainingLabelList(@Param("list") List<PublishedTraining2> training2List);
}

View File

@ -430,4 +430,25 @@ public class Training2PublishService {
publishedDao.updateTrainingOrgByMapIdList(orgId, mapIdList);
}
}
/**
* 批量更新实训label
*/
public void updateTrainingLabelList(List<PublishedTraining2> publishedTraining2List) {
List<PublishedTraining2> training2List = publishedTraining2List.stream().filter(t -> t.getId() != null).collect(Collectors.toList());
if (CollectionUtils.isEmpty(training2List)) {
return;
}
publishedDao.updateTrainingLabelList(training2List);
}
/**
* 更新实训label
*/
public void updateTrainingLabel(PublishedTraining2 training2) {
PublishedTraining2WithBLOBs blobs = new PublishedTraining2WithBLOBs();
blobs.setId(training2.getId());
blobs.setLabelJson(training2.getLabelJson());
publishedDao.updateByPrimaryKeySelective(blobs);
}
}

View File

@ -630,4 +630,13 @@
where creator_id = 0 and map_id in
<foreach collection="mapIdList" item="mapId" separator="," open="(" close=")"> #{mapId} </foreach>
</update>
<update id="updateTrainingLabelList">
UPDATE rts_published_training2 t
INNER JOIN (
<foreach collection="list" item="item" separator="UNION ALL">
SELECT #{item.id} as id, #{item.labelJson} as label_json
</foreach>
) tt ON t.id = tt.id SET t.label_json = tt.label_json
</update>
</mapper>