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
<?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="C_R_GetCityCheckCollectQuery">
        <![CDATA[
 
select base.* from (
    select 
    org.id as orgId,
    org.name as orgName,
    org.pid as quId,
    qu.name as quName,
    (
    select count(*) from sc_check_org sco
        where 1=1
        and  sco.scco_org_id=org.id
        <<and  sco.scco_begin_date>=:beginDate>>
        <<and  sco.scco_begin_date<=:endDate>>
    ) as checkNum,
    (
    select count(*) from sc_check_org sco
        where 1=1
        and  sco.scco_submit_data is not null
        and  sco.scco_org_id=org.id
        <<and  sco.scco_begin_date>=:beginDate>>
        <<and  sco.scco_begin_date<=:endDate>>
    ) as processNum,
    (
    select count(*) from sc_check_org_subject as os1
    left join sc_check_org sco on sco.scco_id=scos_scco_id
        where 1=1
        and  os1.scos_is_ok='N'
        and  sco.scco_org_id=org.id
        <<and  sco.scco_begin_date>=:beginDate>>
        <<and  sco.scco_begin_date<=:endDate>>
    ) as problemNum
     from t_sys_organization as org
     left join t_sys_organization as qu on qu.id=org.pid
    where 1=1
    and org.id in (:orgIds)
    and 
) as base
where 1=1
<<and base.tiJiaoNum>:tiJiaoNum>>
<<and base.processNum>:processNum>>
<<and base.problemNum>:problemNum>>
   and ##CONDITIONS##
order by org.pid,org.id
 
        ]]>
    </sql-query>
</hibernate-mapping>