实训草稿发布重命名

This commit is contained in:
xzb 2022-09-05 13:06:22 +08:00
parent a1a6d69d8f
commit 9d0677cf51
2 changed files with 12 additions and 1 deletions

View File

@ -36,10 +36,13 @@ public class Training2DraftPublishService {
DraftTraining2WithBLOBs draft = dtFinds.get(0); DraftTraining2WithBLOBs draft = dtFinds.get(0);
// //
PublishedTraining2WithBLOBs pub = Training2Convertor.convertFrom(draft); PublishedTraining2WithBLOBs pub = Training2Convertor.convertFrom(draft);
if(null!=req.getReName()&&req.getReName().trim().length()>0){
pub.setName(req.getReName());
}
//根据要发布的草稿名称来查找已发布的实训 //根据要发布的草稿名称来查找已发布的实训
//如果以有同名的则会被覆盖 //如果以有同名的则会被覆盖
PublishedTraining2Example ptExample = new PublishedTraining2Example(); PublishedTraining2Example ptExample = new PublishedTraining2Example();
ptExample.createCriteria().andNameEqualTo(draft.getName()).andMapIdEqualTo(draft.getMapId()); ptExample.createCriteria().andNameEqualTo(pub.getName()).andMapIdEqualTo(pub.getMapId());
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample); List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
// //
if (null != ptFinds && !ptFinds.isEmpty()) {//已发布实训存在时则直接删除 if (null != ptFinds && !ptFinds.isEmpty()) {//已发布实训存在时则直接删除

View File

@ -19,4 +19,12 @@ public class TrainingDraftPublishReqVo {
*/ */
@NotBlank(message = "实训草稿id不能为空") @NotBlank(message = "实训草稿id不能为空")
private String draftId; private String draftId;
/**
* 实训草稿发布时对实训重命名
* <p>
* 选填
* <p>
* 为空时默认使用实训草稿名称作为发布名称
*/
private String reName;
} }