|
|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.core.page.PageResult;
|
|
|
+import com.ydtech.modules.admin.constants.UserConstants;
|
|
|
import com.ydtech.modules.admin.model.po.SysBarcodeConfig;
|
|
|
import com.ydtech.modules.admin.model.vo.AddSysBarcodeConfigVo;
|
|
|
import com.ydtech.modules.admin.model.vo.SysBarcodeConfigPageVo;
|
|
|
@@ -50,21 +51,28 @@ public class SysBarcodeConfigController extends BaseController {
|
|
|
BeanUtils.copyProperties(addSysBarcodeConfigVo, sysBarcodeConfig);
|
|
|
sysBarcodeConfig.setCreateTime(LocalDateTime.now());
|
|
|
sysBarcodeConfig.setCreateBy(userName);
|
|
|
- LambdaQueryWrapper<SysBarcodeConfig> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(SysBarcodeConfig::getCompanyId, sysBarcodeConfig.getCompanyId());
|
|
|
- if (sysBarcodeConfigService.count(wrapper) > 0){
|
|
|
- HttpResult.error("不允许重复配置!");
|
|
|
+ if (UserConstants.NOT_UNIQUE.equals(sysBarcodeConfigService.checkCompanyUnique(sysBarcodeConfig))) {
|
|
|
+ return HttpResult.error("新增'" + sysBarcodeConfig.getCompanyName() + "'配置失败,该保险公司已经配置");
|
|
|
}
|
|
|
+// LambdaQueryWrapper<SysBarcodeConfig> wrapper = new LambdaQueryWrapper<>();
|
|
|
+// wrapper.eq(SysBarcodeConfig::getCompanyId, sysBarcodeConfig.getCompanyId());
|
|
|
+// wrapper.eq(SysBarcodeConfig::getApiType, sysBarcodeConfig.getApiType());
|
|
|
+// if (sysBarcodeConfigService.count(wrapper) > 0){
|
|
|
+// HttpResult.error("不允许重复配置!");
|
|
|
+// }
|
|
|
boolean save = sysBarcodeConfigService.save(sysBarcodeConfig);
|
|
|
return JudgeUtils.add(save);
|
|
|
}
|
|
|
|
|
|
@PutMapping("/edit/{id}")
|
|
|
@ApiOperation("修改二维码配置")
|
|
|
- public HttpResult edit(@PathVariable Long id, @RequestBody AddSysBarcodeConfigVo addSysBarcodeConfigVo) {
|
|
|
+ public HttpResult edit(@PathVariable Long id, @RequestBody @Valid AddSysBarcodeConfigVo addSysBarcodeConfigVo) {
|
|
|
SysBarcodeConfig sysBarcodeConfig = new SysBarcodeConfig();
|
|
|
BeanUtils.copyProperties(addSysBarcodeConfigVo, sysBarcodeConfig);
|
|
|
sysBarcodeConfig.setId(id);
|
|
|
+ if (UserConstants.NOT_UNIQUE.equals(sysBarcodeConfigService.checkCompanyUnique(sysBarcodeConfig))) {
|
|
|
+ return HttpResult.error("修改'" + sysBarcodeConfig.getCompanyName() + "'配置失败,该保险公司已经配置");
|
|
|
+ }
|
|
|
boolean modify = sysBarcodeConfigService.saveOrUpdate(sysBarcodeConfig);
|
|
|
return JudgeUtils.modify(modify);
|
|
|
}
|