liuxiaolong
2019-05-09 0d1d88cdb668e75ea8609417ac18ae19947e9525
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?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="ZhProductDaiZhiQuery">
        <![CDATA[
 
select bbpr_id, bbpr_name,bbpr_style,bbpr_unit,bbpr_brand,
count(*) as dai_zhi_size ,
(
    select ouex_exit_date from out_exit_detail
        left join out_exit on oued_ouex_id=ouex_id
        where oued_bbpr_id=bbpr_id limit 1
) as last_exit_date
from bb_product_item
left join cg_entry_detail on bbit_cged_id=cged_id
left join cg_entry on cged_cgen_id=cgen_id
left join bb_product on bbpr_id=bbit_bbpr_id
where 1=1
AND bbit_is_exit!='Y'
and DATE_ADD(DATE_FORMAT(cgen_entry_date,'%Y-%m-%d') , INTERVAL :monthLength MONTH)<CURDATE()
<<and (a.bbpr_sn like concat('%', :productInfo, '%') or a.bbpr_name like concat('%', :productInfo, '%') or>>
<<a.bbpr_style like concat('%', :productInfo, '%') or a.bbpr_en_name like concat('%', :productInfo, '%') or >>
<<a.bbpr_unit like concat('%', :productInfo, '%') or  a.bbpr_brand like concat('%', :productInfo, '%') )>>
<<and bbpr_bbbr_id_list like concat('%,', :bbprBbbrId, ',%')>>
<<and bbbr_id=:bbbrId>>
<<and bbbp_id=:bbbpId>>
<<and a.bbpr_state=:bbprState>>
  and bbpr_locationid=:locationid
and ##CONDITIONS##
group by bbit_bbpr_id
 
        ]]>
    </sql-query>
</hibernate-mapping>