BUGFIX: 回显;

This commit is contained in:
shahaibo
2023-12-04 14:04:36 +08:00
parent a7893d07bb
commit be6795b42a
6 changed files with 38 additions and 4 deletions

View File

@@ -29,6 +29,8 @@ public class LibraryModelPointDTO implements Serializable {
private String modelType;
private String modelSex;
@ApiModelProperty("templateId")
private Long templateId;

View File

@@ -46,6 +46,8 @@ public interface LibraryService extends IService<Library> {
*/
LibraryUpdateVo upload(LibraryUploadDTO libraryUploadDTO);
void checkModel(String value, List<Long> modelIds, Integer deleteModelConfirm);
/**
* 编辑library 文件名
*

View File

@@ -10,6 +10,7 @@ import com.ai.da.mapper.entity.*;
import com.ai.da.model.dto.LibraryModelPointDTO;
import com.ai.da.model.dto.ModelsDotDTO;
import com.ai.da.model.enums.ModelType;
import com.ai.da.model.enums.Sex;
import com.ai.da.model.vo.LibraryModelPointVO;
import com.ai.da.python.PythonService;
import com.ai.da.python.vo.DesignPythonObjects;
@@ -21,11 +22,13 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@@ -60,6 +63,18 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
libraryModelPointVO.setTemplateId(libraryModelPoint.getId());
} else {
//编辑
if (!StringUtils.isEmpty(libraryModelPointDTO.getModelSex())) {
Library byId = libraryService.getById(libraryModelPointDTO.getLibraryId());
if (!byId.getLevel2Type().equals(libraryModelPointDTO.getModelSex())) {
if (byId.getLevel2Type().equals(Sex.FEMALE.getValue())) {
libraryService.checkModel(Sex.FEMALE.getValue(), Collections.singletonList(byId.getId()), 1);
}else {
libraryService.checkModel(Sex.MALE.getValue(), Collections.singletonList(byId.getId()), 1);
}
byId.setLevel2Type(libraryModelPointDTO.getModelSex());
libraryService.updateById(byId);
}
}
LibraryModelPoint modelPoint = getById(libraryModelPointDTO.getTemplateId());
if (Objects.isNull(modelPoint)) {
throw new BusinessException("modelPoint.not.found");

View File

@@ -458,7 +458,9 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
libraryMapper.delete(qw);
}
private void checkModel(String value, List<Long> modelIds, Integer deleteModelConfirm) {
@Override
public void checkModel(String value, List<Long> modelIds, Integer deleteModelConfirm) {
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
QueryWrapper<Workspace> qw = new QueryWrapper<>();
qw.lambda().eq(Workspace::getUserName, authPrincipalVo.getUsername());