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

@ -81,7 +81,10 @@ public class UpdateLngContractPurPngPointDto implements Serializable {
@ApiModelProperty("lngContractPurPngPoint子表")
@LogJoin(name = "lngContractPurPngPoint子表",
columns = {
@LogJoinColumn(field = "kpppId",relatedField = "id", valueDirection = ValueDirectionType.RIGHT)
@LogJoinColumn(field = "kId",relatedField = "kId", valueDirection = ValueDirectionType.RIGHT),
@LogJoinColumn(field = "id",relatedField = "kpppId", valueDirection = ValueDirectionType.RIGHT)
},
caseType = JoinCaseType.FULL, target = UpdateLngContractPurPngPointSalesDto.class, type = JoinType.MANY)
private List<UpdateLngContractPurPngPointSalesDto> lngContractPurPngPointSalesList;

View File

@ -2,6 +2,9 @@ package com.xjrsoft.module.contract.vo;
import java.time.LocalDateTime;
import com.xjrsoft.common.annotation.Trans;
import com.xjrsoft.common.enums.TransType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -38,6 +41,7 @@ public class LngContractPurPageVo {
* 是否线上(竞拍)合同(Y-是N-否;线上合同不需要审批)
*/
@ApiModelProperty("是否线上(竞拍)合同(Y-是N-否;线上合同不需要审批)")
@Trans(type = TransType.DIC, id = "1978057078528327681")
private String onlineSign;
/**
* 交易对手类型(lng_supplier-供应商lng_customer-客户;不显示)
@ -59,11 +63,16 @@ public class LngContractPurPageVo {
*/
@ApiModelProperty("有效期结束")
private LocalDateTime dateTo;
/**
* 状态(未提交/审批中/已审批/已驳回)
*/
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")
private String approCode;
* 状态(未提交/审批中/已审批/已驳回)
*/
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")
@Trans(type = TransType.DIC, id = "1990669393069129729", transToFieldName = "approName")
private String approCode;
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")
private String approName;
/**
* 备注
*/

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));
}