update 多级子表的新增和保存

This commit is contained in:
2026-01-06 14:33:02 +08:00
parent 3d26c74d9a
commit 529c4720fb
5 changed files with 94 additions and 19 deletions

View File

@ -15,15 +15,17 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.contract.dto.LngContractPageDto;
import com.xjrsoft.module.contract.dto.UpdateLngContractPurDto;
import com.xjrsoft.module.contract.entity.LngContractPur;
import com.xjrsoft.module.contract.entity.LngContractPurPngPoint;
import com.xjrsoft.module.contract.service.IContractPurPngService;
import com.xjrsoft.module.contract.vo.LngContractPurPageVo;
import com.xjrsoft.module.datalog.service.DatalogService;
@ -57,21 +59,17 @@ public class ContractPurPngController {
@SaCheckPermission("contractPurPng:list")
public R page(@Valid LngContractPageDto dto){
LambdaQueryWrapper<LngContractPur> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper
.eq(ObjectUtil.isNotNull(dto.getId()),LngContractPur::getId,dto.getId())
LambdaQueryWrapper<LngContractPur> queryWrapper = new LambdaQueryWrapper<LngContractPur>();
queryWrapper.eq(ObjectUtil.isNotNull(dto.getId()),LngContractPur::getId,dto.getId())
.like(StrUtil.isNotBlank(dto.getKNo()),LngContractPur::getKNo,dto.getKNo())
.like(StrUtil.isNotBlank(dto.getKName()),LngContractPur::getKName,dto.getKName())
.like(StrUtil.isNotBlank(dto.getCpName()),LngContractPur::getCpName,dto.getCpName())
//.between(ObjectUtil.isNotNull(dto.getDateFromStart()) && ObjectUtil.isNotNull(dto.getDateFromEnd()),LngContract::getDateFrom,dto.getDateFromStart(),dto.getDateFromEnd())
//.between(ObjectUtil.isNotNull(dto.getDateToStart()) && ObjectUtil.isNotNull(dto.getDateToEnd()),LngContract::getDateTo,dto.getDateToStart(),dto.getDateToEnd())
.like(StrUtil.isNotBlank(dto.getApproCode()),LngContractPur::getApproCode,dto.getApproCode())
.like(StrUtil.isNotBlank(dto.getCpTableName()),LngContractPur::getCpTableName,dto.getCpTableName())
.eq(LngContractPur::getCpTableName,"lng_supplier")
.like(StrUtil.isNotBlank(dto.getOnlineSign()),LngContractPur::getOnlineSign,dto.getOnlineSign())
.eq(ObjectUtil.isNotNull(dto.getComId()),LngContractPur::getComId,dto.getComId())
.like(StrUtil.isNotBlank(dto.getNote()),LngContractPur::getNote,dto.getNote())
.orderByDesc(LngContractPur::getId)
.select(LngContractPur.class,x -> VoToColumnUtil.fieldsToColumns(LngContractPurPageVo.class).contains(x.getProperty()));
.eq(ObjectUtil.isNotNull(dto.getComId()),LngContractPur::getComId,dto.getComId());
IPage<LngContractPur> page = contractPurPngService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngContractPurPageVo> pageOutput = ConventPage.getPageOutput(page, LngContractPurPageVo.class);
return R.ok(pageOutput);
@ -118,7 +116,7 @@ public class ContractPurPngController {
@SaCheckPermission("contractPurPng:edit")
public R update(@Valid @RequestBody UpdateLngContractPurDto dto){
//return R.ok(dataService.updateById(dto));
UpdateLngContractPurDto res = dataService.insert(dto, new DataOperationListener<UpdateLngContractPurDto>() {
boolean res = dataService.updateById(dto, new DataOperationListener<UpdateLngContractPurDto>() {
@Override
public UpdateLngContractPurDto before(DataOperationContent<UpdateLngContractPurDto> content) {
return null;
@ -136,9 +134,20 @@ public class ContractPurPngController {
@ApiOperation(value = "删除")
@SaCheckPermission("contractPurPng:delete")
public R delete(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.deleteByIds(UpdateLngContractPurDto.class, ids));
boolean res = dataService.deleteByIds(UpdateLngContractPurDto.class,ids, new DataOperationListener<UpdateLngContractPurDto>() {
@Override
public UpdateLngContractPurDto before(DataOperationContent<UpdateLngContractPurDto> content) {
return null;
}
@Override
public UpdateLngContractPurDto after(DataOperationContent<UpdateLngContractPurDto> content) {
return null;
}
});
return R.ok(res);
}
}
}

View File

@ -133,7 +133,7 @@ public class CustomerScoreController {
@ApiOperation(value = "删除")
@SaCheckPermission("scoreCustomer:delete")
public R delete(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.deleteByIds(UpdateLngScoreDto.class, ids));
return R.ok(dataService.deleteByIds(UpdateLngScoreDto.class, ids));
}