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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?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="ProductKucunListQuery">
        <![CDATA[
 
SELECT
a.bbpr_id,
a.bbpr_sn,
a.bbpr_name,
a.bbpr_en_name,
a.bbpr_unit,
a.bbpr_style,
a.bbpr_brand,
a.bbpr_attribute,
a.bbpr_purchase_max,
a.bbpr_inventory_max,
a.bbpr_inventory_min,
a.bbpr_sale_price,
a.bbpr_into_social_security,
a.bbpr_state,
a.bbpr_pickable,
a.bbpr_desc,
a.bbpr_syacc_ids,
a.bbpr_locationid,
a.bbpr_bbbr_id,
a.creator,
a.create_time,
a.modifier,
a.modify_time,
a.bbpr_sydi_id,
a.bbpr_management_model,
a.bbpr_into_inventory_manage,
a.bbpr_code,
a.bbpr_code1,
a.bbpr_code2,
a.bbpr_into_barcode,
a.bbpr_pick_max,
if(bbpr_size is null,0,bbpr_size) as bbpr_size,
if(COUNT(bbit_bbpr_id) is null,0,COUNT(bbit_bbpr_id)) as size,
b.bbbr_name,
sydi_name bbpr_sydi_name,
bbpp_price
from bb_product_item
LEFT join bb_product a on bbpr_id = bbit_bbpr_id
left join bb_branch b on bbpr_bbbr_id=b.bbbr_id
left join sys_dictionary on a.bbpr_sydi_id=sydi_id
 
left join bb_business_partner on bbbp_id=bbit_bbbp_id
LEFT join bb_product_partner on bbpp_bbpr_id = bbpr_id
 
where 1=1
<<and (a.bbpr_code like concat('%', :productInfo, '%') or 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_locationid=:locationid>>
<<and (bbpp_locationid=:locationid or bbpp_locationid is null)>>
<<and (bbbp_locationid=:locationid or bbbp_locationid is null)>>
<<and bbbr_id=:bbbrId>>
<<and bbbp_id=:bbbpId>>
<<and a.bbpr_state=:bbprState>>
<<and bbpr_bbbr_id_list like concat('%,', :bbprBbbrId, ',%')>>
<<and bbpr_size >= :smallSize>>
<<and bbpr_size <= :bigSize>>
<<and bbpr_size <> :bSize>>
and bbit_is_exit <> 'Y'
and bbit_is_entry ='Y'
   and ##CONDITIONS##
group by bbit_bbpr_id
 
        ]]>
    </sql-query>
</hibernate-mapping>