|
|
|
@ -21,6 +21,7 @@ import cn.hutool.core.convert.Convert;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataPriceTemplateEntity; |
|
|
|
@ -204,14 +205,18 @@ public class BasicdataPriceTemplateServiceImpl extends BaseServiceImpl<Basicdata
|
|
|
|
|
default: |
|
|
|
|
throw new ServiceException("当前选择的类型不存在"); |
|
|
|
|
} |
|
|
|
|
checkName(priceTemplateEntity.getName()); |
|
|
|
|
checkName(priceTemplateEntity.getName(), priceTemplateEntity.getId()); |
|
|
|
|
this.baseMapper.updateById(priceTemplateEntity); |
|
|
|
|
return Boolean.TRUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkName(String name) { |
|
|
|
|
BasicdataPriceTemplateEntity one = this.getOne(Wrappers.<BasicdataPriceTemplateEntity>lambdaQuery() |
|
|
|
|
.eq(BasicdataPriceTemplateEntity::getName, name) |
|
|
|
|
private void checkName(String name, Long id) { |
|
|
|
|
LambdaQueryWrapper<BasicdataPriceTemplateEntity> wrapper = Wrappers.<BasicdataPriceTemplateEntity>lambdaQuery() |
|
|
|
|
.eq(BasicdataPriceTemplateEntity::getName, name); |
|
|
|
|
if (ObjectUtil.isNotEmpty(id)) { |
|
|
|
|
wrapper.ne(BasicdataPriceTemplateEntity::getId, id); |
|
|
|
|
} |
|
|
|
|
BasicdataPriceTemplateEntity one = this.getOne(wrapper |
|
|
|
|
.last("limit 1") |
|
|
|
|
); |
|
|
|
|
if (ObjectUtil.isNotEmpty(one)) { |
|
|
|
@ -240,7 +245,7 @@ public class BasicdataPriceTemplateServiceImpl extends BaseServiceImpl<Basicdata
|
|
|
|
|
} else { |
|
|
|
|
basicdataPriceTemplate.setTemplateType("用户"); |
|
|
|
|
} |
|
|
|
|
checkName(basicdataPriceTemplate.getName()); |
|
|
|
|
checkName(basicdataPriceTemplate.getName(),null); |
|
|
|
|
this.save(basicdataPriceTemplate); |
|
|
|
|
return basicdataPriceTemplate.getId(); |
|
|
|
|
} |
|
|
|
|