PartyTotalCQuery.xml 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.ghsc.partybuild.mapper.PartyTotalCQuery">
  4. <!--党组织数-->
  5. <select id="selectPartytotalList" resultType="java.util.HashMap">
  6. select z.DZZDM,
  7. count(1) as PARTYCOUNT,
  8. sum(case when c.ZZLB in('100','200') then 1 else 0 end) as NUM_DW, -- 党委=
  9. sum(case when c.ZZLB = '300' then 1 else 0 end) as NUM_DZZ, -- 党总支
  10. sum(case when c.ZZLB = '400' then 1 else 0 end) as NUM_DZB, -- 党支部
  11. sum(case when c.ZZLB = '500' then 1 else 0 end) as NUM_DXZ, -- 党小组
  12. sum(case when c.ZZLB = '300' and c.JCZZFL='71' then 1 else 0 end) as NUM_DZZ_CJ, -- 院系党总支
  13. sum(case when c.ZZLB = '300' and c.JCZZFL='51' then 1 else 0 end) as NUM_DZZ_LTX, -- 团委休党总支
  14. sum(case when c.ZZLB = '400' and c.JCZZFL='21' then 1 else 0 end) as NUM_DZB_CJ, -- 机关党支部
  15. sum(case when c.ZZLB = '400' and c.JCZZFL='71' then 1 else 0 end) as NUM_DZB_KS, -- 院系党支部
  16. sum(case when c.ZZLB = '400' and c.JCZZFL='13' then 1 else 0 end) as NUM_DZB_BZ, -- 班组党支部
  17. sum(case when c.ZZLB = '400' and c.JCZZFL='51' then 1 else 0 end) as NUM_DZB_LTX -- 团委休党支部
  18. from ZZ_ZZQKXX z
  19. inner join (
  20. select z.DZZDM,z.DZZMC,fb.ZZLB,fb.JCZZFL
  21. from ZZ_ZZQKXX z
  22. inner join ZZ_ZZQKXXFB fb on z.DZZDM = fb.DZZDM
  23. ) c on z.DZZDM = substr(c.DZZDM, 1, length(z.DZZDM))
  24. where 1=1
  25. and z.dzzdm in
  26. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  27. #{dzzdm}
  28. </foreach>
  29. group by z.DZZDM
  30. </select>
  31. <!--创岗建区-->
  32. <select id="selectCgjqtotalList" resultType="java.util.HashMap">
  33. select z.DZZDM,
  34. sum(s.NUM_XFG) as NUM_XFG,
  35. sum(s.NUM_ZRQ) as NUM_ZRQ
  36. from ZZ_ZZQKXX z
  37. inner join (
  38. select s.PARTYCODE,
  39. sum(case when s.CGJQTYPE=1 then 1 else 0 end) as NUM_XFG,
  40. sum(case when s.CGJQTYPE=2 then 1 else 0 end) as NUM_ZRQ
  41. from CGJQ_POSTAREA_SCORE s
  42. where s.GQTYPE=1 and s.OPERATESTATE not in('D')
  43. <if test="year!=null">
  44. and s.YEAR=#{year}
  45. </if>
  46. group by s.PARTYCODE
  47. ) s on z.DZZDM=substr(s.PARTYCODE, 1, length(z.DZZDM))
  48. where 1=1
  49. and z.dzzdm in
  50. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  51. #{dzzdm}
  52. </foreach>
  53. group by z.DZZDM
  54. </select>
  55. <!--党内品牌-->
  56. <select id="selectDnpptotalList" resultType="java.util.HashMap">
  57. select z.DZZDM,
  58. sum(b.NUM_ZD) as NUM_ZD, -- 站段
  59. sum(b.NUM_JT) as NUM_JT, -- 集团
  60. sum(b.NUM_GT) as NUM_GT -- 国铁
  61. from ZZ_ZZQKXX z
  62. inner join (
  63. select b.PARTYCODE,
  64. sum(case when b.CREATTYPE=1 then 1 else 0 end) as NUM_ZD, -- 站段
  65. sum(case when b.CREATTYPE=2 then 1 else 0 end) as NUM_JT, -- 集团
  66. sum(case when b.CREATTYPE=3 then 1 else 0 end) as NUM_GT -- 国铁
  67. from dj_brand b
  68. where 1=1 and b.OPERATESTATE not in ('D')
  69. <if test="year!=null">
  70. and Extract(year from b.BRANDTIME)=#{year}
  71. </if>
  72. group by b.PARTYCODE
  73. ) b on z.DZZDM=substr(b.PARTYCODE, 1, length(z.DZZDM))
  74. where 1=1
  75. and z.dzzdm in
  76. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  77. #{dzzdm}
  78. </foreach>
  79. group by z.DZZDM
  80. </select>
  81. <!--活动室-->
  82. <select id="selectActivityroomtotalList" resultType="java.util.HashMap">
  83. select z.DZZDM,
  84. sum(NUM) as NUM
  85. from ZZ_ZZQKXX z
  86. inner join (
  87. select
  88. r.PARTYCODE,
  89. sum(1) as NUM
  90. from dj_partyActivityRoom r
  91. where 1=1 and r.OPERATESTATE not in ('D')
  92. group by r.PARTYCODE
  93. ) r on z.DZZDM=substr(r.PARTYCODE, 1, length(z.DZZDM))
  94. where 1=1
  95. and z.dzzdm in
  96. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  97. #{dzzdm}
  98. </foreach>
  99. group by z.DZZDM
  100. </select>
  101. <!--宣传阵地-->
  102. <select id="selectPubpositiontotalList" resultType="java.util.HashMap">
  103. select z.DZZDM,
  104. sum(NUM) as NUM
  105. from ZZ_ZZQKXX z
  106. inner join (
  107. select p.PARTYCODE,
  108. sum(1) as NUM
  109. from PUB_PUBLICITYPOSITION p
  110. where 1=1 and p.OPERATESTATE not in ('D')
  111. group by p.PARTYCODE
  112. ) p on z.DZZDM=substr(p.PARTYCODE, 1, length(z.DZZDM))
  113. where 1=1
  114. and z.dzzdm in
  115. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  116. #{dzzdm}
  117. </foreach>
  118. group by z.DZZDM
  119. </select>
  120. <!--互联网工作群-->
  121. <select id="selectWxgrouptotalList" resultType="java.util.HashMap">
  122. select z.DZZDM,
  123. sum(NUM) as NUM
  124. from ZZ_ZZQKXX z
  125. inner join (
  126. select w.PARTYCODE,sum(1) as NUM
  127. from dj_wxGroup w
  128. where 1=1 and w.OPERATESTATE not in ('D')
  129. group by w.PARTYCODE
  130. ) w on z.DZZDM=substr(w.PARTYCODE, 1, length(z.DZZDM))
  131. where 1=1
  132. and z.dzzdm in
  133. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  134. #{dzzdm}
  135. </foreach>
  136. group by z.DZZDM
  137. </select>
  138. <!--年度应换届党组织数-->
  139. <select id="selectGroupReplacetotalList" resultType="java.util.HashMap">
  140. select z.DZZDM,
  141. sum(NUM_YHJDZB) as NUM_YHJDZB
  142. from ZZ_ZZQKXX z
  143. inner join (
  144. select z.DZZDM,
  145. sum(case when fb.ZZLB = '400' then 1 else 0 end) as NUM_YHJDZB
  146. from ZZ_ZZQKXX z
  147. inner join ZZ_ZZQKXXFB fb on z.DZZDM = fb.DZZDM
  148. inner join (
  149. select DZZDM
  150. from ZZ_BZJCXX
  151. where substr(GJJMRQ, 1, 4) = #{year}
  152. group by DZZDM
  153. union
  154. select DZZDM from ZZ_ZZQKXX where substr(JLDZZRQ,1,4) = #{year}
  155. ) c on z.DZZDM=c.DZZDM
  156. group by z.DZZDM
  157. ) c on z.DZZDM = substr(c.DZZDM, 1, length(z.DZZDM))
  158. where 1 = 1
  159. and z.dzzdm in
  160. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  161. #{dzzdm}
  162. </foreach>
  163. group by z.DZZDM
  164. </select>
  165. <!--年度已换届党组织数-->
  166. <select id="selectGroupAlreadyReplacetotalList" resultType="java.util.HashMap">
  167. select z.DZZDM,
  168. sum(NUM_DZBHJS) as NUM_DZBHJS
  169. from ZZ_ZZQKXX z
  170. inner join (
  171. select z.DZZDM,
  172. sum(case when fb.ZZLB = '400' then 1 else 0 end) as NUM_DZBHJS
  173. from ZZ_ZZQKXX z
  174. inner join ZZ_ZZQKXXFB fb on z.DZZDM = fb.DZZDM
  175. inner join (
  176. select DZZDM
  177. from ZZ_BZJCXX
  178. where substr(LDJTDXRQ, 1, 4) = #{year}
  179. group by DZZDM
  180. union
  181. select DZZDM from ZZ_ZZQKXX where substr(JLDZZRQ,1,4) = #{year}
  182. ) c on z.DZZDM=c.DZZDM
  183. group by z.DZZDM
  184. ) c on z.DZZDM = substr(c.DZZDM, 1, length(z.DZZDM))
  185. where 1 = 1
  186. and z.dzzdm in
  187. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  188. #{dzzdm}
  189. </foreach>
  190. group by z.DZZDM
  191. </select>
  192. <!--在岗党员数-->
  193. <select id="selectZgUsertotalList" resultType="java.util.HashMap">
  194. select z.DZZDM,sum(NUM_ZGUSER) as NUM_ZGUSER,sum(NUM_LTX) as NUM_LTX,sum(NUM_SQRD) as NUM_SQRD,sum(NUM_JJFZ) as
  195. NUM_JJFZ,sum(NUM_FZDX) as NUM_FZDX,sum(NUM_YBDY) as NUM_YBDY,
  196. sum(NUM_ZSDY) as NUM_ZSDY
  197. from ZZ_ZZQKXX z
  198. inner join (
  199. select us.SZDZBDM,
  200. sum(case when us.RYZT in('2','3') and (us.GZGW not in('0500','0501','0502','0504') or us.GZGW is null) then 1
  201. else 0 end) as NUM_ZGUSER, -- 在岗党员数
  202. sum(case when us.RYZT in('2','3') and us.GZGW in('0500','0501','0502','0504') then 1 else 0 end) as NUM_LTX,
  203. -- 离退休党员数
  204. sum(case when us.RYZT ='1' then 1 else 0 end) as NUM_SQRD, -- 申请入党数
  205. sum(case when us.RYZT ='5' then 1 else 0 end) as NUM_JJFZ, -- 积极分子数
  206. sum(case when us.RYZT ='6' then 1 else 0 end) as NUM_FZDX, -- 发展对象数
  207. sum(case when us.RYZT ='2' then 1 else 0 end) as NUM_YBDY, -- 预备党员数
  208. sum(case when us.RYZT ='3' then 1 else 0 end) as NUM_ZSDY -- 正式党员
  209. from VM_RYJBXX_ALL us
  210. inner join ZZ_ZZQKXX z on us.SZDZBDM=z.DZZDM
  211. inner join rs_ryjbxxfb fb on us.rybm = fb.rybm
  212. where 1=1 and (fb.ISARCHIVE is null or fb.ISARCHIVE = 0)
  213. <if test="isOnduty != null">
  214. /*是否在岗*/
  215. <if test="isOnduty == 1">
  216. and (us.GZGW not in('0500','0501','0502','0504') or us.GZGW is null)
  217. </if>
  218. <if test="isOnduty == 0">
  219. and us.GZGW in('0500','0501','0502','0504')
  220. </if>
  221. </if>
  222. group by us.SZDZBDM
  223. ) us on z.DZZDM=substr(us.SZDZBDM, 1, length(z.DZZDM))
  224. where 1=1
  225. and z.dzzdm in
  226. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  227. #{dzzdm}
  228. </foreach>
  229. group by z.DZZDM
  230. </select>
  231. <!--党支部书记专职兼职情况-->
  232. <select id="selectDZBSJtotalList" resultType="java.util.HashMap">
  233. select z.DZZDM,
  234. sum(NUM_ZZ) as NUM_ZZ, -- 专职
  235. sum(NUM_JZ) as NUM_JZ, -- 兼职
  236. sum(NUM_GZ) as NUM_GZ -- 挂职副书记
  237. from ZZ_ZZQKXX z
  238. inner join (
  239. select c.DZZDM,
  240. sum(case when c.ZZJZQK='1' then 1 else 0 end) as NUM_ZZ, -- 专职
  241. sum(case when c.ZZJZQK='2' then 1 else 0 end) as NUM_JZ, -- 兼职
  242. sum(case when c.ZZJZQK='3' then 1 else 0 end) as NUM_GZ -- 挂职副书记
  243. from ZZ_BZCYXX c
  244. inner join ZZ_ZZQKXXFB t on c.DZZDM = t.DZZDM and c.JC = t.LDJTJC
  245. inner join VM_RYJBXX us on c.RYBM=us.RYBM
  246. where c.ZWMC in('H010','H013')
  247. group by c.DZZDM
  248. ) c on z.DZZDM = substr(c.DZZDM, 1, length(z.DZZDM))
  249. where 1=1
  250. and z.dzzdm in
  251. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  252. #{dzzdm}
  253. </foreach>
  254. group by z.DZZDM
  255. </select>
  256. <!--困难党员-->
  257. <select id="selectGHBFtotalList" resultType="java.util.HashMap">
  258. select z.DZZDM,
  259. sum(NUM) as NUM
  260. from ZZ_ZZQKXX z
  261. inner join (
  262. select w.DZZDM,sum(1) as NUM
  263. from DJ_DNGHBF w
  264. inner join DJ_DNGHBFMX d on w.ID=d.DNGHBFID
  265. where 1=1 and w.OPERATESTATE not in ('D')
  266. <if test="year!=null">
  267. and Extract(year from d.CAREDATE)=#{year}
  268. </if>
  269. group by w.DZZDM
  270. ) w on z.DZZDM=substr(w.DZZDM, 1, length(z.DZZDM))
  271. where 1=1
  272. and z.dzzdm in
  273. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  274. #{dzzdm}
  275. </foreach>
  276. group by z.DZZDM
  277. </select>
  278. <!--中心组学习情况-->
  279. <select id="selectZxzxxFaTotalList" resultType="java.util.HashMap">
  280. select z.DZZDM,
  281. sum(NUM_JZXX) as NUM_JZXX,
  282. sum(NUM_ZTYT) as NUM_ZTYT,
  283. sum(NUM_DXJL) as NUM_DXJL
  284. from ZZ_ZZQKXX z
  285. inner join (
  286. select f.DW_ID as dzzdm,
  287. sum(case when f.STUDY_MODALITY_CODE='1' then 1 else 0 end) as NUM_JZXX, -- 集中学习
  288. sum(case when f.STUDY_MODALITY_CODE='2' then 1 else 0 end) as NUM_ZTYT, -- 专题研讨
  289. sum(case when f.STUDY_MODALITY_CODE='5' then 1 else 0 end) as NUM_DXJL -- 督学交流
  290. from ZZ_ZXZXX_FA f
  291. where 1=1 and (f.DELETED=0 or f.deleted is null)
  292. <if test="year!=null">
  293. and Extract(year from f.STUDY_START_TIME)=#{year}
  294. </if>
  295. group by f.DW_ID
  296. ) f on z.DZZDM=f.DZZDM -- on z.DZZDM=substr(f.DZZDM, 0, length(z.DZZDM))
  297. where 1=1
  298. and z.dzzdm in
  299. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  300. #{dzzdm}
  301. </foreach>
  302. group by z.DZZDM
  303. </select>
  304. <!--中心组学习出勤率-->
  305. <select id="selectZxzxxCqlList" resultType="java.util.HashMap">
  306. select z.DZZDM,
  307. round(sum(case when f.count>0 then round(ifnull(f.absentCount_JZXX,0)/f.count,4) else 0 end)/count(1),4)*100 as
  308. JZXXCQL -- 集中学习出勤率
  309. from ZZ_ZZQKXX z
  310. inner join (
  311. select f.ID,f.DW_ID as DZZDM,
  312. count(1) as count,
  313. sum(case when (u.absent is null or u.absent=0) then 1 else 0 end) as absentCount_JZXX
  314. from ZZ_ZXZXX_FA f
  315. inner join ZZ_ZXZXX_CJLDBZ u on f.ID=u.CASE_ID
  316. where 1=1
  317. and (f.deleted = 0 or f.deleted is null)
  318. and (u.deleted = 0 or u.deleted is null)
  319. and f.STUDY_MODALITY_CODE='1'
  320. <if test="year!=null">
  321. and Extract(year from f.STUDY_START_TIME)=#{year}
  322. </if>
  323. group by f.ID,f.DW_ID
  324. ) f on z.DZZDM=f.DZZDM -- on z.DZZDM=substr(f.DZZDM, 0, length(z.DZZDM))
  325. where 1=1
  326. and z.dzzdm in
  327. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  328. #{dzzdm}
  329. </foreach>
  330. group by z.DZZDM
  331. </select>
  332. <!--中心组学习出勤率明细-->
  333. <select id="selectZxzxxCqlDetailList" resultType="java.util.HashMap">
  334. select z.DZZDM,f.STUDY_START_TIME,
  335. round(sum(case when f.count>0 then round(ifnull(f.absentCount_JZXX,0)/f.count,4) else 0 end)/count(1),4)*100 as
  336. JZXXCQL -- 集中学习出勤率
  337. from ZZ_ZZQKXX z
  338. inner join (
  339. select f.ID,f.DW_ID as DZZDM,f.STUDY_START_TIME,
  340. count(1) as count,
  341. sum(case when f.STUDY_MODALITY_CODE='1' and (u.absent is null or u.absent=0) then 1 else 0 end) as
  342. absentCount_JZXX
  343. from ZZ_ZXZXX_FA f
  344. inner join ZZ_ZXZXX_CJLDBZ u on f.ID=u.CASE_ID
  345. where 1=1
  346. and (f.deleted = 0 or f.deleted is null)
  347. and (u.deleted = 0 or u.deleted is null)
  348. and f.STUDY_MODALITY_CODE='1'
  349. <if test="year!=null">
  350. and Extract(year from f.STUDY_START_TIME)=#{year}
  351. </if>
  352. group by f.ID,f.DW_ID,f.STUDY_START_TIME
  353. ) f on z.DZZDM=f.DZZDM -- on z.DZZDM=substr(f.DZZDM, 0, length(z.DZZDM))
  354. where 1=1
  355. and z.DZZDM =#{dzzdm}
  356. group by z.DZZDM,f.STUDY_START_TIME
  357. order by z.DZZDM,f.STUDY_START_TIME
  358. </select>
  359. <select id="selectZxzxxUserStudyList" resultType="java.util.HashMap">
  360. select u.LEADER_USER_ID as rybm,f.STUDY_START_TIME,f.STUDY_MODALITY_CODE,u.absent
  361. from ZZ_ZXZXX_FA f
  362. inner join ZZ_ZXZXX_CJLDBZ u on f.ID=u.CASE_ID
  363. where 1=1
  364. and (f.deleted = 0 or f.deleted is null)
  365. and (u.deleted = 0 or u.deleted is null)
  366. and f.STUDY_MODALITY_CODE='1'
  367. and f.DW_ID =#{dzzdm}
  368. <if test="year!=null">
  369. and Extract(year from f.STUDY_START_TIME)=#{year}
  370. </if>
  371. </select>
  372. <select id="selectPartyDuesUserCount" resultType="java.util.HashMap">
  373. select z.DZZDM,sum(num) USERCOUNT from ZZ_ZZQKXX z
  374. inner join (
  375. select z.DZZDM,count(1) as num from VM_RYJBXX u
  376. inner join ZZ_ZZQKXX z on u.SZDZBDM=z.DZZDM
  377. inner join rs_ryjbxxfb fb on u.RYBM = fb.RYBM
  378. where 1=1 and fb.partyDuesStartMonth <![CDATA[ <= ]]> #{yearMonth}
  379. group by z.DZZDM
  380. ) u on z.DZZDM=substr(u.DZZDM,1,length(z.DZZDM))
  381. where 1=1
  382. and z.dzzdm in
  383. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  384. #{dzzdm}
  385. </foreach>
  386. group by z.DZZDM
  387. </select>
  388. <!--统计党费缴纳报表-->
  389. <!--<select id="selectPartyduesTotalList" resultType="java.util.HashMap">
  390. select z.DZZDM,
  391. #{year} as year,
  392. #{month} as month,
  393. sum(ifnull(w.totalMoney,0)) as totalMoney,
  394. sum(ifnull(w.totalUser,0)) as totalUser,
  395. sum(ifnull(w.notDuesCount,0)) as notDuesCount,
  396. sum(ifnull(w.notDuesMoney,0)) as notDuesMoney
  397. from ZZ_ZZQKXX z
  398. inner join (
  399. select z.dzzdm,z.dzzmc,#{year} as year,#{month} as month,t1.totalMoney,t1.totalUser,t1.notDuesCount,t1.notDuesMoney
  400. from ZZ_ZZQKXX z
  401. left join (
  402. select pd.YEAR,d.MONTH, us.SZDZBDM as dzzdm
  403. ,sum(case when d.payState=1 then ifnull(d.money,0) else 0 end) as totalMoney
  404. ,sum(case when d.payState=1 then 1 else 0 end) totalUser
  405. ,sum(case when d.payState=1 then 0 else ifnull(pd.money,0) end) as notDuesMoney
  406. ,sum(case when d.payState=1 then 0 else 1 end) notDuesCount
  407. from VM_RYJBXX us
  408. inner join ZZ_ZZQKXX z on us.SZDZBDM=z.DZZDM
  409. left join US_PARTYDUES pd on pd.USERCODE = us.rybm and pd.YEAR=#{year}
  410. left join US_PARTYDUES_DETAIL d on pd.PARTYDUESID=d.PARTYDUESID and d.MONTH=#{month}
  411. inner join rs_ryjbxxfb fb on us.RYBM = fb.RYBM
  412. where 1=1
  413. and fb.partyDuesStartMonth <![CDATA[ <= ]]> #{yearMonth}
  414. group by pd.YEAR,d.MONTH,z.DZZDM
  415. ) t1 on z.dzzdm=t1.dzzdm
  416. where 1=1 and z.DZZDM like concat('%',#{dzzdm},'%')
  417. ) w on z.DZZDM=substr(w.DZZDM, 1, length(z.DZZDM))
  418. where 1=1
  419. and z.dzzdm in
  420. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  421. #{dzzdm}
  422. </foreach>
  423. group by z.DZZDM
  424. </select>-->
  425. <!--<select id="selectPartyduesTotalListV2" resultType="com.ghsc.partybuild.vo.PartyduesTotalVo">
  426. select
  427. #{year} as year
  428. , #{month} as month
  429. , p.DZZDM as partyCode
  430. , p.DZZMC as partyName
  431. , sum(ifnull(t.userCount, 0)) as userCount
  432. , sum(ifnull(t.alreadyPayUserCount, 0)) as alreadyPayUserCount
  433. , sum(ifnull(t.alreadyPayAmount, 0)) as alreadyPayAmount
  434. , sum(ifnull(t.didnotPayUserCount, 0)) as didnotPayUserCount
  435. , sum(ifnull(t.didnotPayAmount, 0)) as didnotPayAmount
  436. from ZZ_ZZQKXX p
  437. left join (select p.DZZDM,
  438. p.DZZMC,
  439. ifnull(pu.userCount, 0) as userCount,
  440. ifnull(already.alreadyPayUserCount, 0) as alreadyPayUserCount,
  441. ifnull(already.alreadyPayAmount, 0) as alreadyPayAmount,
  442. ifnull(didnot.didnotPayUserCount, 0) as didnotPayUserCount,
  443. ifnull(didnot.didnotPayAmount, 0) as didnotPayAmount
  444. from ZZ_ZZQKXX p
  445. left join (select p.DZZDM
  446. , p.DZZMC
  447. , sum(case when pu.RYBM is not null then 1 else 0 end) as userCount
  448. from zz_zzqkxx p
  449. inner join vm_ryjbxx pu on p.DZZDM = pu.SZDZBDM
  450. inner join rs_ryjbxxfb fb on pu.RYBM = fb.RYBM
  451. where 1 = 1 and fb.partyDuesStartMonth <![CDATA[ <= ]]> #{yearMonth}
  452. group by p.DZZDM, p.DZZMC) pu on p.DZZDM = pu.DZZDM
  453. left join (select p.DZZDM
  454. , p.DZZMC
  455. , sum(case when pdd.payState = 1 then ifnull(pdd.money, 0) else 0 end) as alreadyPayAmount &#45;&#45; 已缴总额
  456. , sum(case when pdd.payState = 1 then 1 else 0 end) alreadyPayUserCount &#45;&#45; 已缴人数
  457. from zz_zzqkxx p
  458. inner join us_partydues_detail pdd on p.DZZDM = pdd.PARTYCODE and pdd.MONTH = #{month}
  459. inner join us_partydues pd on pdd.PARTYDUESID = pd.PARTYDUESID and pd.YEAR = #{year}
  460. where pdd.payState = 1
  461. group by p.DZZDM, p.DZZMC) already on p.DZZDM = already.DZZDM
  462. left join (select p.DZZDM
  463. , p.DZZMC
  464. , sum(1) as didnotPayUserCount
  465. , sum(case
  466. when pd.USERCODE is null and fb.isStudent = 1 then 0.2
  467. else ifnull(pd.money, 0) end) as didnotPayAmount
  468. from zz_zzqkxx p
  469. inner join vm_ryjbxx pu on p.DZZDM = pu.SZDZBDM
  470. inner join rs_ryjbxxfb fb on pu.RYBM = fb.RYBM
  471. left join us_partydues pd on pu.RYBM = pd.USERCODE and pd.YEAR = #{year}
  472. left join us_partydues_detail pdd
  473. on pd.PARTYDUESID = pdd.PARTYDUESID and pdd.MONTH = #{month}
  474. where (pdd.payState is null or pdd.payState != 1) and fb.partyDuesStartMonth <![CDATA[ <= ]]> #{yearMonth}
  475. group by p.DZZDM, p.DZZMC) didnot on p.DZZDM = didnot.DZZDM) t
  476. on p.DZZDM = substr(t.DZZDM, 1, length(p.DZZDM))
  477. where 1=1 and p.DZZDM like concat('',#{gddwdm},'%')
  478. <if test="parentPartyCode!=null and parentPartyCode!=''">
  479. and p.DZZDM like concat('%',#{parentPartyCode},'%')
  480. </if>
  481. <if test="partyCode!=null and partyCode!=''">
  482. and p.DZZDM = #{partyCode}
  483. </if>
  484. group by p.DZZDM, p.DZZMC
  485. order by length(p.DZZDM), p.DZZDM
  486. </select>-->
  487. <select id="selectPartyduesTotalListV2" resultType="com.ghsc.partybuild.vo.PartyduesTotalVo">
  488. select
  489. #{year} as `year`
  490. , #{month} as `month`
  491. , p.DZZDM as partyCode
  492. , p.DZZMC as partyName
  493. , sum(ifnull(t.userCount, 0)) as userCount
  494. , sum(ifnull(t.alreadyPayUserCount, 0)) as alreadyPayUserCount
  495. , sum(ifnull(t.alreadyPayAmount, 0)) as alreadyPayAmount
  496. , sum(ifnull(t.didnotPayUserCount, 0)) as didnotPayUserCount
  497. , sum(ifnull(t.didnotPayAmount, 0)) as didnotPayAmount
  498. from ZZ_ZZQKXX p
  499. left join (
  500. select p.DZZDM,p.DZZMC,sum(1) as userCount
  501. , sum(case when pdd.payState = 1 then ifnull(pdd.money, 0) else 0 end) as alreadyPayAmount -- 已缴总额
  502. , sum(case when pdd.payState = 1 then 1 else 0 end) alreadyPayUserCount -- 已缴人数
  503. , sum(case when (pdd.payState is null or pdd.payState <![CDATA[ <> ]]> 1) then 1 else 0 end) as didnotPayUserCount -- 未缴人数
  504. , sum(case
  505. when (pdd.payState is null or pdd.payState <![CDATA[ <> ]]> 1) and pd.MONEY is null and fb.isStudent = 1 then 0.2
  506. when (pdd.payState is null or pdd.payState <![CDATA[ <> ]]> 1) and pd.MONEY is not null then ifnull(pd.money, 0)
  507. else 0 end) as didnotPayAmount -- 未缴总额
  508. from zz_zzqkxx p
  509. inner join us_party_month us on us.partyCode = p.DZZDM and us.yearMonth = #{yearMonth}
  510. inner join us_partydues pd on us.userCode = pd.USERCODE and pd.YEAR = #{year}
  511. inner join us_partydues_detail pdd on pd.PARTYDUESID = pdd.PARTYDUESID and pdd.MONTH = #{month}
  512. inner join rs_ryjbxxfb fb on us.userCode = fb.RYBM
  513. where 1 = 1 and (fb.partyDuesStartMonth <![CDATA[ <= ]]> #{yearMonth} or fb.partyDuesStartMonth is null)
  514. group by p.DZZDM,p.DZZMC
  515. ) t
  516. on p.DZZDM = substr(t.DZZDM, 1, length(p.DZZDM))
  517. where 1=1 and p.DZZDM like concat('',#{gddwdm},'%')
  518. <if test="parentPartyCode!=null and parentPartyCode!=''">
  519. and p.DZZDM like concat('%',#{parentPartyCode},'%')
  520. </if>
  521. <if test="partyCode!=null and partyCode!=''">
  522. and p.DZZDM = #{partyCode}
  523. </if>
  524. group by p.DZZDM, p.DZZMC
  525. order by length(p.DZZDM), p.DZZDM
  526. </select>
  527. <!--已缴党费成员-->
  528. <select id="selectPartyduesUserList" resultType="java.util.HashMap">
  529. select t1.xm1,t1.baseNumber1,t1.totalMoney1,t2.xm2,t2.baseNumber2,t2.totalMoney2
  530. from (select ROWNUM as id,xm as xm1,baseNumber as baseNumber1,totalMoney as totalMoney1,null,null,null
  531. from (
  532. select ROWNUM,MOD(ROWNUM, 2) as type,t.xm,t.totalMoney,t.BASENUMBER
  533. from (
  534. select us.XM,ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) as totalMoney,pd.BASENUMBER
  535. from US_PARTYDUES pd
  536. inner join US_PARTYDUES_DETAIL d on pd.PARTYDUESID = d.PARTYDUESID and d.payState=1
  537. inner join VM_RYJBXX_ALL us on pd.USERCODE = us.rybm
  538. inner join ZZ_ZZQKXX z on us.SZDZBDM=z.DZZDM
  539. where 1=1 and pd.YEAR=#{year} and d.MONTH=#{month}
  540. and us.SZDZBDM like concat( '%',#{dzzdm},'%')
  541. order by ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) desc
  542. ) t
  543. )
  544. where 1 = 1 and type = 1
  545. order by ROWNUM
  546. ) t1
  547. left join (
  548. select ROWNUM as id,null,null,null,XM as xm2,BASENUMBER as baseNumber2,TOTALMONEY as totalMoney2
  549. from (
  550. select ROWNUM,MOD(ROWNUM, 2) as type,t.xm,t.totalMoney,t.BASENUMBER
  551. from (
  552. select us.XM,ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) as totalMoney,pd.BASENUMBER
  553. from US_PARTYDUES pd
  554. inner join US_PARTYDUES_DETAIL d on pd.PARTYDUESID = d.PARTYDUESID and d.payState=1
  555. inner join VM_RYJBXX_ALL us on pd.USERCODE = us.rybm
  556. inner join ZZ_ZZQKXX z on us.SZDZBDM=z.DZZDM
  557. where 1=1 and pd.YEAR=#{year} and d.MONTH=#{month}
  558. and us.SZDZBDM like concat('%',#{dzzdm},'%')
  559. order by ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) desc
  560. ) t
  561. )
  562. where 1 = 1 and type = 0
  563. order by ROWNUM
  564. ) t2 on t1.id = t2.id
  565. </select>
  566. <!--已缴党费成员(一行一个党员)-->
  567. <select id="selectAlreadyPayUserList" resultType="com.ghsc.partybuild.vo.PartyduesAlreadyPayDetailVo">
  568. select
  569. #{year} as `year`
  570. , #{month} as `month`
  571. , p.DZZDM as partyCode
  572. , p.DZZMC as partyName
  573. , um.userCode
  574. , us.xm as userName
  575. , ifnull(pdd.MONEY, 0) as payAmount
  576. from zz_zzqkxx p
  577. inner join us_party_month um on um.partyCode = p.DZZDM and um.yearMonth = #{yearMonth}
  578. inner join vm_ryjbxx_all us on um.userCode = us.rybm
  579. inner join US_PARTYDUES pd on um.userCode = pd.USERCODE
  580. inner join US_PARTYDUES_DETAIL pdd on pd.PARTYDUESID = pdd.PARTYDUESID
  581. where pdd.payState = 1
  582. and pd.YEAR = #{year}
  583. and pdd.MONTH = #{month}
  584. and um.partyCode like concat('%',#{partyCode},'%')
  585. order by ifnull(pdd.MONEY, 0) desc,CONVERT(us.xm USING gbk)
  586. </select>
  587. <!--未缴党费成员-->
  588. <select id="selectDidnotPayUserList" resultType="com.ghsc.partybuild.vo.PartyduesDidnotPayDetailVo">
  589. select #{year} as `year`
  590. , #{month} as `month`
  591. , p.DZZDM as partyCode
  592. , p.DZZMC as partyName
  593. , um.userCode
  594. , us.xm as userName
  595. , case
  596. when pdd.money is null and fb.isStudent = 1 then 0.2
  597. else ifnull(pdd.money, 0) end as didNotPayAmount
  598. from zz_zzqkxx p
  599. inner join us_party_month um on um.partyCode = p.DZZDM and um.yearMonth = #{yearMonth}
  600. inner join vm_ryjbxx_all us on um.userCode = us.rybm
  601. inner join US_PARTYDUES pd on um.userCode = pd.USERCODE
  602. inner join US_PARTYDUES_DETAIL pdd on pd.PARTYDUESID = pdd.PARTYDUESID
  603. inner join rs_ryjbxxfb fb on um.userCode = fb.RYBM
  604. where (pdd.payState is null or pdd.payState <![CDATA[ <> ]]> 1)
  605. and pd.YEAR = #{year} and pdd.MONTH = #{month}
  606. and um.partyCode like concat('%',#{partyCode},'%')
  607. and (fb.partyDuesStartMonth <![CDATA[ <= ]]> #{yearMonth} or fb.partyDuesStartMonth is null)
  608. order by case
  609. when pdd.money is null and fb.isStudent = 1 then 0.2
  610. else ifnull(pdd.money, 0) end desc,CONVERT(us.xm USING gbk)
  611. </select>
  612. <!--统计党组织每月缴纳党费-->
  613. <select id="selectPartyduesMonthTotalList" resultType="java.util.HashMap">
  614. select z.DZZDM,
  615. #{year} as YEAR,
  616. sum(ifnull(pd.month1, 0)) as MONTH1,
  617. sum(ifnull(pd.month2, 0)) as MONTH2,
  618. sum(ifnull(pd.month3, 0)) as MONTH3,
  619. sum(ifnull(pd.month4, 0)) as MONTH4,
  620. sum(ifnull(pd.month5, 0)) as MONTH5,
  621. sum(ifnull(pd.month6, 0)) as MONTH6,
  622. sum(ifnull(pd.month7, 0)) as MONTH7,
  623. sum(ifnull(pd.month8, 0)) as MONTH8,
  624. sum(ifnull(pd.month9, 0)) as MONTH9,
  625. sum(ifnull(pd.month10, 0)) as MONTH10,
  626. sum(ifnull(pd.month11, 0)) as MONTH11,
  627. sum(ifnull(pd.month12, 0)) as MONTH12,
  628. sum(ifnull(pd.total, 0)) as TOTAL
  629. from ZZ_ZZQKXX z
  630. inner join (
  631. select us.SZDZBDM as dzzdm,
  632. sum(case when d.MONTH = 1 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month1,
  633. sum(case when d.MONTH = 2 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month2,
  634. sum(case when d.MONTH = 3 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month3,
  635. sum(case when d.MONTH = 4 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month4,
  636. sum(case when d.MONTH = 5 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month5,
  637. sum(case when d.MONTH = 6 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month6,
  638. sum(case when d.MONTH = 7 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month7,
  639. sum(case when d.MONTH = 8 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month8,
  640. sum(case when d.MONTH = 9 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month9,
  641. sum(case when d.MONTH = 10 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month10,
  642. sum(case when d.MONTH = 11 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month11,
  643. sum(case when d.MONTH = 12 then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as month12,
  644. sum( ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0)) as total
  645. from US_PARTYDUES pd
  646. inner join US_PARTYDUES_DETAIL d on pd.PARTYDUESID = d.PARTYDUESID and d.payState=1
  647. inner join VM_RYJBXX us on pd.USERCODE = us.rybm
  648. inner join ZZ_ZZQKXX z on us.SZDZBDM = z.DZZDM
  649. where 1=1 and us.SZDZBDM like concat('%',#{dzzdm},'%') and pd.YEAR=#{year}
  650. group by us.SZDZBDM
  651. ) pd on z.DZZDM = substr(pd.DZZDM, 1, length(z.DZZDM))
  652. where 1=1
  653. and z.dzzdm in
  654. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  655. #{dzzdm}
  656. </foreach>
  657. group by z.DZZDM
  658. </select>
  659. <select id="selectPartyduesMonthTotalListV2" resultType="com.ghsc.partybuild.vo.PartyduesTotalDetailVo">
  660. select p.dzzmc as partyName
  661. , p.dzzdm as partyCode
  662. , #{year} as `year`
  663. , p.`month` as `month`
  664. , sum(ifnull(t.amount, 0)) amount
  665. from (select p.dzzdm, p.dzzmc, dic.DICKEY as `month`, cast(concat(#{year}, lpad(dic.DICKEY, 2, '0')) as signed) as yearMonth
  666. from zz_zzqkxx p,
  667. cf_dictionary dic
  668. where dic.DICTYPEKEY = 'monthType') p
  669. left join (select upm.partyCode, pdd.yearMonth, sum(ifnull(pdd.MONEY, 0)) as amount
  670. from (select cast(concat(pd.YEAR, lpad(pdd.month, 2, '0')) as signed) as yearMonth
  671. , pdd.MONEY
  672. , pd.USERCODE
  673. from us_partydues pd
  674. inner join us_partydues_detail pdd on pd.PARTYDUESID = pdd.PARTYDUESID
  675. where pd.YEAR = #{year}
  676. and pdd.payState = 1) pdd
  677. inner join us_party_month upm
  678. on pdd.userCode = upm.userCode and upm.yearMonth = pdd.yearMonth
  679. group by upm.partyCode, pdd.yearMonth) t
  680. on p.DZZDM = substr(t.partyCode, 1, length(p.DZZDM)) and p.yearMonth = t.yearMonth
  681. where 1=1 and p.DZZDM like concat('',#{gddwdm},'%')
  682. <if test="partyCode != null and partyCode != ''">
  683. and p.dzzdm like concat('%',#{partyCode},'%')
  684. </if>
  685. group by p.dzzdm, p.dzzmc, p.yearMonth, p.`month`
  686. order by length(p.DZZDM), p.DZZDM, p.yearMonth
  687. </select>
  688. <!--统计党组织季度缴纳党费-->
  689. <select id="selectPartyduesQuarterTotalList" resultType="java.util.HashMap">
  690. select z.DZZDM,
  691. #{year} as year,
  692. sum(ifnull(pd.quarter1, 0)) as quarter1,
  693. sum(ifnull(pd.quarter2, 0)) as quarter2,
  694. sum(ifnull(pd.quarter3, 0)) as quarter3,
  695. sum(ifnull(pd.quarter4, 0)) as quarter4,
  696. sum(ifnull(pd.total, 0)) as total
  697. from ZZ_ZZQKXX z
  698. inner join (
  699. select us.SZDZBDM as dzzdm,
  700. sum(case when d.MONTH in (1, 2, 3) then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as quarter1,
  701. sum(case when d.MONTH in (4, 5, 6) then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as quarter2,
  702. sum(case when d.MONTH in (7, 8, 9) then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as quarter3,
  703. sum(case when d.MONTH in (10, 11, 12) then ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0) else 0 end) as quarter4,
  704. sum(ifnull(d.MONEY, 0) + ifnull(d.SPECIALEXPENSES, 0)) as total
  705. from US_PARTYDUES pd
  706. inner join US_PARTYDUES_DETAIL d on pd.PARTYDUESID = d.PARTYDUESID and d.payState=1
  707. inner join VM_RYJBXX us on pd.USERCODE = us.rybm
  708. inner join ZZ_ZZQKXX z on us.SZDZBDM = z.DZZDM
  709. where 1=1 and us.SZDZBDM like concat ( '%',#{dzzdm},'%') and pd.YEAR=#{year}
  710. group by us.SZDZBDM
  711. ) pd on z.DZZDM = substr(pd.DZZDM, 1, length(z.DZZDM))
  712. where 1=1
  713. and z.dzzdm in
  714. <foreach collection="dzzdmList" item="dzzdm" index="index" open="(" close=")" separator=",">
  715. #{dzzdm}
  716. </foreach>
  717. group by z.DZZDM
  718. </select>
  719. <select id="selectZtdrTotalList" resultType="java.util.HashMap">
  720. select z.DZZDM,z.DZZMC,zd.ID,zd.ACTIVITYTIME,zd.TITLE from DJ_ztdrxx zd
  721. inner join ZZ_ZZQKXX z on zd.DZZDM = z.DZZDM
  722. where 1=1
  723. <if test="dzzdm!=null and dzzdm !=''">
  724. and zd.dzzdm =#{dzzdm}
  725. </if>
  726. <if test="year!=null">
  727. and date_format(zd.ACTIVITYTIME,'%Y')= #{year}
  728. </if>
  729. <if test="month!=null">
  730. and date_format(zd.ACTIVITYTIME,'%m')= #{month}
  731. </if>
  732. order by z.DZZDM
  733. </select>
  734. <select id="selectLeaderUserTotalList" resultType="java.util.HashMap">
  735. select SUBSTR(#{yearMonth},1,6) as YEARMONTH,us.XMPY,us.RYBM,us.xm,
  736. (case when dw2.ZZLB =100 then dw2.DZZMC else dw.DZZMC end) as DWMC,
  737. case when sum(case when l.LEADERTYPE is not null then 1 else 0 end)>0 then '是' else '否' end as ISWRITE
  738. from vm_ryjbxx us
  739. inner join RS_RYJBXXFB fb on us.RYBM = fb.RYBM
  740. inner join ZZ_ZZQKXX dw on SUBSTR(us.SZDZBDM,1,12)=dw.DZZDM
  741. left join (
  742. select zz2.DZZDM,zz2.DZZMC,fb2.ZZLB from ZZ_ZZQKXX zz2 inner join ZZ_ZZQKXXFB fb2 on zz2.DZZDM=fb2.DZZDM
  743. ) dw2 on SUBSTR(us.SZDZBDM,1,15)=dw2.DZZDM
  744. left join US_USERLEADER l on us.RYBM = l.USERCODE and l.LEADERTIME <![CDATA[ >= ]]> to_date(#{yearMonth},'yyyyMMdd')
  745. where 1=1 and fb.SFSLDRY = 1 -- 领导人员
  746. <if test="dzzdm!=null and dzzdm !=''">
  747. and us.SZDZBDM like concat('%',#{dzzdm},'%')
  748. </if>
  749. <if test="xm!=null and xm !=''">
  750. and us.XM like concat ('%',#{xm},'%')
  751. </if>
  752. group by us.RYBM,us.xm,us.XMPY,us.RYJBXXBS,dw.DZZMC,dw2.DZZMC,dw2.ZZLB
  753. order by us.XMPY,us.RYJBXXBS
  754. </select>
  755. <select id="selectSystemUseTotalList" resultType="java.util.HashMap">
  756. select * from (
  757. select zz.DZZDM,zz.DZZMC,zzlb.HZMC as ZZLBMC,jczzfl.HZMC as JCZZFLMC,
  758. case when zzlb.bm is null then '无' else '有' end as ISZZLB,
  759. case when jczzfl.bm is null then '无' else '有' end as ISJCZZFL,
  760. case when fb.ZGRS is null then '无' else '有' end as ISZGS,
  761. #{fundYear} as FUNDYEAR,
  762. case when funds.PARTYCODE is null then '无' else '有' end as ISFUND,
  763. case when funds.MONEY >100 then '有' else '无' end as IS100,
  764. SUBSTR(#{duesYearMonth},1,6) as DUESMONTH,
  765. case when dues.PARTYCODE is null then '否' else '是' end as ISDUES,
  766. SUBSTR(#{meetingYearMonth},1,6) as MEETINGMONTH,
  767. case when meeting.PARTYCODE is null then '否' else '是' end as ISMEETING,
  768. case when plan.PARTYCODE is null then '否' else '是' end as ISPLAN,
  769. SUBSTR(#{partydayYearMonth},1,6) as PARTYDAYMONTH,
  770. case when partyday.PARTYCODE is null then '否' else '是' end as ISPARTYDAY,
  771. SUBSTR(#{positionYearMonth},1,6) as POSITIONMONTH,
  772. case when ppsi.PARTYCODE is null then '否' else '是' end as ISPOSITION,
  773. (case when dw2.ZZLB =100 then dw2.DZZMC else dw.DZZMC end) as DWMC
  774. from ZZ_ZZQKXX zz
  775. left join ZZ_ZZQKXX dw on SUBSTR(zz.DZZDM,1,12)=dw.DZZDM
  776. left join (
  777. select zz2.DZZDM,zz2.DZZMC,fb2.ZZLB from ZZ_ZZQKXX zz2 inner join ZZ_ZZQKXXFB fb2 on zz2.DZZDM=fb2.DZZDM
  778. ) dw2 on SUBSTR(zz.DZZDM,1,15)=dw2.DZZDM
  779. left join ZZ_ZZQKXXFB fb on zz.DZZDM = fb.DZZDM
  780. left join ZZZD_ZZLBDMNEW zzlb on fb.ZZLB = zzlb.BM
  781. left join ZZZD_JCZZFLNEW jczzfl on fb.JCZZFL = jczzfl.BM
  782. left join (select PARTYCODE,max(ifnull(ACTIVITYFUNDS,0)+ifnull(REWARDFUNDS,0)) as MONEY from DJ_FundsBudget where SYNCSTATE <![CDATA[ <> ]]> 'D' and YEAR = #{fundYear} group by PARTYCODE) funds on zz.DZZDM = funds.PARTYCODE
  783. left join (select detail.PARTYCODE from US_PARTYDUES ds
  784. inner join US_PARTYDUES_DETAIL detail on ds.PARTYDUESID = detail.PARTYDUESID
  785. where ds.SYNCSTATE <![CDATA[ <> ]]> 'D' and detail.SYNCSTATE <![CDATA[ <> ]]> 'D'
  786. and ds.YEAR = to_number(substr(#{duesYearMonth},1,4))
  787. and detail.MONTH = to_number(substr(#{duesYearMonth},5,2))
  788. group by detail.PARTYCODE) dues on zz.DZZDM = dues.PARTYCODE
  789. left join (select PARTYCODE from SHYK_MEETING where SYNCSTATE <![CDATA[ <> ]]> 'D' and BEGINTIME <![CDATA[ >= ]]> date_format(#{meetingYearMonth},'yyyyMMdd') group by PARTYCODE) meeting on zz.DZZDM = meeting.PARTYCODE
  790. left join (select PARTYCODE from SHYK_PARTYPLAN where SYNCSTATE <![CDATA[ <> ]]> 'D' group by PARTYCODE) plan on zz.DZZDM = plan.PARTYCODE
  791. left join (select dr.DZZDM as PARTYCODE from DJ_ZTDRXX dr
  792. where dr.SYNCSTATE <![CDATA[ <> ]]> 'D' and dr.ACTIVITYTIME <![CDATA[ >= ]]> date_format(#{partydayYearMonth},'%Y%m%d') group by dr.DZZDM) partyday on zz.DZZDM = partyday.PARTYCODE
  793. left join (select psi.PARTYCODE as PARTYCODE from PUB_PUBLICITYPOSITION psi
  794. inner join PUB_PUBLICITYPOSITION_PANEL plan on psi.PUBLICITYPOSITIONID = plan.PUBLICITYPOSITIONID
  795. where psi.SYNCSTATE <![CDATA[ <> ]]> 'D' and plan.SYNCSTATE <![CDATA[ <> ]]> 'D' and plan.PANELTIME <![CDATA[ >= ]]> to_date(#{positionYearMonth},'yyyyMMdd')
  796. group by psi.PARTYCODE
  797. ) ppsi on zz.DZZDM = ppsi.PARTYCODE
  798. where 1=1 and (fb.ZZLB not in('500') or fb.zzlb is null)
  799. and zz.DZZDM <![CDATA[ <> ]]> '001091209'
  800. <if test="dzzdm!=null and dzzdm !=''">
  801. and zz.dzzdm like concat ('%',#{dzzdm},'%')
  802. </if>
  803. ) t
  804. order by t.DWMC,t.DZZDM
  805. </select>
  806. <select id="selectPartyLifeTotalList" resultType="java.util.HashMap">
  807. select z.DZZDM as PARTYCODE,z.DZZMC,dr.partyday,zzsr.politics,#{year} YEAR
  808. from ZZ_ZZQKXX z
  809. inner join ZZ_ZZQKXXFB fb on z.DZZDM=fb.DZZDM
  810. left join (
  811. select zz.DZZDM PARTYCODE,
  812. zz.DZZMC,
  813. ifnull(sum(conut1),0) shyk_user,
  814. ifnull(sum(conut2),0) shyk_branch,
  815. ifnull(sum(conut3),0) shyk_group,
  816. ifnull(sum(conut4),0) shyk_class
  817. from ZZ_ZZQKXX zz
  818. inner join (
  819. select DZZDM,
  820. sum(case when SHYKTYPE = 1 then 1 else 0 end) as conut1,
  821. sum(case when SHYKTYPE = 2 then 1 else 0 end) as conut2,
  822. sum(case when SHYKTYPE = 3 then 1 else 0 end) as conut3,
  823. sum(case when SHYKTYPE = 4 then 1 else 0 end) as conut4
  824. from (
  825. select m.PARTYCODE as dzzdm,
  826. m.SHYKTYPE
  827. from SHYK_MEETING m
  828. where extract(year from m.BEGINTIME)=#{year}
  829. and m.OPERATESTATE != 'D'
  830. )
  831. group by dzzdm
  832. ) u on zz.DZZDM = substr(u.dzzdm, 1, length(zz.DZZDM))
  833. group by zz.DZZDM,zz.DZZMC
  834. ) r on r.PARTYCODE=z.DZZDM----三会一课统计信息
  835. left join (
  836. select zz.DZZDM PARTYCODE,
  837. zz.DZZMC,
  838. ifnull(sum(ztcount),0) as partyday
  839. from ZZ_ZZQKXX zz
  840. inner join (
  841. select zx.DZZDM,sum(1) as ztcount from DJ_ZTDRXX zx
  842. where extract(year from zx.ACTIVITYTIME)=#{year}
  843. and OPERATESTATE!='D'
  844. group by zx.DZZDM
  845. )d on zz.DZZDM=substr(d.dzzdm, 1, length(zz.DZZDM))
  846. group by zz.DZZDM,zz.DZZMC
  847. )dr on dr.PARTYCODE=z.DZZDM ---主题党日统计信息
  848. left join (
  849. select zz.DZZDM PARTYCODE,
  850. zz.DZZMC,
  851. ifnull(sum(polcount),0) as politics
  852. from ZZ_ZZQKXX zz
  853. inner join (
  854. select zx.DZZDM,sum(1) as polcount from DJ_ZZSR zx
  855. where extract(year from zx.ACTIVITYTIME)=#{year}
  856. and OPERATESTATE!='D'
  857. group by zx.DZZDM
  858. )d on zz.DZZDM=substr(d.dzzdm, 1, length(zz.DZZDM))
  859. group by zz.DZZDM,zz.DZZMC
  860. )zzsr on zzsr.PARTYCODE=z.DZZDM ---政治生日统计信息
  861. where 1=1 and fb.ZZLB not in(500) and z.DZZDM like '001091209%'
  862. <if test="dzzdm!=null and dzzdm !=''">
  863. and z.DZZDM like concat ( '%',#{dzzdm},'%')
  864. </if>
  865. <if test="dzzmc!=null and dzzmc !=''">
  866. and z.DZZMC like concat ( '%',#{dzzmc},'%')
  867. </if>
  868. order by SUBSTR(z.DZZDM,1,LENGTH(z.DZZDM)-3),z.DZZDM
  869. </select>
  870. <select id="selectPartyLifeMonthTotalList" resultType="java.util.HashMap">
  871. select zz.month,zz.DZZDM,zz.DZZMC,shyk.SHYKCOUNT,ztdr.PARTYDAYCOUNT,zzsr.POLITICSCOUNT
  872. from
  873. (
  874. select t1.month,zz.DZZDM,zz.DZZMC,fb.ZZLB
  875. from (select level month from dual connect by 0 + level <![CDATA[ <= ]]> 12) t1,ZZ_ZZQKXX zz
  876. inner join ZZ_ZZQKXXFB fb on zz.DZZDM=fb.DZZDM
  877. ) zz
  878. left join (
  879. select zz.MONTH,zz.DZZDM,zz.DZZMC,
  880. ifnull(sum(shyk.count),0) as SHYKCOUNT
  881. from (
  882. select t1.month,zz.DZZDM,zz.DZZMC
  883. from (select level month from dual connect by 0 + level <![CDATA[ <= ]]> 12) t1,ZZ_ZZQKXX zz
  884. ) zz
  885. inner join (
  886. select m.PARTYCODE as dzzdm,extract(month from m.BEGINTIME) as month,count(1) as count
  887. from SHYK_MEETING m
  888. where extract(year from m.BEGINTIME)=#{year} and m.OPERATESTATE != 'D'
  889. group by m.PARTYCODE,extract(month from m.BEGINTIME)
  890. ) shyk on zz.DZZDM = substr(shyk.dzzdm, 1, length(zz.DZZDM)) and zz.month = shyk.month
  891. where 1=1
  892. <if test="dzzdm!=null and dzzdm !=''">
  893. and zz.DZZDM like concat('%',#{dzzdm},'%')
  894. </if>
  895. <if test="dzzmc!=null and dzzmc !=''">
  896. and zz.DZZMC like concat('%',#{dzzmc},'%')
  897. </if>
  898. group by zz.DZZDM,zz.DZZMC,zz.MONTH
  899. ) shyk on zz.DZZDM = shyk.DZZDM and zz.month = shyk.month
  900. left join (
  901. select zz.MONTH,zz.DZZDM,zz.DZZMC,
  902. ifnull(sum(ztdr.count),0) as PARTYDAYCOUNT
  903. from (
  904. select t1.month,zz.DZZDM,zz.DZZMC
  905. from (select level month from dual connect by 0 + level <![CDATA[ <= ]]> 12) t1,ZZ_ZZQKXX zz
  906. ) zz
  907. inner join (
  908. select ztdr.DZZDM as dzzdm,extract(month from ztdr.ACTIVITYTIME) as month,count(1) as count
  909. from DJ_ZTDRXX ztdr
  910. where extract(year from ztdr.ACTIVITYTIME)=#{year} and ztdr.OPERATESTATE != 'D'
  911. group by ztdr.DZZDM,extract(month from ztdr.ACTIVITYTIME)
  912. ) ztdr on zz.DZZDM = substr(ztdr.dzzdm, 1, length(zz.DZZDM)) and zz.month = ztdr.month
  913. where 1=1
  914. <if test="dzzdm!=null and dzzdm !=''">
  915. and zz.DZZDM like concat('%',#{dzzdm},'%')
  916. </if>
  917. <if test="dzzmc!=null and dzzmc !=''">
  918. and zz.DZZMC like concat('%',#{dzzmc},'%')
  919. </if>
  920. group by zz.DZZDM,zz.DZZMC,zz.MONTH
  921. ) ztdr on zz.DZZDM = ztdr.DZZDM and zz.month = ztdr.month
  922. left join (
  923. select zz.MONTH,zz.DZZDM,zz.DZZMC,
  924. ifnull(sum(zzsr.count),0) as POLITICSCOUNT
  925. from (
  926. select t1.month,zz.DZZDM,zz.DZZMC
  927. from (select level month from dual connect by 0 + level <![CDATA[ <= ]]> 12) t1,ZZ_ZZQKXX zz
  928. ) zz
  929. inner join (
  930. select zzsr.DZZDM as dzzdm,extract(month from zzsr.ACTIVITYTIME) as month,count(1) as count
  931. from DJ_ZZSR zzsr
  932. where extract(year from zzsr.ACTIVITYTIME)=#{year} and zzsr.OPERATESTATE != 'D'
  933. group by zzsr.DZZDM,extract(month from zzsr.ACTIVITYTIME)
  934. ) zzsr on zz.DZZDM = substr(zzsr.dzzdm, 1, length(zz.DZZDM)) and zz.month = zzsr.month
  935. where 1=1
  936. <if test="dzzdm!=null and dzzdm !=''">
  937. and zz.DZZDM like concat( '%',#{dzzdm},'%')
  938. </if>
  939. <if test="dzzmc!=null and dzzmc !=''">
  940. and zz.DZZMC like concat ('%',#{dzzmc},'%')
  941. </if>
  942. group by zz.DZZDM,zz.DZZMC,zz.MONTH
  943. ) zzsr on zz.DZZDM = zzsr.DZZDM and zz.month = zzsr.month
  944. where 1=1 and zz.ZZLB not in(500) and zz.DZZDM like '001091209%'
  945. <if test="dzzdm!=null and dzzdm !=''">
  946. and zz.DZZDM like concat( '%',#{dzzdm},'%')
  947. </if>
  948. <if test="dzzmc!=null and dzzmc !=''">
  949. and zz.DZZMC like concat( '%',#{dzzmc},'%')
  950. </if>
  951. order by zz.DZZDM,zz.MONTH
  952. </select>
  953. <select id="selectPartyActivityTotalList" resultType="java.util.HashMap">
  954. select z.DZZMC,z.DZZDM,cgjq.POSTCOUNT,cgjq.VANPOSTCOUNT,cgjq.ARERCOUNT,cgjq.REDARERCOUNT,
  955. result.RESULTCOUNT ,brand.BRANDCOUNT,room.ACTIVITYROOMCOUNT,#{year} YEAR
  956. from ZZ_ZZQKXX z
  957. inner join ZZ_ZZQKXXFB fb on z.DZZDM=fb.DZZDM
  958. left join (
  959. select zz.DZZDM,
  960. zz.DZZMC,
  961. ifnull(sum(POSTCOUNT),0) POSTCOUNT,
  962. ifnull(sum(VANPOSTCOUNT),0) VANPOSTCOUNT,
  963. ifnull(sum(ARERCOUNT),0) ARERCOUNT,
  964. ifnull(sum(REDARERCOUNT),0) REDARERCOUNT
  965. from ZZ_ZZQKXX zz
  966. inner join (
  967. select dzzdm,
  968. sum(case when CGJQTYPE = 1 then 1 else 0 end) as POSTCOUNT,
  969. sum(case when CGJQTYPE = 1 and GQTYPE = 1 then 1 else 0 end) as VANPOSTCOUNT,
  970. sum(case when CGJQTYPE = 2 then 1 else 0 end) as ARERCOUNT,
  971. sum(case when CGJQTYPE = 2 and GQTYPE = 1 then 1 else 0 end) as REDARERCOUNT
  972. from (
  973. select cgjq.PARTYCODE as dzzdm,cgjq.CGJQTYPE,cgjq.GQTYPE
  974. from CGJQ_POSTAREA_SCORE cgjq
  975. where YEAR =#{year}
  976. and cgjq.OPERATESTATE != 'D'
  977. )
  978. group by dzzdm
  979. ) u on zz.DZZDM = substr(u.dzzdm, 1, length(zz.DZZDM))
  980. group by zz.DZZDM,zz.DZZMC
  981. ) cgjq on cgjq.DZZDM=z.DZZDM ----创岗建区统计
  982. left join (
  983. select zz.DZZDM,
  984. zz.DZZMC,
  985. ifnull(sum(RESULTCOUNT),0) as RESULTCOUNT
  986. from ZZ_ZZQKXX zz
  987. inner join (
  988. select zx.PARTYCODE as dzzdm,sum(1) as RESULTCOUNT from DJ_RESULTMG zx
  989. where extract(year from zx.SCORETIME)=#{year}
  990. and OPERATESTATE!='D'
  991. group by zx.PARTYCODE
  992. )d on zz.DZZDM=substr(d.dzzdm, 1, length(zz.DZZDM))
  993. group by zz.DZZDM,zz.DZZMC
  994. )result on result.DZZDM=z.DZZDM ---党建成果统计
  995. left join (
  996. select zz.DZZDM,
  997. zz.DZZMC,
  998. ifnull(sum(BRANDCOUNT),0) as BRANDCOUNT
  999. from ZZ_ZZQKXX zz
  1000. inner join (
  1001. select zx.PARTYCODE as dzzdm,sum(1) as BRANDCOUNT from DJ_BRAND zx
  1002. where extract(year from zx.BRANDTIME)=#{year}
  1003. and OPERATESTATE!='D'
  1004. group by zx.PARTYCODE
  1005. )d on zz.DZZDM=substr(d.dzzdm, 1, length(zz.DZZDM))
  1006. group by zz.DZZDM,zz.DZZMC
  1007. )brand on brand.DZZDM=z.DZZDM ---党内品牌统计
  1008. left join (
  1009. select zz.DZZDM,
  1010. zz.DZZMC,
  1011. ifnull(sum(ACTIVITYROOMCOUNT),0) as ACTIVITYROOMCOUNT
  1012. from ZZ_ZZQKXX zz
  1013. inner join (
  1014. select zx.PARTYCODE as dzzdm,sum(1) as ACTIVITYROOMCOUNT from DJ_PARTYACTIVITYROOM zx
  1015. where 1=1
  1016. and OPERATESTATE!='D'
  1017. group by zx.PARTYCODE
  1018. )d on zz.DZZDM=substr(d.dzzdm, 1, length(zz.DZZDM))
  1019. group by zz.DZZDM,zz.DZZMC
  1020. )room on room.DZZDM=z.DZZDM ---党员活动室统计
  1021. where 1=1 and fb.ZZLB not in(500) and z.DZZDM like '001091209%'
  1022. <if test="dzzdm!=null and dzzdm !=''">
  1023. and z.DZZDM like concat ('%',#{dzzdm},'%')
  1024. </if>
  1025. <if test="dzzmc!=null and dzzmc !=''">
  1026. and z.DZZMC like concat ( '%',#{dzzmc},'%')
  1027. </if>
  1028. order by SUBSTR(z.DZZDM,1,LENGTH(z.DZZDM)-3),z.DZZDM
  1029. </select>
  1030. <select id="selectPartyActivityMonthTotalList" resultType="java.util.HashMap">
  1031. select zz.month,zz.DZZDM,zz.DZZMC,result.RESULTCOUNT,brand.BRANDCOUNT
  1032. from
  1033. (
  1034. select t1.month,zz.DZZDM,zz.DZZMC,fb.ZZLB
  1035. from (select level month from dual connect by 0 + level <![CDATA[ <= ]]> 12) t1,ZZ_ZZQKXX zz
  1036. inner join ZZ_ZZQKXXFB fb on zz.DZZDM=fb.DZZDM
  1037. ) zz
  1038. left join (
  1039. select zz.MONTH,zz.DZZDM,zz.DZZMC,
  1040. ifnull(sum(result.count),0) as RESULTCOUNT
  1041. from (
  1042. select t1.month,zz.DZZDM,zz.DZZMC
  1043. from (select level month from dual connect by 0 + level <![CDATA[ <= ]]> 12) t1,ZZ_ZZQKXX zz
  1044. ) zz
  1045. inner join (
  1046. select result.PARTYCODE as dzzdm,extract(month from result.SCORETIME) as month,count(1) as count
  1047. from DJ_RESULTMG result
  1048. where extract(year from result.SCORETIME)=#{year} and result.OPERATESTATE != 'D'
  1049. group by result.PARTYCODE,extract(month from result.SCORETIME)
  1050. ) result on zz.DZZDM = substr(result.dzzdm, 1, length(zz.DZZDM)) and zz.month = result.month
  1051. where 1=1
  1052. <if test="dzzdm!=null and dzzdm !=''">
  1053. and zz.DZZDM like concat('%',#{dzzdm},'%')
  1054. </if>
  1055. <if test="dzzmc!=null and dzzmc !=''">
  1056. and zz.DZZMC like concat( '%',#{dzzmc},'%')
  1057. </if>
  1058. group by zz.DZZDM,zz.DZZMC,zz.MONTH
  1059. ) result on zz.DZZDM = result.DZZDM and zz.month = result.month
  1060. left join (
  1061. select zz.MONTH,zz.DZZDM,zz.DZZMC,
  1062. ifnull(sum(brand.count),0) as BRANDCOUNT
  1063. from (
  1064. select t1.month,zz.DZZDM,zz.DZZMC
  1065. from (select level month from dual connect by 0 + level <![CDATA[ <= ]]> 12) t1,ZZ_ZZQKXX zz
  1066. ) zz
  1067. inner join (
  1068. select brand.PARTYCODE as dzzdm,extract(month from brand.BRANDTIME) as month,count(1) as count
  1069. from DJ_BRAND brand
  1070. where extract(year from brand.BRANDTIME)=#{year} and brand.OPERATESTATE != 'D'
  1071. group by brand.PARTYCODE,extract(month from brand.BRANDTIME)
  1072. ) brand on zz.DZZDM = substr(brand.dzzdm, 1, length(zz.DZZDM)) and zz.month = brand.month
  1073. where 1=1
  1074. <if test="dzzdm!=null and dzzdm !=''">
  1075. and zz.DZZDM like concat('%',#{dzzdm},'%')
  1076. </if>
  1077. <if test="dzzmc!=null and dzzmc !=''">
  1078. and zz.DZZMC like concat('%',#{dzzmc},'%')
  1079. </if>
  1080. group by zz.DZZDM,zz.DZZMC,zz.MONTH
  1081. ) brand on zz.DZZDM = brand.DZZDM and zz.month = brand.month
  1082. where 1=1 and zz.ZZLB not in(500) and zz.DZZDM like '001091209%'
  1083. <if test="dzzdm!=null and dzzdm !=''">
  1084. and zz.DZZDM like concat('%',#{dzzdm},'%')
  1085. </if>
  1086. <if test="dzzmc!=null and dzzmc !=''">
  1087. and zz.DZZMC like concat( '%',#{dzzmc},'%')
  1088. </if>
  1089. order by zz.DZZDM,zz.MONTH
  1090. </select>
  1091. <!--中心组学习提醒-->
  1092. <select id="selectZxzxxWarnList" resultType="java.util.HashMap">
  1093. select z.DZZDM,
  1094. sum(ifnull(NUM_JZXX,0)) as NUM_JZXX,
  1095. sum(ifnull(NUM_ZTYT,0)) as NUM_ZTYT
  1096. from ZZ_ZZQKXX z
  1097. left join (
  1098. select f.DW_ID as dzzdm,
  1099. sum(case when f.STUDY_MODALITY_CODE='1' and date_format(f.STUDY_START_TIME, '%m') = #{month} then 1 else 0 end) as
  1100. NUM_JZXX, -- 集中学习
  1101. sum(case when f.STUDY_MODALITY_CODE='2' and date_format(f.STUDY_START_TIME, 'Q') = #{quarter} then 1 else 0 end) as
  1102. NUM_ZTYT -- 专题研讨
  1103. from ZZ_ZXZXX_FA f
  1104. where 1=1 and (f.DELETED=0 or f.deleted is null)
  1105. and Extract(year from f.STUDY_START_TIME)=#{year}
  1106. <if test="dzzdm!=null and dzzdm !=''">
  1107. and f.DW_ID = #{dzzdm}
  1108. </if>
  1109. group by f.DW_ID
  1110. ) f on z.DZZDM=f.DZZDM -- on z.DZZDM=substr(f.DZZDM, 0, length(z.DZZDM))
  1111. where 1=1
  1112. <if test="dzzdm!=null and dzzdm !=''">
  1113. and z.dzzdm = #{dzzdm}
  1114. </if>
  1115. group by z.DZZDM
  1116. </select>
  1117. </mapper>