<?xml version="1.0"?>
|
<!DOCTYPE hibernate-mapping PUBLIC
|
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
|
<hibernate-mapping>
|
<sql-query name="IoOpeningClosingQuery">
|
<![CDATA[
|
|
|
SELECT
|
bbpr_id
|
bbpr_name,
|
bbpr_brief_name,
|
bbpr_style,
|
bbpr_unit,
|
bbpr_second_unit,
|
bbpr_second_size,
|
bbpr_remark,
|
case
|
when bbiv_size is null
|
then 0
|
else bbiv_size
|
end bbiv_size,
|
case
|
when bbiv_reject_size is null
|
then 0
|
else bbiv_reject_size
|
end bbiv_reject_size,
|
sum(cgsd_amount_w) cgsd_amount_w,
|
sum(cgsd_reject_amount) cgsd_reject_amount,
|
sum(iodd_size) iodd_size
|
FROM
|
bb_product a
|
LEFT JOIN bb_branch ON bbbr_id = bbpr_bbbr_id
|
left join bb_product_invertory on bbiv_bbpr_id=a.bbpr_id
|
left join cg_stuff_entry_detail on cgsd_bbpr_id=bbpr_id
|
left join cg_stuff_entry se on cgse_id=cgsd_cgse_id
|
left join io_deliver_detail on iodd_bbpr_id=bbpr_id
|
left join io_deliver d on iode_id=iodd_iode_id
|
WHERE
|
1 = 1
|
<<and bbiv_factory_id=:factoryId>>
|
<<and se.factory_id=:factoryId>>
|
<<and d.factory_id=:factoryId>>
|
<<and bbpr_bbbr_id in (:bbprBbbrId)>>
|
<<and (bbpr_name like concat("%", :bbprName, "%") or bbpr_brief_name like concat("%", :bbprName, "%") )>>
|
<<and bbpr_style like concat("%", :bbprStyle, "%") >>
|
<<and bbpr_unit = (:bbprUnit)>>
|
<<and bbpr_grammage = (:bbprGrammage)>>
|
<<and iode_send_date>=CONCAT(:beginDate, ' 00:00:00')>>
|
<<and cgse_entry_date>=CONCAT(:beginDate, ' 00:00:00')>>
|
<<and iode_send_date<=CONCAT(:endDate, ' 23:59:29')>>
|
<<and cgse_entry_date>=CONCAT(:endDate, ' 23:59:29')>>
|
group by bbpr_id
|
|
]]>
|
</sql-query>
|
</hibernate-mapping>
|