sb.append(" and data_time>='"+startTime+"' and data_time<='"+endTime+"' ");
if(StringUtils.isNotEmpty(startTime)){
sb.append(" and data_time>='"+startTime+"' ");
}
if(StringUtils.isNotEmpty(endTime)){
sb.append(" and data_time<='"+endTime+"' ");
}
sb.append(" and reit_id in ("+itemIds+")) `a` left join `f_report_item` `d` on((`a`.`reit_id` = `d`.`id`))) where 1=1 group by `a`.`data_id`,`a`.`depart_id`,`a`.`data_time` order by `a`.`data_time`)");
//String factorySql = "select fi.depart_id ,d.depart_name, fi.pro_scale*10000 'pro_scale' from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 and d.id in("+departIdssss+")";
...
...
@@ -229,10 +137,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
@@ -262,6 +262,13 @@ public class ReportItemvService {
Stringsql="select DATE_FORMAT( aaa.time, '%Y-%m' ) time , ROUND(SUM(IFNULL(aaa."+field+",0)),2) AS 'value' from "+dataViewName2119+"aaa group by DATE_FORMAT( aaa.time, '%Y-%m' ) ";
from erp_distribut_contract dc , erp_distribut_material dm , erp_purchase_material pm
where dc.id = dm.contract_id and dc.id = #{param.distributContractId } and dm.good_code = pm.good_code and pm.del_flag = '0' and dc.use_flag = '0' and dm.del_flag = '0'
<iftest="param.sparepartCode != null and param.sparepartCode !=''">and pm.sparepart_code =#{param.sparepartCode}</if>
<iftest="param.sparepartType != null and param.sparepartType !=''">and pm.sparepart_type in (${param.sparepartType}) </if>
<iftest="param.sparepartName != null and param.sparepartName !=''">and pm.sparepart_name like '%${param.sparepartName}%'</if>
)aaa
left join erp_purchase_contract pc on pc.id = aaa.contract_id
select dc.contract_code 'distribut_contract_code', st.item_text as 'sparepart_type_name', aaa.* from
from erp_distribut_material dm , erp_purchase_material pm ,erp_purchase_contract pc
where dm.good_code = pm.good_code and pm.contract_id = pc.id and pc.use_flag = '0' and dm.del_flag = '0' and pm.del_flag = '0' and pc.start_time <= now() and pc.end_time >= now()
and dm.contract_id = #{param.distributContractId }
<iftest="param.sparepartCode != null and param.sparepartCode !=''">and pm.sparepart_code =#{param.sparepartCode}</if>
<iftest="param.sparepartType != null and param.sparepartType !=''">and pm.sparepart_type in (${param.sparepartType}) </if>
<iftest="param.sparepartName != null and param.sparepartName !=''">and pm.sparepart_name like '%${param.sparepartName}%'</if>
) aaa
left join erp_distribut_contract dc on dc.id = aaa.distribut_contract_id
left join equipment_sparepart_type st on st.id = aaa.sparepart_type
SELECT sum(item_value) 'sum_value' , avg(item_value) 'avg_value' FROM f_report_itemv where reit_id=#{reitId} and data_time >= #{startDate} and data_time <= #{endDate}
SELECT sum(item_value) as 'value' , data_time as 'date' FROM f_report_itemv where reit_id=#{reitId} and data_time >= #{startDate} and data_time <= #{endDate}
IFNULL(( SELECT sum(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time >= #{startDate} and data_time <= #{endDate}),0) as 'value',
IFNULL(( SELECT sum(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time >= #{lastMonthStartDate} and data_time <= #{lastMonthEndDate}),0) as 'valueTb',
IFNULL(( SELECT sum(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time >= #{lastYearStartDate} and data_time <= #{lastYearEndDate} ),0) as 'valueHb'
IFNULL(( SELECT avg(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time >= #{startDate} and data_time <= #{endDate}),0) as 'value',
IFNULL(( SELECT avg(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time >= #{lastMonthStartDate} and data_time <= #{lastMonthEndDate}),0) as 'valueTb',
IFNULL(( SELECT avg(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time >= #{lastYearStartDate} and data_time <= #{lastYearEndDate} ),0) as 'valueHb'