新增合同收发货规则

This commit is contained in:
潘荣晟
2026-01-07 16:10:45 +08:00
parent 960c5b5b25
commit cb554f35f3
17 changed files with 720 additions and 30 deletions

View File

@@ -0,0 +1,105 @@
package com.zt.plat.module.contractorder.controller.admin.contractreceivesend;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendPageReqVO;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendRespVO;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendSaveReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO;
import com.zt.plat.module.contractorder.service.contractreceivesend.ContractReceiveSendService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 收发货规则")
@RestController
@RequestMapping("/base/contract-receive-send")
@Validated
public class ContractReceiveSendController implements BusinessControllerMarker {
@Resource
private ContractReceiveSendService contractReceiveSendService;
@PostMapping("/create")
@Operation(summary = "创建收发货规则")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:create')")
public CommonResult<ContractReceiveSendRespVO> createContractReceiveSend(@Valid @RequestBody ContractReceiveSendSaveReqVO createReqVO) {
return success(contractReceiveSendService.createContractReceiveSend(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新收发货规则")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:update')")
public CommonResult<Boolean> updateContractReceiveSend(@Valid @RequestBody ContractReceiveSendSaveReqVO updateReqVO) {
contractReceiveSendService.updateContractReceiveSend(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除收发货规则")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:delete')")
public CommonResult<Boolean> deleteContractReceiveSend(@RequestParam("id") Long id) {
contractReceiveSendService.deleteContractReceiveSend(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除收发货规则")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:delete')")
public CommonResult<Boolean> deleteContractReceiveSendList(@RequestBody BatchDeleteReqVO req) {
contractReceiveSendService.deleteContractReceiveSendListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得收发货规则")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:query')")
public CommonResult<ContractReceiveSendRespVO> getContractReceiveSend(@RequestParam("id") Long id) {
ContractReceiveSendDO contractReceiveSend = contractReceiveSendService.getContractReceiveSend(id);
return success(BeanUtils.toBean(contractReceiveSend, ContractReceiveSendRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得收发货规则分页")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:query')")
public CommonResult<PageResult<ContractReceiveSendRespVO>> getContractReceiveSendPage(@Valid ContractReceiveSendPageReqVO pageReqVO) {
PageResult<ContractReceiveSendDO> pageResult = contractReceiveSendService.getContractReceiveSendPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ContractReceiveSendRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出收发货规则 Excel")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportContractReceiveSendExcel(@Valid ContractReceiveSendPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ContractReceiveSendDO> list = contractReceiveSendService.getContractReceiveSendPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "收发货规则.xls", "数据", ContractReceiveSendRespVO.class,
BeanUtils.toBean(list, ContractReceiveSendRespVO.class));
}
}

View File

@@ -450,4 +450,9 @@ public class ContractMainDO extends BusinessBaseDO {
*/
@TableField("SALE_TAX_NUM")
private String salesTaxNumber;
/**
* 否启用授信
*/
@TableField("HS_CRDT")
private String hasCredit;
}

View File

@@ -0,0 +1,88 @@
package com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*;
/**
* 收发货规则 DO
*
* @author 后台管理-1
*/
@TableName("bse_ctrt_rcv_snd")
@KeySequence("bse_ctrt_rcv_snd_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class ContractReceiveSendDO extends BusinessBaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 物料名称
*/
@TableField("MTRL_NAME")
private String materialName;
/**
* 物料编码
*/
@TableField("MTRL_NUM")
private String materialNumber;
/**
* 元素缩写
*/
@TableField("ELEM_ABBR")
private String elementAbbreviation;
/**
* 元素名称
*/
@TableField("ELEM_NAME")
private String elementName;
/**
* 元素编码
*/
@TableField("ELEM_NUM")
private String elementNumber;
/**
* 类型
*/
@TableField("TP")
private String type;
/**
* 规则
*/
@TableField("RUL")
private String rule;
/**
* 区间方式
*/
@TableField("RNG_WY")
private String rangeWay;
/**
* 区间下限
*/
@TableField("GRD_DOWN")
private String gradeDown;
/**
* 区间上限
*/
@TableField("GRD_UP")
private String gradeUp;
/**
* 合同id
*/
@TableField("CTRT_ID")
private Long contractId;
}

View File

@@ -0,0 +1,36 @@
package com.zt.plat.module.contractorder.dal.mysql.contractreceivesend;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendPageReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 收发货规则 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface ContractReceiveSendMapper extends BaseMapperX<ContractReceiveSendDO> {
default PageResult<ContractReceiveSendDO> selectPage(ContractReceiveSendPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ContractReceiveSendDO>()
.likeIfPresent(ContractReceiveSendDO::getMaterialName, reqVO.getMaterialName())
.eqIfPresent(ContractReceiveSendDO::getMaterialNumber, reqVO.getMaterialNumber())
.eqIfPresent(ContractReceiveSendDO::getElementAbbreviation, reqVO.getElementAbbreviation())
.likeIfPresent(ContractReceiveSendDO::getElementName, reqVO.getElementName())
.eqIfPresent(ContractReceiveSendDO::getElementNumber, reqVO.getElementNumber())
.eqIfPresent(ContractReceiveSendDO::getType, reqVO.getType())
.eqIfPresent(ContractReceiveSendDO::getRule, reqVO.getRule())
.eqIfPresent(ContractReceiveSendDO::getRangeWay, reqVO.getRangeWay())
.eqIfPresent(ContractReceiveSendDO::getGradeDown, reqVO.getGradeDown())
.eqIfPresent(ContractReceiveSendDO::getGradeUp, reqVO.getGradeUp())
.eqIfPresent(ContractReceiveSendDO::getContractId, reqVO.getContractId())
.betweenIfPresent(ContractReceiveSendDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ContractReceiveSendDO::getId));
}
}

View File

@@ -34,6 +34,7 @@ import com.zt.plat.module.contractorder.enums.DictTypeConstants;
import com.zt.plat.module.contractorder.enums.ProcessConstants;
import com.zt.plat.module.contractorder.enums.TableFieldConstants;
import com.zt.plat.module.contractorder.enums.contract.DictEnum;
import com.zt.plat.module.contractorder.service.contractreceivesend.ContractReceiveSendService;
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractPageReqVO;
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
@@ -118,6 +119,9 @@ public class ContractServiceImpl implements ContractService {
@Resource
private TmplInscItmBsnService tmplInscItmBsnService;
@Resource
private ContractReceiveSendService contractReceiveSendService;
@Override
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
return contractMainMapper.selectContractPage(pageReqVO);
@@ -177,7 +181,7 @@ public class ContractServiceImpl implements ContractService {
// 合同明细ID
Long detailDOId = detailDO.getId();
// 交货计划
if (detail.getPlans() != null && !detail.getPlans().isEmpty()) {
if (detail.getPlans() != null && !detail.getPlans().isEmpty()) {
detail.getPlans().forEach(plan -> {
// 交货计划DO
ContractPlanDO planDO = BeanUtils.toBean(plan, ContractPlanDO.class);
@@ -236,7 +240,7 @@ public class ContractServiceImpl implements ContractService {
});
}
// 市场价配置
if (formula.getPrices()!= null && !formula.getPrices().isEmpty()) {
if (formula.getPrices() != null && !formula.getPrices().isEmpty()) {
formula.getPrices().forEach(price -> {
// 市场价配置DO
ContractPriceDO priceDO = BeanUtils.toBean(price, ContractPriceDO.class);
@@ -297,7 +301,13 @@ public class ContractServiceImpl implements ContractService {
// });
tmplInscItmBsnService.updateTmplInscItmBsnBatch(dynamicsItems);
}
//插入收发货规则
if (reqVO.getContractReceiveSends() != null && !reqVO.getContractReceiveSends().isEmpty()) {
reqVO.getContractReceiveSends().forEach(contractReceiveSend -> {
contractReceiveSend.setContractId(contractId);
contractReceiveSendService.createContractReceiveSend(contractReceiveSend);
});
}
return contractId;
}
@@ -400,7 +410,7 @@ public class ContractServiceImpl implements ContractService {
ContractRespVO respVO = new ContractRespVO();
// 查询并设置合同主信息
ContractMainDO contractMainDO = contractMainMapper.selectOne(TableFieldConstants.BSE_CTRT_MAIN_SYS_CTRT_NUM,systemContractNumber);
ContractMainDO contractMainDO = contractMainMapper.selectOne(TableFieldConstants.BSE_CTRT_MAIN_SYS_CTRT_NUM, systemContractNumber);
if (contractMainDO == null) {
throw exception(CONTRACT_NOT_EXISTS);
}
@@ -504,7 +514,7 @@ public class ContractServiceImpl implements ContractService {
// 已关联的上游合同id集合
List<SystemRelativityDO> systemRelativityDOS = systemRelativityMapper.selectList();
LinkedHashSet<String> relationIds = new LinkedHashSet<>();
if (systemRelativityDOS!= null && !systemRelativityDOS.isEmpty()) {
if (systemRelativityDOS != null && !systemRelativityDOS.isEmpty()) {
systemRelativityDOS.forEach(systemRelativityDO -> {
relationIds.add(systemRelativityDO.getUpId());
});
@@ -528,7 +538,7 @@ public class ContractServiceImpl implements ContractService {
// 查询
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
result = BeanUtils.toBean(contractMainDOS, ContractRespVO.class);
} else if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(direction)){ // 支出
} else if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(direction)) { // 支出
// 如果“收支性质”字段为支出,用“乙方公司编号”字段筛选“合同主信息”表中字段等于“甲方公司编号”的数据
if (StringUtils.isEmpty(salesCompanyNumber)) {
// 乙方公司编号不存在
@@ -572,7 +582,7 @@ public class ContractServiceImpl implements ContractService {
// 已关联的上游合同id集合
List<SystemRelativityDO> systemRelativityDOS = systemRelativityMapper.selectList();
LinkedHashSet<String> relationIds = new LinkedHashSet<>();
if (systemRelativityDOS!= null && !systemRelativityDOS.isEmpty()) {
if (systemRelativityDOS != null && !systemRelativityDOS.isEmpty()) {
systemRelativityDOS.forEach(systemRelativityDO -> {
relationIds.add(systemRelativityDO.getDownId());
});
@@ -596,7 +606,7 @@ public class ContractServiceImpl implements ContractService {
// 查询
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
result = BeanUtils.toBean(contractMainDOS, ContractRespVO.class);
} else if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(direction)){ // 支出
} else if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(direction)) { // 支出
// 如果“收支性质”字段为支出,用“乙方公司编号”字段筛选“合同主信息”表中字段等于“甲方公司编号”的数据
if (StringUtils.isEmpty(salesCompanyNumber)) {
// 乙方公司编号不存在
@@ -790,7 +800,7 @@ public class ContractServiceImpl implements ContractService {
// 合同明细ID
Long detailDOId = detailDO.getId();
// 交货计划
if (detail.getPlans() != null && !detail.getPlans().isEmpty()) {
if (detail.getPlans() != null && !detail.getPlans().isEmpty()) {
detail.getPlans().forEach(plan -> {
// 交货计划DO
ContractPlanDO planDO = BeanUtils.toBean(plan, ContractPlanDO.class);
@@ -859,7 +869,7 @@ public class ContractServiceImpl implements ContractService {
});
}
// 市场价配置
if (formula.getPrices()!= null && !formula.getPrices().isEmpty()) {
if (formula.getPrices() != null && !formula.getPrices().isEmpty()) {
formula.getPrices().forEach(price -> {
// 市场价配置DO
ContractPriceDO priceDO = BeanUtils.toBean(price, ContractPriceDO.class);
@@ -1369,6 +1379,9 @@ public class ContractServiceImpl implements ContractService {
if (notDOS != null && !notDOS.isEmpty()) {
respDTO.setNots(BeanUtils.toBean(notDOS, NotRespDTO.class));
}
//收发货
List<ContractReceiveSendRespVO> contractReceiveSendListByContractId = contractReceiveSendService.getContractReceiveSendListByContractId(contractMainDO.getId());
respDTO.setContractReceiveSends(BeanUtils.toBean(contractReceiveSendListByContractId, ContractReceiveSendRespDTO.class));
return respDTO;
}
@@ -1503,7 +1516,7 @@ public class ContractServiceImpl implements ContractService {
}
// 上传模板附件
if(StringUtils.isNotBlank(contractMainDO.getFileObject())){
if (StringUtils.isNotBlank(contractMainDO.getFileObject())) {
JSONArray fileObjects = new JSONArray(contractMainDO.getFileObject());
for (int i = 0; i < fileObjects.size(); i++) {
JSONObject file = fileObjects.getJSONObject(i);
@@ -1517,7 +1530,7 @@ public class ContractServiceImpl implements ContractService {
}
// 合同其它附件
if(StringUtils.isNotBlank(contractMainDO.getFileObjectOther())){
if (StringUtils.isNotBlank(contractMainDO.getFileObjectOther())) {
JSONArray fileObjectOthers = new JSONArray(contractMainDO.getFileObjectOther());
for (int i = 0; i < fileObjectOthers.size(); i++) {
JSONObject file = fileObjectOthers.getJSONObject(i);
@@ -1542,7 +1555,7 @@ public class ContractServiceImpl implements ContractService {
zips.finish();
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=contract-file-"+ System.currentTimeMillis()+".zip")
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=contract-file-" + System.currentTimeMillis() + ".zip")
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(new ByteArrayResource(zipsByte.toByteArray()));
} catch (Exception e) {
@@ -1665,7 +1678,7 @@ public class ContractServiceImpl implements ContractService {
* @param contractMainDO 合同主信息
* @return 操作标识
*/
private String getOperationId(ContractMainDO contractMainDO){
private String getOperationId(ContractMainDO contractMainDO) {
String operationId = null;
// 1、先调用009ERP接口查询合同信息
@@ -2066,12 +2079,12 @@ public class ContractServiceImpl implements ContractService {
// 单据名称(拼音)
String documentName = "XTHT";
// 公司编码
String companyId = CompanyContextHolder.getCompanyId()!= null ? CompanyContextHolder.getCompanyId().toString() : "";
String companyId = CompanyContextHolder.getCompanyId() != null ? CompanyContextHolder.getCompanyId().toString() : "";
// 年月日
String yearMounth8Bit = LocalDate.now()
.format(DateTimeFormatter.ofPattern(DateConstants.DATE_FORMAT_YEAR_MONTH_DAY_8_BIT));
// 查询最大编号
String numPrefix = documentName+"-"+category+"-"+companyId+"-"+yearMounth8Bit;
String numPrefix = documentName + "-" + category + "-" + companyId + "-" + yearMounth8Bit;
QueryWrapper<ContractMainDO> queryWrapper = new QueryWrapper<>();
queryWrapper.likeRight("SYS_CTRT_NUM", numPrefix);
queryWrapper.orderByDesc("SYS_CTRT_NUM");
@@ -2095,7 +2108,7 @@ public class ContractServiceImpl implements ContractService {
/**
* 获取合同ID集合
*
* @param contractName 合同名称
* @param contractName 合同名称
* @param contractPaperNumber 合同编号
* @return 合同ID集合
*/

View File

@@ -0,0 +1,73 @@
package com.zt.plat.module.contractorder.service.contractreceivesend;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendPageReqVO;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendRespVO;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendSaveReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO;
import jakarta.validation.Valid;
import java.util.List;
/**
* 收发货规则 Service 接口
*
* @author 后台管理-1
*/
public interface ContractReceiveSendService {
/**
* 创建收发货规则
*
* @param createReqVO 创建信息
* @return 编号
*/
ContractReceiveSendRespVO createContractReceiveSend(@Valid ContractReceiveSendSaveReqVO createReqVO);
/**
* 更新收发货规则
*
* @param updateReqVO 更新信息
*/
void updateContractReceiveSend(@Valid ContractReceiveSendSaveReqVO updateReqVO);
/**
* 删除收发货规则
*
* @param id 编号
*/
void deleteContractReceiveSend(Long id);
/**
* 批量删除收发货规则
*
* @param ids 编号
*/
void deleteContractReceiveSendListByIds(List<Long> ids);
/**
* 获得收发货规则
*
* @param id 编号
* @return 收发货规则
*/
ContractReceiveSendDO getContractReceiveSend(Long id);
/**
* 获得收发货规则分页
*
* @param pageReqVO 分页查询
* @return 收发货规则分页
*/
PageResult<ContractReceiveSendDO> getContractReceiveSendPage(ContractReceiveSendPageReqVO pageReqVO);
/**
* 通过合同ID获得收发货规则
*
* @param contractId 合同号
* @return 收发货规则
*/
List<ContractReceiveSendRespVO> getContractReceiveSendListByContractId(Long contractId);
}

View File

@@ -0,0 +1,96 @@
package com.zt.plat.module.contractorder.service.contractreceivesend;
import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendPageReqVO;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendRespVO;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendSaveReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO;
import com.zt.plat.module.contractorder.dal.mysql.contractreceivesend.ContractReceiveSendMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import java.util.List;
import static com.zt.plat.module.contractorder.enums.ErrorCodeConstants.CONTRACT_RECEIVE_SEND_NOT_EXISTS;
/**
* 收发货规则 Service 实现类
*
* @author 后台管理-1
*/
@Service
@Validated
public class ContractReceiveSendServiceImpl implements ContractReceiveSendService {
@Resource
private ContractReceiveSendMapper contractReceiveSendMapper;
@Override
public ContractReceiveSendRespVO createContractReceiveSend(ContractReceiveSendSaveReqVO createReqVO) {
// 插入
ContractReceiveSendDO contractReceiveSend = BeanUtils.toBean(createReqVO, ContractReceiveSendDO.class);
contractReceiveSendMapper.insert(contractReceiveSend);
// 返回
return BeanUtils.toBean(contractReceiveSend, ContractReceiveSendRespVO.class);
}
@Override
public void updateContractReceiveSend(ContractReceiveSendSaveReqVO updateReqVO) {
// 校验存在
validateContractReceiveSendExists(updateReqVO.getId());
// 更新
ContractReceiveSendDO updateObj = BeanUtils.toBean(updateReqVO, ContractReceiveSendDO.class);
contractReceiveSendMapper.updateById(updateObj);
}
@Override
public void deleteContractReceiveSend(Long id) {
// 校验存在
validateContractReceiveSendExists(id);
// 删除
contractReceiveSendMapper.deleteById(id);
}
@Override
public void deleteContractReceiveSendListByIds(List<Long> ids) {
// 校验存在
validateContractReceiveSendExists(ids);
// 删除
contractReceiveSendMapper.deleteByIds(ids);
}
private void validateContractReceiveSendExists(List<Long> ids) {
List<ContractReceiveSendDO> list = contractReceiveSendMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
throw exception(CONTRACT_RECEIVE_SEND_NOT_EXISTS);
}
}
private void validateContractReceiveSendExists(Long id) {
if (contractReceiveSendMapper.selectById(id) == null) {
throw exception(CONTRACT_RECEIVE_SEND_NOT_EXISTS);
}
}
@Override
public ContractReceiveSendDO getContractReceiveSend(Long id) {
return contractReceiveSendMapper.selectById(id);
}
@Override
public PageResult<ContractReceiveSendDO> getContractReceiveSendPage(ContractReceiveSendPageReqVO pageReqVO) {
return contractReceiveSendMapper.selectPage(pageReqVO);
}
@Override
public List<ContractReceiveSendRespVO> getContractReceiveSendListByContractId(Long contractId) {
return BeanUtils.toBean(contractReceiveSendMapper.selectList(ContractReceiveSendDO::getContractId, contractId), ContractReceiveSendRespVO.class);
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zt.plat.module.bse.dal.dao.contractreceivesend.ContractReceiveSendMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>