update
This commit is contained in:
@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class AddLngContractDto extends com.xjrsoft.common.model.base.BaseModel {
|
||||
public class AddLngContractPurDto extends com.xjrsoft.common.model.base.BaseModel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -25,7 +25,7 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@LogTable(source="lng_contract",name="国内管道气采购")
|
||||
public class UpdateLngContractDto implements Serializable {
|
||||
public class UpdateLngContractPurDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -1,15 +1,10 @@
|
||||
package com.xjrsoft.module.contract.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import com.xjrsoft.common.annotation.Trans;
|
||||
import com.xjrsoft.common.enums.TransType;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @title: 分页列表出参
|
||||
* @Author 管理员
|
||||
@ -17,7 +12,7 @@ import java.math.BigDecimal;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class LngContractPageVo {
|
||||
public class LngContractPurPageVo {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
@ -13,7 +13,7 @@ import lombok.Data;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class LngContractVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
public class LngContractPurVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
|
||||
/**
|
||||
* 主键
|
||||
@ -1,36 +1,40 @@
|
||||
package com.xjrsoft.module.contract.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.service.IContractPurPngService;
|
||||
import com.xjrsoft.module.contract.vo.LngContractPurPageVo;
|
||||
import com.xjrsoft.module.contract.vo.LngContractPurVo;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.contract.dto.AddLngContractDto;
|
||||
import com.xjrsoft.module.contract.dto.UpdateLngContractDto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.module.contract.dto.LngContractPageDto;
|
||||
import com.xjrsoft.module.contract.entity.LngContract;
|
||||
import com.xjrsoft.module.contract.service.IContractPurPngService;
|
||||
import com.xjrsoft.module.contract.vo.LngContractPageVo;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.contract.vo.LngContractVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 国内管道气采购
|
||||
@ -53,23 +57,23 @@ public class ContractPurPngController {
|
||||
@SaCheckPermission("contractPurPng:list")
|
||||
public R page(@Valid LngContractPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<LngContract> queryWrapper = new LambdaQueryWrapper<>();
|
||||
LambdaQueryWrapper<LngContractPur> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.eq(ObjectUtil.isNotNull(dto.getId()),LngContract::getId,dto.getId())
|
||||
.like(StrUtil.isNotBlank(dto.getKNo()),LngContract::getKNo,dto.getKNo())
|
||||
.like(StrUtil.isNotBlank(dto.getKName()),LngContract::getKName,dto.getKName())
|
||||
.like(StrUtil.isNotBlank(dto.getCpName()),LngContract::getCpName,dto.getCpName())
|
||||
.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()),LngContract::getApproCode,dto.getApproCode())
|
||||
.like(StrUtil.isNotBlank(dto.getCpTableName()),LngContract::getCpTableName,dto.getCpTableName())
|
||||
.like(StrUtil.isNotBlank(dto.getOnlineSign()),LngContract::getOnlineSign,dto.getOnlineSign())
|
||||
.eq(ObjectUtil.isNotNull(dto.getComId()),LngContract::getComId,dto.getComId())
|
||||
.like(StrUtil.isNotBlank(dto.getNote()),LngContract::getNote,dto.getNote())
|
||||
.orderByDesc(LngContract::getId)
|
||||
.select(LngContract.class,x -> VoToColumnUtil.fieldsToColumns(LngContractPageVo.class).contains(x.getProperty()));
|
||||
IPage<LngContract> page = contractPurPngService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngContractPageVo> pageOutput = ConventPage.getPageOutput(page, LngContractPageVo.class);
|
||||
.like(StrUtil.isNotBlank(dto.getApproCode()),LngContractPur::getApproCode,dto.getApproCode())
|
||||
.like(StrUtil.isNotBlank(dto.getCpTableName()),LngContractPur::getCpTableName,dto.getCpTableName())
|
||||
.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()));
|
||||
IPage<LngContractPur> page = contractPurPngService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngContractPurPageVo> pageOutput = ConventPage.getPageOutput(page, LngContractPurPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@ -77,18 +81,18 @@ public class ContractPurPngController {
|
||||
@ApiOperation(value="根据id查询LngContract信息")
|
||||
@SaCheckPermission("contractPurPng:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
LngContract lngContract = contractPurPngService.getByIdDeep(id);
|
||||
LngContractPur lngContract = contractPurPngService.getByIdDeep(id);
|
||||
if (lngContract == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(lngContract, LngContractVo.class));
|
||||
return R.ok(BeanUtil.toBean(lngContract, LngContractPurVo.class));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/datalog")
|
||||
@ApiOperation(value="根据id查询LngContract数据详细日志")
|
||||
@SaCheckPermission("contractPurPng:datalog")
|
||||
public R datalog(@RequestParam Long id){
|
||||
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngContractDto.class,id);
|
||||
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngContractPurDto.class,id);
|
||||
return R.ok(logs);
|
||||
}
|
||||
|
||||
@ -96,15 +100,15 @@ public class ContractPurPngController {
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增LngContract")
|
||||
@SaCheckPermission("contractPurPng:add")
|
||||
public R add(@Valid @RequestBody UpdateLngContractDto dto){
|
||||
UpdateLngContractDto res = dataService.insert(dto);
|
||||
public R add(@Valid @RequestBody UpdateLngContractPurDto dto){
|
||||
UpdateLngContractPurDto res = dataService.insert(dto);
|
||||
return R.ok(res.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改LngContract")
|
||||
@SaCheckPermission("contractPurPng:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngContractDto dto){
|
||||
public R update(@Valid @RequestBody UpdateLngContractPurDto dto){
|
||||
return R.ok(dataService.updateById(dto));
|
||||
}
|
||||
|
||||
@ -112,7 +116,7 @@ public class ContractPurPngController {
|
||||
@ApiOperation(value = "删除")
|
||||
@SaCheckPermission("contractPurPng:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.deleteByIds(UpdateLngContractDto.class, ids));
|
||||
return R.ok(dataService.deleteByIds(UpdateLngContractPurDto.class, ids));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ import java.util.List;
|
||||
@Data
|
||||
@TableName("lng_contract")
|
||||
@ApiModel(value = "国内管道气采购对象", description = "国内管道气采购")
|
||||
public class LngContract implements Serializable {
|
||||
public class LngContractPur implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -138,9 +138,6 @@ public class LngContract implements Serializable {
|
||||
* 有效期开始
|
||||
*/
|
||||
@ApiModelProperty("有效期开始")
|
||||
|
||||
|
||||
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private LocalDateTime dateFrom;
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package com.xjrsoft.module.contract.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.contract.entity.LngContractFactRel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
@ -12,6 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngContractFactRelMapper extends MPJBaseMapper<LngContractFactRel> {
|
||||
public interface LngContractFactRelMapper extends MPJBaseMapper<LngContractFactRel>,BaseMapper<LngContractFactRel> {
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ package com.xjrsoft.module.contract.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.contract.entity.LngContract;
|
||||
import com.xjrsoft.module.contract.entity.LngContractPur;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngContractMapper extends MPJBaseMapper<LngContract> {
|
||||
public interface LngContractPurMapper extends MPJBaseMapper<LngContractPur>, BaseMapper<LngContractPur> {
|
||||
|
||||
}
|
||||
@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngContractPurPngMapper extends MPJBaseMapper<LngContractPurPng> {
|
||||
public interface LngContractPurPngMapper extends MPJBaseMapper<LngContractPurPng> , BaseMapper<LngContractPurPng>{
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@ package com.xjrsoft.module.contract.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.contract.entity.LngContractPurPngPoint;
|
||||
import com.xjrsoft.module.contract.entity.LngContractPurPngQty;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@ -12,6 +14,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngContractPurPngPointMapper extends MPJBaseMapper<LngContractPurPngPoint> {
|
||||
public interface LngContractPurPngPointMapper extends MPJBaseMapper<LngContractPurPngPoint> , BaseMapper<LngContractPurPngPoint>{
|
||||
|
||||
}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package com.xjrsoft.module.contract.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.contract.entity.LngContractPurPngQty;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
@ -12,6 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngContractPurPngQtyMapper extends MPJBaseMapper<LngContractPurPngQty> {
|
||||
public interface LngContractPurPngQtyMapper extends MPJBaseMapper<LngContractPurPngQty>, BaseMapper<LngContractPurPngQty> {
|
||||
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||
import com.xjrsoft.module.contract.entity.LngContract;
|
||||
import com.xjrsoft.module.contract.entity.LngContractPur;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@ -15,28 +15,6 @@ import java.util.List;
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface IContractPurPngService extends MPJBaseService<LngContract>, MPJDeepService<LngContract>, MPJRelationService<LngContract> {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param lngContract
|
||||
* @return
|
||||
*/
|
||||
Boolean add(LngContract lngContract);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param lngContract
|
||||
* @return
|
||||
*/
|
||||
Boolean update(LngContract lngContract);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Boolean delete(List<Long> ids);
|
||||
public interface IContractPurPngService extends MPJBaseService<LngContractPur>, MPJDeepService<LngContractPur>, MPJRelationService<LngContractPur> {
|
||||
|
||||
}
|
||||
|
||||
@ -1,26 +1,10 @@
|
||||
package com.xjrsoft.module.contract.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.module.contract.entity.LngContract;
|
||||
import com.xjrsoft.module.contract.entity.LngContractApproRel;
|
||||
import com.xjrsoft.module.contract.entity.LngContractFactRel;
|
||||
import com.xjrsoft.module.contract.entity.LngContractPurPng;
|
||||
import com.xjrsoft.module.contract.entity.LngContractPurPngPoint;
|
||||
import com.xjrsoft.module.contract.entity.LngContractPurPngQty;
|
||||
import com.xjrsoft.module.contract.mapper.LngContractApproRelMapper;
|
||||
import com.xjrsoft.module.contract.mapper.LngContractFactRelMapper;
|
||||
import com.xjrsoft.module.contract.mapper.LngContractMapper;
|
||||
import com.xjrsoft.module.contract.mapper.LngContractPurPngMapper;
|
||||
import com.xjrsoft.module.contract.mapper.LngContractPurPngPointMapper;
|
||||
import com.xjrsoft.module.contract.mapper.LngContractPurPngQtyMapper;
|
||||
import com.xjrsoft.module.contract.entity.LngContractPur;
|
||||
import com.xjrsoft.module.contract.mapper.LngContractPurMapper;
|
||||
import com.xjrsoft.module.contract.service.IContractPurPngService;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -33,206 +17,6 @@ import lombok.AllArgsConstructor;
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class ContractPurPngServiceImpl extends MPJBaseServiceImpl<LngContractMapper, LngContract> implements IContractPurPngService {
|
||||
private final LngContractMapper contractPurPngLngContractMapper;
|
||||
|
||||
private final LngContractPurPngMapper contractPurPngLngContractPurPngMapper;
|
||||
private final LngContractPurPngPointMapper contractPurPngLngContractPurPngPointMapper;
|
||||
private final LngContractPurPngQtyMapper contractPurPngLngContractPurPngQtyMapper;
|
||||
private final LngContractApproRelMapper contractPurPngLngContractApproRelMapper;
|
||||
private final LngContractFactRelMapper contractPurPngLngContractFactRelMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(LngContract lngContract) {
|
||||
contractPurPngLngContractMapper.insert(lngContract);
|
||||
for (LngContractPurPng lngContractPurPng : lngContract.getLngContractPurPngList()) {
|
||||
lngContractPurPng.setKId(lngContract.getId());
|
||||
contractPurPngLngContractPurPngMapper.insert(lngContractPurPng);
|
||||
}
|
||||
for (LngContractPurPngPoint lngContractPurPngPoint : lngContract.getLngContractPurPngPointList()) {
|
||||
lngContractPurPngPoint.setKId(lngContract.getId());
|
||||
contractPurPngLngContractPurPngPointMapper.insert(lngContractPurPngPoint);
|
||||
}
|
||||
for (LngContractPurPngQty lngContractPurPngQty : lngContract.getLngContractPurPngQtyList()) {
|
||||
lngContractPurPngQty.setKId(lngContract.getId());
|
||||
contractPurPngLngContractPurPngQtyMapper.insert(lngContractPurPngQty);
|
||||
}
|
||||
for (LngContractApproRel lngContractApproRel : lngContract.getLngContractApproRelList()) {
|
||||
lngContractApproRel.setTableId(lngContract.getId());
|
||||
contractPurPngLngContractApproRelMapper.insert(lngContractApproRel);
|
||||
}
|
||||
for (LngContractFactRel lngContractFactRel : lngContract.getLngContractFactRelList()) {
|
||||
lngContractFactRel.setKId(lngContract.getId());
|
||||
contractPurPngLngContractFactRelMapper.insert(lngContractFactRel);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean update(LngContract lngContract) {
|
||||
contractPurPngLngContractMapper.updateById(lngContract);
|
||||
//********************************* LngContractPurPng 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngContractPurPng> lngContractPurPngList = contractPurPngLngContractPurPngMapper.selectList(Wrappers.lambdaQuery(LngContractPurPng.class).eq(LngContractPurPng::getKId, lngContract.getId()).select(LngContractPurPng::getId));
|
||||
List<Long> lngContractPurPngIds = lngContractPurPngList.stream().map(LngContractPurPng::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngContractPurPngOldIds = lngContract.getLngContractPurPngList().stream().map(LngContractPurPng::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngContractPurPngRemoveIds = lngContractPurPngIds.stream().filter(item -> !lngContractPurPngOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngContractPurPng lngContractPurPng : lngContract.getLngContractPurPngList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngContractPurPng.getId() != null) {
|
||||
contractPurPngLngContractPurPngMapper.updateById(lngContractPurPng);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngContractPurPng.setKId(lngContract.getId());
|
||||
contractPurPngLngContractPurPngMapper.insert(lngContractPurPng);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngContractPurPngRemoveIds.size() > 0){
|
||||
contractPurPngLngContractPurPngMapper.deleteBatchIds(lngContractPurPngRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngContractPurPng 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngContractPurPngPoint 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngContractPurPngPoint> lngContractPurPngPointList = contractPurPngLngContractPurPngPointMapper.selectList(Wrappers.lambdaQuery(LngContractPurPngPoint.class).eq(LngContractPurPngPoint::getKId, lngContract.getId()).select(LngContractPurPngPoint::getId));
|
||||
List<Long> lngContractPurPngPointIds = lngContractPurPngPointList.stream().map(LngContractPurPngPoint::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngContractPurPngPointOldIds = lngContract.getLngContractPurPngPointList().stream().map(LngContractPurPngPoint::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngContractPurPngPointRemoveIds = lngContractPurPngPointIds.stream().filter(item -> !lngContractPurPngPointOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngContractPurPngPoint lngContractPurPngPoint : lngContract.getLngContractPurPngPointList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngContractPurPngPoint.getId() != null) {
|
||||
contractPurPngLngContractPurPngPointMapper.updateById(lngContractPurPngPoint);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngContractPurPngPoint.setKId(lngContract.getId());
|
||||
contractPurPngLngContractPurPngPointMapper.insert(lngContractPurPngPoint);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngContractPurPngPointRemoveIds.size() > 0){
|
||||
contractPurPngLngContractPurPngPointMapper.deleteBatchIds(lngContractPurPngPointRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngContractPurPngPoint 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngContractPurPngQty 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngContractPurPngQty> lngContractPurPngQtyList = contractPurPngLngContractPurPngQtyMapper.selectList(Wrappers.lambdaQuery(LngContractPurPngQty.class).eq(LngContractPurPngQty::getKId, lngContract.getId()).select(LngContractPurPngQty::getId));
|
||||
List<Long> lngContractPurPngQtyIds = lngContractPurPngQtyList.stream().map(LngContractPurPngQty::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngContractPurPngQtyOldIds = lngContract.getLngContractPurPngQtyList().stream().map(LngContractPurPngQty::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngContractPurPngQtyRemoveIds = lngContractPurPngQtyIds.stream().filter(item -> !lngContractPurPngQtyOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngContractPurPngQty lngContractPurPngQty : lngContract.getLngContractPurPngQtyList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngContractPurPngQty.getId() != null) {
|
||||
contractPurPngLngContractPurPngQtyMapper.updateById(lngContractPurPngQty);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngContractPurPngQty.setKId(lngContract.getId());
|
||||
contractPurPngLngContractPurPngQtyMapper.insert(lngContractPurPngQty);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngContractPurPngQtyRemoveIds.size() > 0){
|
||||
contractPurPngLngContractPurPngQtyMapper.deleteBatchIds(lngContractPurPngQtyRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngContractPurPngQty 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngContractApproRel 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngContractApproRel> lngContractApproRelList = contractPurPngLngContractApproRelMapper.selectList(Wrappers.lambdaQuery(LngContractApproRel.class).eq(LngContractApproRel::getTableId, lngContract.getId()).select(LngContractApproRel::getId));
|
||||
List<Long> lngContractApproRelIds = lngContractApproRelList.stream().map(LngContractApproRel::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngContractApproRelOldIds = lngContract.getLngContractApproRelList().stream().map(LngContractApproRel::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngContractApproRelRemoveIds = lngContractApproRelIds.stream().filter(item -> !lngContractApproRelOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngContractApproRel lngContractApproRel : lngContract.getLngContractApproRelList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngContractApproRel.getId() != null) {
|
||||
contractPurPngLngContractApproRelMapper.updateById(lngContractApproRel);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngContractApproRel.setTableId(lngContract.getId());
|
||||
contractPurPngLngContractApproRelMapper.insert(lngContractApproRel);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngContractApproRelRemoveIds.size() > 0){
|
||||
contractPurPngLngContractApproRelMapper.deleteBatchIds(lngContractApproRelRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngContractApproRel 增删改 结束 *******************************************/
|
||||
|
||||
//********************************* LngContractFactRel 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngContractFactRel> lngContractFactRelList = contractPurPngLngContractFactRelMapper.selectList(Wrappers.lambdaQuery(LngContractFactRel.class).eq(LngContractFactRel::getKId, lngContract.getId()).select(LngContractFactRel::getId));
|
||||
List<Long> lngContractFactRelIds = lngContractFactRelList.stream().map(LngContractFactRel::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngContractFactRelOldIds = lngContract.getLngContractFactRelList().stream().map(LngContractFactRel::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngContractFactRelRemoveIds = lngContractFactRelIds.stream().filter(item -> !lngContractFactRelOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngContractFactRel lngContractFactRel : lngContract.getLngContractFactRelList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngContractFactRel.getId() != null) {
|
||||
contractPurPngLngContractFactRelMapper.updateById(lngContractFactRel);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngContractFactRel.setKId(lngContract.getId());
|
||||
contractPurPngLngContractFactRelMapper.insert(lngContractFactRel);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngContractFactRelRemoveIds.size() > 0){
|
||||
contractPurPngLngContractFactRelMapper.deleteBatchIds(lngContractFactRelRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngContractFactRel 增删改 结束 *******************************************/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delete(List<Long> ids) {
|
||||
contractPurPngLngContractMapper.deleteBatchIds(ids);
|
||||
contractPurPngLngContractPurPngMapper.delete(Wrappers.lambdaQuery(LngContractPurPng.class).in(LngContractPurPng::getKId, ids));
|
||||
contractPurPngLngContractPurPngPointMapper.delete(Wrappers.lambdaQuery(LngContractPurPngPoint.class).in(LngContractPurPngPoint::getKId, ids));
|
||||
contractPurPngLngContractPurPngQtyMapper.delete(Wrappers.lambdaQuery(LngContractPurPngQty.class).in(LngContractPurPngQty::getKId, ids));
|
||||
contractPurPngLngContractApproRelMapper.delete(Wrappers.lambdaQuery(LngContractApproRel.class).in(LngContractApproRel::getTableId, ids));
|
||||
contractPurPngLngContractFactRelMapper.delete(Wrappers.lambdaQuery(LngContractFactRel.class).in(LngContractFactRel::getKId, ids));
|
||||
|
||||
return true;
|
||||
}
|
||||
public class ContractPurPngServiceImpl extends MPJBaseServiceImpl<LngContractPurMapper, LngContractPur> implements IContractPurPngService {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user