|
|
@@ -19,7 +19,7 @@
|
|
19
|
19
|
t1.hwxz,
|
|
20
|
20
|
t1.dj,
|
|
21
|
21
|
t1.kcsl,
|
|
22
|
|
- t4.EnumItemName rq,
|
|
|
22
|
+ t5.EnumItemName rq,
|
|
23
|
23
|
t1.rq AS rcrq,
|
|
24
|
24
|
t1.cjsj AS cjsj,
|
|
25
|
25
|
t1.UnitID
|
|
|
@@ -27,9 +27,23 @@
|
|
27
|
27
|
`lsreport_ts`.data_kcgl_kcsw_default AS t1
|
|
28
|
28
|
LEFT JOIN basic_storehouse t2 ON t1.UnitID = t2.org_id
|
|
29
|
29
|
AND t1.ch = t2.storehouse_id
|
|
30
|
|
- LEFT JOIN `lsreport_ts`.`data_kcgl_fcbgz_default` t3 ON t2.org_id = t3.UnitID
|
|
31
|
|
- AND t2.storehouse_id = t3.ch
|
|
32
|
|
- LEFT JOIN `lsreport_ts`.`enumitem` t4 ON t3.scnf = t4.EnumItemId
|
|
|
30
|
+ LEFT JOIN (
|
|
|
31
|
+ SELECT
|
|
|
32
|
+ t4.EnumItemId,
|
|
|
33
|
+ t4.EnumItemName,
|
|
|
34
|
+ MAX(t4.EnumItemName) scnf,
|
|
|
35
|
+ t3.UnitID,
|
|
|
36
|
+ t3.ch,
|
|
|
37
|
+ t3.scnf scnfEnumId
|
|
|
38
|
+ FROM
|
|
|
39
|
+ `lsreport_ts`.data_kcgl_fcbgz_default t3
|
|
|
40
|
+ INNER JOIN `lsreport_ts`.enumitem t4 ON t3.scnf = t4.EnumItemId
|
|
|
41
|
+ AND t3.srsl > 0
|
|
|
42
|
+ AND t3.UnitID = #{org_id}
|
|
|
43
|
+ GROUP BY
|
|
|
44
|
+ t3.ch
|
|
|
45
|
+ ) t5 ON t2.org_id = t5.UnitID
|
|
|
46
|
+ AND t2.storehouse_id = t5.ch
|
|
33
|
47
|
<where>
|
|
34
|
48
|
t2.del_flag = 1
|
|
35
|
49
|
<if test="org_id != null">
|
|
|
@@ -42,8 +56,6 @@
|
|
42
|
56
|
AND t2.storehouse_code = #{cfCdoe}
|
|
43
|
57
|
</if>
|
|
44
|
58
|
</where>
|
|
45
|
|
- ORDER BY
|
|
46
|
|
- t3.ModifyDate DESC
|
|
47
|
59
|
) t
|
|
48
|
60
|
GROUP BY
|
|
49
|
61
|
t.storehouse_code
|