| | |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| | | import cn.iocoder.yudao.module.crm.api.contract.dto.CrmContractForSaleDTO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractProductMapper; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | /** |
| | | * CRM 合同 API 实现类 |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | @RestController |
| | | @RequestMapping(CrmContractApi.PREFIX) |
| | |
| | | @Lazy // 延迟加载,避免循环依赖 |
| | | private CrmContractService contractService; |
| | | |
| | | @Resource |
| | | private CrmContractMapper contractMapper; |
| | | @Resource |
| | | private CrmContractProductMapper contractProductMapper; |
| | | |
| | | @Override |
| | | public CommonResult<CrmContractForSaleDTO> getContractForSaleByNo(String no) { |
| | | CrmContractDO contract = contractMapper.selectByNoForUpdate(no); |
| | | if (contract == null) return success(null); |
| | | CrmContractForSaleDTO result = BeanUtils.toBean(contract, CrmContractForSaleDTO.class); |
| | | result.setItems(BeanUtils.toBean(contractProductMapper.selectListByContractId(contract.getId()), CrmContractForSaleDTO.Item.class)); |
| | | return success(result); |
| | | } |
| | | @Override |
| | | public CommonResult<Boolean> updateContractStatus(Long id, Integer status) { |
| | | contractService.updateContractStatus(id, status); |