<?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
|
cgsd_id,
|
iodd_id,
|
cgsd_amount_w,
|
iodd_type,
|
iodd_size,
|
cgsd_reject_amount,
|
bbpr_id,
|
bbpr_id iocd_bbpr_id,
|
bbpr_name,
|
bbpr_brief_name,
|
bbpr_style,
|
bbpr_unit,
|
bbpr_second_unit,
|
bbpr_second_size,
|
bbpr_remark,
|
ifnull(iocd_closing_size,0) iocd_opening_size,
|
0.0 iocd_in_size,
|
0.0 iocd_out_size,
|
0.0 iocd_closing_size,
|
ifnull(iocd_closing_reject_size,0) iocd_opening_reject_size,
|
0.0 iocd_in_reject_size,
|
0.0 iocd_out_reject_size,
|
0.0 iocd_closing_reject_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
|
left join io_opening_closing_detail on iocd_bbpr_id=bbpr_id
|
left join io_opening_closing on iocd_iooc_id=iooc_id
|
WHERE
|
1 = 1
|
<<and (bbiv_factory_id=:factoryId or bbiv_factory_id is null)>>
|
<<and (se.factory_id=:factoryId or se.factory_id is null)>>
|
<<and (d.factory_id=:factoryId or d.factory_id is null)>>
|
<<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') or iode_send_date is null)>>
|
<<and (cgse_entry_date>=CONCAT(:beginDate, ' 00:00:00') or cgse_entry_date is null)>>
|
<<and (iode_send_date<=CONCAT(:endDate, ' 23:59:29') or iode_send_date is null)>>
|
<<and (cgse_entry_date<=CONCAT(:endDate, ' 23:59:29') or cgse_entry_date is null)>>
|
<<and iooc_year_month is null or iooc_year_month=:yearMonthPrev>>
|
|
|
]]>
|
</sql-query>
|
</hibernate-mapping>
|