|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.jy.business.contract.mapper.ContractInfoMapper;
|
|
|
import com.jy.business.contract.model.dto.ContractInfoSelectDto;
|
|
|
import com.jy.business.contract.model.entity.ContractInfo;
|
|
|
+import com.jy.business.contract.model.table.ContractDetailTable;
|
|
|
import com.jy.business.contract.model.table.ContractInfoTable;
|
|
|
import com.jy.business.contract.model.vo.ContractInfoVo;
|
|
|
import com.jy.framework.model.base.BaseDao;
|
|
@@ -33,7 +34,7 @@ public class ContractInfoDao extends BaseDao<ContractInfoMapper, ContractInfo> {
|
|
|
.where(
|
|
|
)
|
|
|
.orderBy(
|
|
|
- ci.id.desc()
|
|
|
+ ci.id.desc()
|
|
|
)
|
|
|
.list();
|
|
|
}
|
|
@@ -43,13 +44,20 @@ public class ContractInfoDao extends BaseDao<ContractInfoMapper, ContractInfo> {
|
|
|
*/
|
|
|
public Page<ContractInfoVo> getPage(ContractInfoSelectDto dto) {
|
|
|
ContractInfoTable ci = ContractInfoTable.ci;
|
|
|
+ ContractDetailTable cd = ContractDetailTable.cd;
|
|
|
|
|
|
return sql(ContractInfoVo.class)
|
|
|
.select(
|
|
|
- ci.all
|
|
|
+ ci.all,
|
|
|
+ sql()
|
|
|
+ .select(_sum(_ifNull(cd.costPrice, 0).multiply(cd.quantity))).from(cd).where(ci.id.eq(cd.contractId))
|
|
|
+ .add(ci.freightPrice)
|
|
|
+ .add(ci.insurance)
|
|
|
+ .as(ContractInfoVo::getCostPrice)
|
|
|
)
|
|
|
.from(ci)
|
|
|
.where(
|
|
|
+ ci.contractNo.like(dto.getContractNo())
|
|
|
)
|
|
|
.orderBy(
|
|
|
ci.id.desc()
|