This commit is contained in:
2025-10-23 10:23:33 +08:00
parent 26cb8498a2
commit 2d320e9263
6 changed files with 75 additions and 46 deletions

View File

@ -107,7 +107,7 @@ public class BankController {
@ApiOperation(value = "修改LngBBank") @ApiOperation(value = "修改LngBBank")
@SaCheckPermission("bank:edit") @SaCheckPermission("bank:edit")
public R update(@Valid @RequestBody UpdateLngBBankDto dto){ public R update(@Valid @RequestBody UpdateLngBBankDto dto){
return R.ok(dataService.updateById(dto)); return R.ok(bankService.update(dto));
} }
@DeleteMapping @DeleteMapping

View File

@ -102,16 +102,7 @@ public class CountryRegionController {
@ApiOperation(value = "新增LngBRegion") @ApiOperation(value = "新增LngBRegion")
@SaCheckPermission("countryRegion:add") @SaCheckPermission("countryRegion:add")
public R add(@Valid @RequestBody UpdateLngBRegionDto dto){ public R add(@Valid @RequestBody UpdateLngBRegionDto dto){
if(!CountryRegionEnum.CONTINENT.getCode().equals(dto.getRegionTypeCode()) ) {
if(dto.getPid() != null && dto.getPid() != 0) {
LngBRegion parentRegion = countryRegionService.getById(dto.getPid());
if(parentRegion != null) {
dto.setFullPath(parentRegion.getFullPath()+dto.getFullName());
}
}
}else {
dto.setFullPath(dto.getFullName());
}
Long res = countryRegionService.add(dto); Long res = countryRegionService.add(dto);
return R.ok(res); return R.ok(res);
} }
@ -120,17 +111,8 @@ public class CountryRegionController {
@ApiOperation(value = "修改LngBRegion") @ApiOperation(value = "修改LngBRegion")
@SaCheckPermission("countryRegion:edit") @SaCheckPermission("countryRegion:edit")
public R update(@Valid @RequestBody UpdateLngBRegionDto dto){ public R update(@Valid @RequestBody UpdateLngBRegionDto dto){
if(!CountryRegionEnum.CONTINENT.getCode().equals(dto.getRegionTypeCode()) ) {
if(dto.getPid() != null && dto.getPid() != 0) { return R.ok(countryRegionService.update(dto));
LngBRegion parentRegion = countryRegionService.getById(dto.getPid());
if(parentRegion != null) {
dto.setFullPath(parentRegion.getFullPath()+dto.getFullName());
}
}
}else {
dto.setFullPath(dto.getFullName());
}
return R.ok(dataService.updateById(dto));
} }
@DeleteMapping @DeleteMapping

View File

@ -20,4 +20,6 @@ public interface IBankService extends IService<LngBBank> {
boolean enable(List<Long> ids); boolean enable(List<Long> ids);
boolean disable(List<Long> ids); boolean disable(List<Long> ids);
Long update(UpdateLngBBankDto dto);
} }

View File

@ -2,6 +2,8 @@ package com.xjrsoft.module.mdm.service;
import java.util.List; import java.util.List;
import javax.validation.Valid;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.xjrsoft.module.mdm.dto.UpdateLngBRegionDto; import com.xjrsoft.module.mdm.dto.UpdateLngBRegionDto;
import com.xjrsoft.module.mdm.entity.LngBRegion; import com.xjrsoft.module.mdm.entity.LngBRegion;
@ -20,4 +22,6 @@ public interface ICountryRegionService extends IService<LngBRegion> {
boolean enable(List<Long> ids); boolean enable(List<Long> ids);
boolean disable(List<Long> ids); boolean disable(List<Long> ids);
Long update(UpdateLngBRegionDto dto);
} }

View File

@ -18,6 +18,7 @@ import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.datalog.service.DatalogService; import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto; import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.entity.LngBBank; import com.xjrsoft.module.mdm.entity.LngBBank;
import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.mdm.mapper.LngBBankMapper; import com.xjrsoft.module.mdm.mapper.LngBBankMapper;
import com.xjrsoft.module.mdm.service.IBankService; import com.xjrsoft.module.mdm.service.IBankService;
import com.xjrsoft.module.system.client.ICodeRuleClient; import com.xjrsoft.module.system.client.ICodeRuleClient;
@ -51,6 +52,15 @@ public class BankServiceImpl extends ServiceImpl<LngBBankMapper, LngBBank> imple
return res.getId(); return res.getId();
} }
@Override
@Transactional(rollbackFor = Exception.class)
public Long update(UpdateLngBBankDto dto) {
this.checkParams(dto);
UpdateLngBBankDto res = DataLogTools.update(dto);
//this.addOrUpdateAfter(res.getId());
return res.getId();
}
@Override @Override
public boolean enable(List<Long> ids) { public boolean enable(List<Long> ids) {
return dataService.disable(UpdateLngBBankDto.class,ids); return dataService.disable(UpdateLngBBankDto.class,ids);
@ -64,13 +74,13 @@ public class BankServiceImpl extends ServiceImpl<LngBBankMapper, LngBBank> imple
private void checkParams(UpdateLngBBankDto dto) { private void checkParams(UpdateLngBBankDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBBank>() Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBBank>()
.eq(LngBBank::getCode, dto.getCode())); .eq(LngBBank::getCode, dto.getCode()).ne(dto.getId() != null, LngBBank::getId, dto.getId()));
if (codeCount > 0) { if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION, throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE)); FieldNameConstants.CODE));
} }
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBBank>() Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBBank>()
.eq(LngBBank::getFullName, dto.getFullName())); .eq(LngBBank::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBBank::getId, dto.getId()));
if (nameCount > 0) { if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION, throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.FULL_NAME)); FieldNameConstants.FULL_NAME));

View File

@ -18,6 +18,7 @@ import com.xjrsoft.module.common.db.service.CommonCallService;
import com.xjrsoft.module.datalog.service.DatalogService; import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.mdm.dto.UpdateLngBRegionDto; import com.xjrsoft.module.mdm.dto.UpdateLngBRegionDto;
import com.xjrsoft.module.mdm.entity.LngBRegion; import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.mdm.enums.CountryRegionEnum;
import com.xjrsoft.module.mdm.mapper.LngBRegionMapper; import com.xjrsoft.module.mdm.mapper.LngBRegionMapper;
import com.xjrsoft.module.mdm.service.ICountryRegionService; import com.xjrsoft.module.mdm.service.ICountryRegionService;
@ -40,6 +41,16 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long add(UpdateLngBRegionDto dto) { public Long add(UpdateLngBRegionDto dto) {
if(!CountryRegionEnum.CONTINENT.getCode().equals(dto.getRegionTypeCode()) ) {
if(dto.getPid() != null && dto.getPid() != 0) {
LngBRegion parentRegion = this.getById(dto.getPid());
if(parentRegion != null) {
dto.setFullPath(parentRegion.getFullPath()+dto.getFullName());
}
}
}else {
dto.setFullPath(dto.getFullName());
}
this.checkParams(dto); this.checkParams(dto);
UpdateLngBRegionDto res = DataLogTools.insert(dto); UpdateLngBRegionDto res = DataLogTools.insert(dto);
//this.addOrUpdateAfter(res.getId()); //this.addOrUpdateAfter(res.getId());
@ -57,15 +68,35 @@ public class CountryRegionServiceImpl extends ServiceImpl<LngBRegionMapper, LngB
return dataService.disable(UpdateLngBRegionDto.class,ids); return dataService.disable(UpdateLngBRegionDto.class,ids);
} }
@Override
public Long update(UpdateLngBRegionDto dto) {
if(!CountryRegionEnum.CONTINENT.getCode().equals(dto.getRegionTypeCode()) ) {
if(dto.getPid() != null && dto.getPid() != 0) {
LngBRegion parentRegion = this.getById(dto.getPid());
if(parentRegion != null) {
dto.setFullPath(parentRegion.getFullPath()+dto.getFullName());
}
}
}else {
dto.setFullPath(dto.getFullName());
}
this.checkParams(dto);
UpdateLngBRegionDto res = DataLogTools.update(dto);
//this.addOrUpdateAfter(res.getId());
return res.getId();
}
private void checkParams(UpdateLngBRegionDto dto) { private void checkParams(UpdateLngBRegionDto dto) {
Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBRegion>() Long codeCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBRegion>()
.eq(LngBRegion::getCode, dto.getCode())); .eq(LngBRegion::getCode, dto.getCode()).ne(dto.getId() != null, LngBRegion::getId, dto.getId()));
if (codeCount > 0) { if (codeCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION, throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.CODE)); FieldNameConstants.CODE));
} }
Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBRegion>() Long nameCount = this.baseMapper.selectCount(new LambdaQueryWrapper<LngBRegion>()
.eq(LngBRegion::getFullName, dto.getFullName())); .eq(LngBRegion::getFullName, dto.getFullName()).ne(dto.getId() != null, LngBRegion::getId, dto.getId()));
if (nameCount > 0) { if (nameCount > 0) {
throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION, throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DATA_FIELD_DUPLICATION,
FieldNameConstants.FULL_NAME)); FieldNameConstants.FULL_NAME));