Commit 8a431344 authored by lcl's avatar lcl

u

parent 66510cec
......@@ -108,6 +108,12 @@ public class CbQuantitySummaryServiceImpl extends ServiceImpl<CbQuantitySummaryM
@Override
public List<CbQuantitySummaryListVo> subjectList(CbQuantitySummaryListBo bo) {
if(ObjectUtils.isEmpty(bo.getRecordDate())){
//默认当前月
bo.setRecordDate(DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()));
}
if (ObjectUtils.isEmpty(bo.getProjectId())) throw new BeanException("项目id不能为空!");
if (ObjectUtils.isEmpty(bo.getCbStage())) throw new BeanException("成本阶段不能为空!");
return baseMapper.selectListBySubject(bo);
}
......
......@@ -52,28 +52,26 @@
</select>
<select id="selectListBySubject" resultType="com.dsk.cscec.domain.vo.CbQuantitySummaryListVo">
select a.*, ifnull(sum(a.quantities),0) totalQuantities from (
select
cqs.id, cqs.cb_subject_name, cqs.company_no, cqs.org_no, cqs.cb_name, cqs.job_content, cqs.calculation_rule,
cqs.unit, cqs.material_description, cqs.guide_price, cqs.bid_unit_price, cqs.unit_price_difference, cqs.quantity,
cqs.combined_price, cqs.combined_price_tax, cqs.brand_name, cqs.bid_source, cqs.remark, cqs.`number`, cqsa.quantities,
cqsa.quantities_unit, cqsa.conversion_quantities, cqsa.conversion_unit, cqsa.purchase_unit_price, cqsa.create_time,
cqsa.id actualId, cqsa.ipm_project_code, cqsa.ipm_contract_code, cqsa.ipm_biz_code, cqsa.push_quantities
cqsa.id actualId, cqsa.ipm_project_code, cqsa.ipm_contract_code, cqsa.ipm_biz_code, cqsa.push_quantities,
ifnull(sum(cqsa1.quantities),0) totalQuantities
from cb_quantity_summary cqs
left join cb_quantity_summary_actual cqsa on cqs.id = cqsa.cb_quantity_summary_id
left join cb_quantity_summary_actual cqsa on (cqs.id = cqsa.cb_quantity_summary_id and cqsa.record_date = #{recordDate} )
left join cb_quantity_summary_actual cqsa1 on (cqs.id = cqsa1.cb_quantity_summary_id and cqsa1.record_date &lt;= #{recordDate} )
left join cb_subject cs1 on cqs.cb_subject_name = cs1.cb_subject_name
where cqs.del_falg = 0 and cqs.project_id = #{projectId} and cqs.cb_stage = #{cbStage}
<if test="recordDate != null and recordDate != ''"> and cqsa.record_date &lt;= #{recordDate} </if>
<if test="cbSubjectName != null and cbSubjectName !=''">
<choose>
<when test="cbSubjectName == '未归类项目'"> and cs1.id is null </when>
<otherwise> and cqs.cb_subject_name = #{cbSubjectName} </otherwise>
<otherwise> and cs1.id is not null and cqs.cb_subject_name = #{cbSubjectName} </otherwise>
</choose>
</if>
order by cqsa.record_date desc
) a
group by a.id
order by a.`number` asc
group by cqs.id
order by cs1.sort asc, cs1.cb_subject_no asc, cqs.`number` asc
</select>
<select id="unconvertedList" resultType="com.dsk.cscec.domain.vo.CbQuantitySummaryListVo">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment