|
|
@ -27,6 +27,7 @@ import com.epmet.dto.form.CustomerFormQueryDTO; |
|
|
|
import com.epmet.dto.form.EditIFormItemFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.IcFormItemEntity; |
|
|
|
import com.epmet.entity.IcFormItemOptionsEntity; |
|
|
|
import com.epmet.service.IcFormItemService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -175,29 +176,36 @@ public class IcFormItemServiceImpl extends BaseServiceImpl<IcFormItemDao, IcForm |
|
|
|
@Override |
|
|
|
public void editItemType(EditIFormItemFormDTO formDTO) { |
|
|
|
LambdaQueryWrapper<IcFormItemEntity> queryWrapper = new QueryWrapper<IcFormItemEntity>().lambda() |
|
|
|
.eq(StringUtils.isNotBlank(formDTO.getCustomerId()),IcFormItemEntity::getCustomerId, formDTO.getCustomerId()) |
|
|
|
.eq(StringUtils.isNotBlank(formDTO.getFormItemId()),IcFormItemEntity::getId,formDTO.getFormItemId()) |
|
|
|
.eq(IcFormItemEntity::getLabel,formDTO.getLabel()); |
|
|
|
List<IcFormItemEntity> list=baseDao.selectList(queryWrapper); |
|
|
|
if(CollectionUtils.isEmpty(list)){ |
|
|
|
.eq(StringUtils.isNotBlank(formDTO.getCustomerId()), IcFormItemEntity::getCustomerId, formDTO.getCustomerId()) |
|
|
|
.eq(StringUtils.isNotBlank(formDTO.getFormItemId()), IcFormItemEntity::getId, formDTO.getFormItemId()) |
|
|
|
.eq(IcFormItemEntity::getLabel, formDTO.getLabel()); |
|
|
|
List<IcFormItemEntity> list = baseDao.selectList(queryWrapper); |
|
|
|
if (CollectionUtils.isEmpty(list)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
for(IcFormItemEntity entity:list){ |
|
|
|
for (IcFormItemEntity entity : list) { |
|
|
|
//修改组件类型
|
|
|
|
entity.setItemType(formDTO.getItemType()); |
|
|
|
baseDao.updateById(entity); |
|
|
|
if(!CollectionUtils.isEmpty(formDTO.getOptions())){ |
|
|
|
//todo
|
|
|
|
// 先删除后新增
|
|
|
|
/*int sort=1; |
|
|
|
for(OptionDTO optionDTO:formDTO.getOptions()){ |
|
|
|
IcFormItemOptionsEntity optionsEntity=new IcFormItemOptionsEntity(); |
|
|
|
optionsEntity.setCustomerId(); |
|
|
|
|
|
|
|
}*/ |
|
|
|
if (!CollectionUtils.isEmpty(formDTO.getOptions())) { |
|
|
|
icFormItemOptionsDao.deleteByItemId(entity.getId(), entity.getCustomerId()); |
|
|
|
int sort = 1; |
|
|
|
for (OptionDTO optionDTO : formDTO.getOptions()) { |
|
|
|
IcFormItemOptionsEntity optionsEntity = new IcFormItemOptionsEntity(); |
|
|
|
optionsEntity.setCustomerId(entity.getCustomerId()); |
|
|
|
optionsEntity.setFormCode(entity.getFormCode()); |
|
|
|
optionsEntity.setFormId(entity.getFormId()); |
|
|
|
optionsEntity.setItemId(entity.getId()); |
|
|
|
optionsEntity.setOptionLabel(optionDTO.getLabel()); |
|
|
|
optionsEntity.setOptionValue(optionDTO.getValue()); |
|
|
|
optionsEntity.setSort(sort); |
|
|
|
icFormItemOptionsDao.insert(optionsEntity); |
|
|
|
sort++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|