PartyTwoCQuery.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  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.PartyTwoCQuery">
  4. <resultMap id="DjZtdrxxResultMap" type="com.ghsc.partybuild.vo.DjZtdrxxVo">
  5. <id column="ID" jdbcType="VARCHAR" property="id"/>
  6. <result column="DZZMC" jdbcType="VARCHAR" property="dzzmc"/>
  7. <result column="DZZDM" jdbcType="VARCHAR" property="dzzdm"/>
  8. <result column="TITLE" jdbcType="VARCHAR" property="title"/>
  9. <result column="ACTIVITYTIME" jdbcType="TIMESTAMP" property="activitytime"/>
  10. <result column="LOCATION" jdbcType="VARCHAR" property="location"/>
  11. <result column="SUBJECTTYPE" jdbcType="NUMERIC" property="subjecttype"/>
  12. <result column="CREATEUSERID" jdbcType="VARCHAR" property="createuserid"/>
  13. <result column="CREATEUSERNAME" jdbcType="VARCHAR" property="createusername"/>
  14. <result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime"/>
  15. <result column="UPDATEUSERID" jdbcType="VARCHAR" property="updateuserid"/>
  16. <result column="UPDATEUSERNAME" jdbcType="VARCHAR" property="updateusername"/>
  17. <result column="OPERATETIME" jdbcType="TIMESTAMP" property="operatetime"/>
  18. <result column="OPERATESTATE" jdbcType="VARCHAR" property="operatestate"/>
  19. <result column="SYNCSTATE" jdbcType="VARCHAR" property="syncstate"/>
  20. <result column="SUBJECTCONTENT" jdbcType="CLOB" property="subjectcontent"/>
  21. <result column="subjectTypeName" jdbcType="VARCHAR" property="subjecttypename"/>
  22. <result column="FILEID" jdbcType="VARCHAR" property="fileid"/>
  23. <result column="FILEURL" jdbcType="VARCHAR" property="fileurl"/>
  24. <result column="DWMC" jdbcType="VARCHAR" property="dwmc"/>
  25. </resultMap>
  26. <resultMap id="DjZzsrResultMap" type="com.ghsc.partybuild.vo.DjZzsrVo">
  27. <id column="ID" jdbcType="VARCHAR" property="id"/>
  28. <result column="DZZMC" jdbcType="VARCHAR" property="dzzmc"/>
  29. <result column="DZZDM" jdbcType="VARCHAR" property="dzzdm"/>
  30. <result column="TITLE" jdbcType="VARCHAR" property="title"/>
  31. <result column="ACTIVITYTIME" jdbcType="TIMESTAMP" property="activitytime"/>
  32. <result column="LOCATION" jdbcType="VARCHAR" property="location"/>
  33. <result column="SUBJECTTYPE" jdbcType="NUMERIC" property="subjecttype"/>
  34. <result column="CREATEUSERID" jdbcType="VARCHAR" property="createuserid"/>
  35. <result column="CREATEUSERNAME" jdbcType="VARCHAR" property="createusername"/>
  36. <result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime"/>
  37. <result column="UPDATEUSERID" jdbcType="VARCHAR" property="updateuserid"/>
  38. <result column="UPDATEUSERNAME" jdbcType="VARCHAR" property="updateusername"/>
  39. <result column="OPERATETIME" jdbcType="TIMESTAMP" property="operatetime"/>
  40. <result column="OPERATESTATE" jdbcType="VARCHAR" property="operatestate"/>
  41. <result column="SYNCSTATE" jdbcType="VARCHAR" property="syncstate"/>
  42. <result column="SUBJECTCONTENT" jdbcType="CLOB" property="subjectcontent"/>
  43. <result column="subjectTypeName" jdbcType="VARCHAR" property="subjecttypename"/>
  44. <result column="FILEID" jdbcType="VARCHAR" property="fileid"/>
  45. <result column="FILEURL" jdbcType="VARCHAR" property="fileurl"/>
  46. <result column="DWMC" jdbcType="VARCHAR" property="dwmc"/>
  47. </resultMap>
  48. <resultMap id="DjJlcfxxResultMap" type="com.ghsc.partybuild.vo.DjJlcfxxVo">
  49. <id column="ID" jdbcType="VARCHAR" property="id"/>
  50. <result column="DZZMC" jdbcType="VARCHAR" property="dzzmc"/>
  51. <result column="DZZDM" jdbcType="VARCHAR" property="dzzdm"/>
  52. <result column="USERID" jdbcType="VARCHAR" property="userid"/>
  53. <result column="USERNAME" jdbcType="VARCHAR" property="username"/>
  54. <result column="APPROVALDATE" jdbcType="TIMESTAMP" property="approvaldate"/>
  55. <result column="OFFENCE" jdbcType="VARCHAR" property="offence"/>
  56. <result column="PUNISHTYPE" jdbcType="NUMERIC" property="punishtype"/>
  57. <result column="SYMBOL" jdbcType="VARCHAR" property="symbol"/>
  58. <result column="UNIT" jdbcType="VARCHAR" property="unit"/>
  59. <result column="CREATEUSERID" jdbcType="VARCHAR" property="createuserid"/>
  60. <result column="CREATEUSERNAME" jdbcType="VARCHAR" property="createusername"/>
  61. <result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime"/>
  62. <result column="UPDATEUSERID" jdbcType="VARCHAR" property="updateuserid"/>
  63. <result column="UPDATEUSERNAME" jdbcType="VARCHAR" property="updateusername"/>
  64. <result column="OPERATETIME" jdbcType="TIMESTAMP" property="operatetime"/>
  65. <result column="OPERATESTATE" jdbcType="VARCHAR" property="operatestate"/>
  66. <result column="SYNCSTATE" jdbcType="VARCHAR" property="syncstate"/>
  67. <result column="DESCRIBE" jdbcType="CLOB" property="describe"/>
  68. <result column="punishTypeName" jdbcType="VARCHAR" property="punishtypename"/>
  69. <result column="YXKSRQ" jdbcType="TIMESTAMP" property="yxksrq"/>
  70. <result column="YXJSRQ" jdbcType="TIMESTAMP" property="yxjsrq"/>
  71. </resultMap>
  72. <select id="selectDnpxxxList" resultType="java.util.HashMap">
  73. select p.*,dc.DICVALUE as LevelName ,hndic.DICVALUE as honourTypeName, ry.USERNAME,ry.USERID from DJ_DNPXXX p
  74. left join CF_DICTIONARY dc on p.HONOURLEVEL=dc.DICKEY and dc.DICTYPEKEY='positionLevel'
  75. left join CF_DICTIONARY hndic on p.honourType=hndic.DICKEY and hndic.DICTYPEKEY='honourType'
  76. left join DJ_dnpxry ry on p.ID=ry.dnpxid
  77. where 1=1
  78. <if test="dzzdm!=null and dzzdm !=''">
  79. and p.dzzdm like concat('%',#{dzzdm},'%')
  80. </if>
  81. <if test="dzzmc!=null and dzzmc !=''">
  82. and p.DZZMC like concat('%',#{dzzmc},'%')
  83. </if>
  84. <if test="username!=null and username !=''">
  85. and ry.USERNAME like concat('%',#{username},'%')
  86. </if>
  87. <if test="userid!=null and userid !=''">
  88. and #{userid} in (select userid from DJ_dnpxry t where t.dnpxid=p.ID) and #{userid} = ry.userid
  89. </if>
  90. <if test="honourLevel != null">
  91. and p.honourLevel = #{honourLevel}
  92. </if>
  93. <if test="honourType != null">
  94. and p.honourType = #{honourType}
  95. </if>
  96. <if test="honourName!=null and honourName !=''">
  97. and p.honourName like concat('%',#{honourName},'%')
  98. </if>
  99. <if test="beginTime != null and beginTime != '' ">
  100. and p.honourTime <![CDATA[ >= ]]> date_format(#{beginTime},'%Y%m%d')
  101. </if>
  102. <if test="endTime != null and endTime != '' ">
  103. and p.honourTime <![CDATA[ < ]]> date_add(date_format(#{endTime},'%Y%m%d'),interval 1 day)
  104. </if>
  105. <if test="zzfbType != null">
  106. and SUBSTR(p.dzzdm,1,12) in(select dzzdm from ZZ_DZZFBQK where zzfb= #{zzfbType})
  107. </if>
  108. <if test="pxlx != null">
  109. and p.pxlx = #{pxlx}
  110. </if>
  111. <if test="ssdzzdm!=null and ssdzzdm !=''">
  112. and p.dzzdm =#{ssdzzdm}
  113. </if>
  114. order by p.HONOURTIME desc,ry.USERID desc
  115. </select>
  116. <select id="selectDnghbfList" resultType="java.util.HashMap">
  117. select p.*,dc.DICVALUE as careTypeName ,
  118. ghmx.CAREDATE,ghmx.ID as ghmxid,ghmx.HELPFORM,ghmx.HELPFORMTYPE,ghmx.AMOUNT,ghmx.CARECONTENT,dc2.DICVALUE as
  119. helpformTypeName,zz.DZZMC as SZDZZMC,
  120. (select count(1) from DJ_DNGHBFMX mx where mx.DNGHBFID=p.ID) as CARECOUNT
  121. from DJ_dnghbf p
  122. left join CF_DICTIONARY dc on p.careType=dc.DICKEY and dc.DICTYPEKEY='povertyType'
  123. left join DJ_DNGHBFMX ghmx on p.ID=ghmx.DNGHBFID
  124. left join VM_RYJBXX ry on p.USERID = ry.RYBM
  125. left join ZZ_ZZQKXX zz on ry.SZDZBDM=ZZ.DZZDM
  126. left join CF_DICTIONARY dc2 on ghmx.helpformType=dc2.DICKEY and dc2.DICTYPEKEY='helpformType'
  127. where 1=1
  128. <if test="dzzdm!=null and dzzdm !=''">
  129. and p.dzzdm like concat('%',#{dzzdm},'%')
  130. </if>
  131. <if test="dzzmc!=null and dzzmc !=''">
  132. and p.DZZMC like concat('%',#{dzzmc},'%')
  133. </if>
  134. <if test="username!=null and username !=''">
  135. and p.username like concat('%',#{username},'%')
  136. </if>
  137. <if test="userid!=null and userid !=''">
  138. and p.userid =#{userid}
  139. </if>
  140. <if test="careType != null">
  141. and p.careType = #{careType}
  142. </if>
  143. <if test="zzfbType != null">
  144. and SUBSTR(p.dzzdm,1,12) in(select dzzdm from ZZ_DZZFBQK where zzfb= #{zzfbType})
  145. </if>
  146. <if test="beginTime != null and beginTime != '' ">
  147. and ghmx.CAREDATE <![CDATA[ >= ]]> date_format(#{beginTime},'%Y%m%d')
  148. </if>
  149. <if test="endTime != null and endTime != '' ">
  150. and ghmx.CAREDATE <![CDATA[ < ]]> date_add(date_format(#{endTime},'%Y%m%d'),interval 1 day)
  151. </if>
  152. <if test="helpformType != null">
  153. and ghmx.helpformType = #{helpformType}
  154. </if>
  155. order by p.OperateTime desc
  156. </select>
  157. <select id="selectDnghbfDetailsList" resultType="java.util.HashMap">
  158. select mx.*, dc.DICVALUE as careTypeName,dc2.DICVALUE as helpformTypeName
  159. from DJ_DNGHBFMX mx
  160. inner join DJ_dnghbf p on mx.DNGHBFID=p.ID
  161. left join CF_DICTIONARY dc on p.careType=dc.DICKEY and dc.DICTYPEKEY='povertyType'
  162. left join CF_DICTIONARY dc2 on mx.helpformType=dc2.DICKEY and dc2.DICTYPEKEY='helpformType'
  163. where 1=1
  164. <if test="dnbfid!=null and dnbfid !=''">
  165. and p.id =#{dnbfid}
  166. </if>
  167. <if test="dzzdm!=null and dzzdm !=''">
  168. and p.dzzdm like concat('%',#{dzzdm},'%')
  169. </if>
  170. <if test="dzzmc!=null and dzzmc !=''">
  171. and p.DZZMC like concat('%',#{dzzmc},'%')
  172. </if>
  173. <if test="username!=null and username !=''">
  174. and p.username like concat('%',#{username},'%')
  175. </if>
  176. <if test="userid!=null and userid !=''">
  177. and p.userid =#{userid}
  178. </if>
  179. <if test="careType != null">
  180. and p.careType = #{careType}
  181. </if>
  182. <if test="zzfbType != null">
  183. and SUBSTR(p.dzzdm,1,12) in(select dzzdm from ZZ_DZZFBQK where zzfb= #{zzfbType})
  184. </if>
  185. order by mx.CAREDATE desc
  186. </select>
  187. <select id="getDnghbfDetails" resultType="java.util.HashMap">
  188. select p.DZZMC,p.USERNAME,p.USERID,mx.*, dc.DICVALUE as careTypeName,dc2.DICVALUE as helpformTypeName
  189. from DJ_DNGHBFMX mx
  190. inner join DJ_dnghbf p on mx.DNGHBFID=p.ID
  191. left join CF_DICTIONARY dc on p.careType=dc.DICKEY and dc.DICTYPEKEY='povertyType'
  192. left join CF_DICTIONARY dc2 on mx.helpformType=dc2.DICKEY and dc2.DICTYPEKEY='helpformType'
  193. where 1=1
  194. <if test="dnbfmxid!=null and dnbfmxid !=''">
  195. and mx.id =#{dnbfmxid}
  196. </if>
  197. order by mx.CAREDATE desc
  198. </select>
  199. <select id="selectZtdrxxList" resultMap="DjZtdrxxResultMap">
  200. select p.*,dc.DICVALUE as subjectTypeName,f.FILEID,f.FILEURL,
  201. (case when dw2.ZZLB =100 then dw2.DZZMC else dw.DZZMC end) DWMC
  202. from DJ_ztdrxx p
  203. left join CF_DICTIONARY dc on p.subjectType=dc.DICKEY and dc.DICTYPEKEY='subjectType'
  204. left join ( SELECT * FROM CF_FILE WHERE FILEID in (select min(FILEID) from CF_FILE GROUP BY FILEREFID)) f on
  205. f.FILEREFID = p.ID
  206. inner join ZZ_ZZQKXX dw on SUBSTR(p.DZZDM,1,12)=dw.DZZDM
  207. inner join (
  208. select zz2.DZZDM,zz2.DZZMC,fb2.ZZLB from ZZ_ZZQKXX zz2 inner join ZZ_ZZQKXXFB fb2 on zz2.DZZDM=fb2.DZZDM
  209. ) dw2 on SUBSTR(p.DZZDM,1,15)=dw2.DZZDM
  210. where 1=1
  211. <if test="dzzdm!=null and dzzdm !=''">
  212. and p.dzzdm like concat('',#{dzzdm},'%')
  213. </if>
  214. <if test="dzzmc!=null and dzzmc !=''">
  215. and p.DZZMC like concat('%',#{dzzmc},'%')
  216. </if>
  217. <if test="title!=null and title !=''">
  218. and p.title like concat('%',#{title},'%')
  219. </if>
  220. <if test="subjectType != null">
  221. and p.subjectType = #{subjectType}
  222. </if>
  223. <if test="location!=null and location !=''">
  224. and p.location like concat('%',#{location},'%')
  225. </if>
  226. <if test="beginTime != null and beginTime != '' ">
  227. and p.activityTime <![CDATA[ >= ]]> date_format(#{beginTime},'%Y%m%d')
  228. </if>
  229. <if test="endTime != null and endTime != '' ">
  230. and p.activityTime <![CDATA[ < ]]> date_add(date_format(#{endTime},'%Y%m%d'),interval 1 day)
  231. </if>
  232. <if test="zzfbType != null">
  233. and SUBSTR(p.dzzdm,1,12) in(select dzzdm from ZZ_DZZFBQK where zzfb= #{zzfbType})
  234. </if>
  235. order by p.activityTime desc
  236. </select>
  237. <select id="selectZzsrList" resultMap="DjZzsrResultMap">
  238. select p.*,dc.DICVALUE as subjectTypeName,f.FILEID,f.FILEURL,
  239. (case when dw2.ZZLB =100 then dw2.DZZMC else dw.DZZMC end) DWMC
  240. from DJ_zzsr p
  241. left join CF_DICTIONARY dc on p.subjectType=dc.DICKEY and dc.DICTYPEKEY='ZzsrType'
  242. left join ( SELECT * FROM CF_FILE WHERE FILEID in (select min(FILEID) from CF_FILE GROUP BY FILEREFID)) f on
  243. f.FILEREFID = p.ID
  244. inner join ZZ_ZZQKXX dw on SUBSTR(p.DZZDM,1,12)=dw.DZZDM
  245. inner join (
  246. select zz2.DZZDM,zz2.DZZMC,fb2.ZZLB from ZZ_ZZQKXX zz2 inner join ZZ_ZZQKXXFB fb2 on zz2.DZZDM=fb2.DZZDM
  247. ) dw2 on SUBSTR(p.DZZDM,1,15)=dw2.DZZDM
  248. where 1=1
  249. <if test="dzzdm!=null and dzzdm !=''">
  250. and p.dzzdm like concat('',#{dzzdm},'%')
  251. </if>
  252. <if test="dzzmc!=null and dzzmc !=''">
  253. and p.DZZMC like concat('%',#{dzzmc},'%')
  254. </if>
  255. <if test="title!=null and title !=''">
  256. and p.title like concat('%',#{title},'%')
  257. </if>
  258. <if test="subjectType != null">
  259. and p.subjectType = #{subjectType}
  260. </if>
  261. <if test="location!=null and location !=''">
  262. and p.location like concat('%',#{location},'%')
  263. </if>
  264. <if test="beginTime != null and beginTime != '' ">
  265. and p.activityTime <![CDATA[ >= ]]> date_format(#{beginTime},'%Y%m%d')
  266. </if>
  267. <if test="endTime != null and endTime != '' ">
  268. and p.activityTime <![CDATA[ < ]]> date_add(date_format(#{endTime},'%Y%m%d'),interval 1 day)
  269. </if>
  270. <if test="zzfbType != null">
  271. and SUBSTR(p.dzzdm,1,12) in(select dzzdm from ZZ_DZZFBQK where zzfb= #{zzfbType})
  272. </if>
  273. order by p.activityTime desc
  274. </select>
  275. <select id="selectDjkpxxList" resultType="java.util.HashMap">
  276. select p.*,dc.DICVALUE as judgeLevelName,dy.DICVALUE as yearName from DJ_djkpxx p
  277. inner join ZZ_ZZQKXX zz on p.DZZDM=zz.DZZDM
  278. left join ZZ_ZZQKXXFB cfb on zz.DZZDM=cfb.DZZDM
  279. left join CF_DICTIONARY dc on p.judgeLevel=dc.DICKEY and dc.DICTYPEKEY='judgeLevel'
  280. left join CF_DICTIONARY dy on p.YEAR=dc.DICKEY and dc.DICTYPEKEY='years'
  281. where 1=1
  282. <if test="dzzdm!=null and dzzdm !=''">
  283. and p.dzzdm like concat('',#{dzzdm},'%')
  284. </if>
  285. <if test="dzzmc!=null and dzzmc !=''">
  286. and p.DZZMC like concat('%',#{dzzmc},'%')
  287. </if>
  288. <if test="judgeLevel != null">
  289. and p.judgeLevel = #{judgeLevel}
  290. </if>
  291. <if test="year != null">
  292. and p.year = #{year}
  293. </if>
  294. <if test="zzfbType != null">
  295. and SUBSTR(p.dzzdm,1,12) in(select dzzdm from ZZ_DZZFBQK where zzfb= #{zzfbType})
  296. </if>
  297. <if test="ssdzzdm!=null and ssdzzdm !=''">
  298. and p.dzzdm =#{ssdzzdm}
  299. </if>
  300. <if test="showdw ==1">
  301. and cfb.zzlb in('100','200')
  302. </if>
  303. <if test="showdw ==2">
  304. and cfb.zzlb not in('100','200')
  305. </if>
  306. order by p.updateTime desc
  307. </select>
  308. <select id="selectParyDjkpList" resultType="java.util.HashMap">
  309. select
  310. p.DZZDM,p.DZZMC,kp.QUARTER1,kp.QUARTER2,kp.QUARTER3,kp.QUARTER4,kp.JUDGELEVEL,kp.id
  311. from ZZ_ZZQKXX p
  312. left join ZZ_ZZQKXXFB fb on p.DZZDM=fb.DZZDM
  313. left join DJ_DJKPXX kp on p.DZZDM=kp.DZZDM and kp.YEAR=#{year}
  314. where 1=1
  315. and p.DZZDM like concat('%',#{dzzdm},'%')
  316. <if test="showdxz!=null and showdxz == 0">
  317. and fb.ZZLB not in('500')
  318. </if>
  319. <if test="dzzmc!=null and dzzmc !=''">
  320. and p.DZZMC like concat('%',#{dzzmc},'%')
  321. </if>
  322. <if test="showdw!=null and showdw == 1">
  323. and fb.ZZLB in('100','200') -- 党委
  324. </if>
  325. <if test="showdzb!=null and showdzb == 1">
  326. and fb.ZZLB not in('100','200','500') -- 党支部
  327. </if>
  328. <if test="selectdzzdmList != null and selectdzzdmList.size()>0">
  329. and p.DZZDM in
  330. <foreach collection="selectdzzdmList" item="dm" index="index" open="(" close=")" separator=",">
  331. #{dm}
  332. </foreach>
  333. </if>
  334. order by p.DZZDM
  335. </select>
  336. <select id="selectJlcfxxList" resultMap="DjJlcfxxResultMap">
  337. select p.*,dc.DICVALUE as punishTypeName,oc.DICVALUE as OFFENCE from DJ_jlcfxx p
  338. left join CF_DICTIONARY dc on p.punishType=dc.DICKEY and dc.DICTYPEKEY='punishType'
  339. left join CF_DICTIONARY oc on p.offenceType=oc.DICKEY and oc.DICTYPEKEY='offenceType'
  340. where 1=1
  341. <if test="dzzdm!=null and dzzdm !=''">
  342. and p.dzzdm like concat('%',#{dzzdm},'%')
  343. </if>
  344. <if test="dzzmc!=null and dzzmc !=''">
  345. and p.DZZMC like concat('%',#{dzzmc},'%')
  346. </if>
  347. <if test="offenceType!=null and offenceType !=''">
  348. and p.offenceType = #{offenceType}
  349. </if>
  350. <if test="punishType != null">
  351. and p.punishType = #{punishType}
  352. </if>
  353. <if test="username!=null and username !=''">
  354. and p.username like concat('%',#{username},'%')
  355. </if>
  356. <if test="userid!=null and userid !=''">
  357. and p.userid =#{userid}
  358. </if>
  359. <if test="beginTime != null and beginTime != '' ">
  360. and p.approvalDate <![CDATA[ >= ]]> date_format(#{beginTime},'%Y%m%d')
  361. </if>
  362. <if test="endTime != null and endTime != '' ">
  363. and p.approvalDate <![CDATA[ < ]]> date_add(date_format(#{endTime},'%Y%m%d'),interval 1 day)
  364. </if>
  365. <if test="zzfbType != null">
  366. and SUBSTR(p.dzzdm,1,12) in(select dzzdm from ZZ_DZZFBQK where zzfb= #{zzfbType})
  367. </if>
  368. order by p.OPERATETIME desc
  369. </select>
  370. <select id="selectTask" resultType="java.util.HashMap">
  371. select tk.*,(select count(1) from DJ_taskUsers dtu where dtu.taskid=tk.id) USERNAME,
  372. (select count(1) from DJ_taskUsers us where us.taskid=tk.id and us.Isreceive=1
  373. <if test="taskuserid!=null and taskuserid !=''">
  374. and us.userid=#{taskuserid}
  375. </if>
  376. ) "isreceive"
  377. from DJ_task tk
  378. left join
  379. (select taskid, group_concat(USERNAME ORDER BY USERNAME,',') as USERNAME from DJ_taskUsers group by taskid) ry
  380. on tk.id=ry.taskid
  381. where 1=1
  382. <if test="username!=null and username !=''">
  383. and ry.username like concat('%',#{username},'%')
  384. </if>
  385. <if test="taskuserid!=null and taskuserid !=''">
  386. and #{taskuserid} in (select userid from DJ_taskUsers t where t.taskid=tk.ID)
  387. </if>
  388. <if test="userid!=null and userid !=''">
  389. and tk.CREATEUSERID= #{userid}
  390. </if>
  391. <if test="taskName!=null and taskName !=''">
  392. and tk.taskName like concat('%',#{taskName},'%')
  393. </if>
  394. <if test="beginTime != null and beginTime != '' ">
  395. and tk.endTime <![CDATA[ >= ]]> date_format(#{beginTime},'%Y%m%d')
  396. </if>
  397. <if test="endTime != null and endTime != '' ">
  398. and tk.endTime <![CDATA[ < ]]> date_add(date_format(#{endTime},'%Y%m%d'),interval 1 day)
  399. </if>
  400. <if test="day != null and day != '' ">
  401. and date_format(tk.endTime,'%Y-%m-%d') = #{day}
  402. </if>
  403. <if test="isreceive !=null ">
  404. and (select count(1) from DJ_taskUsers us where us.taskid=tk.id and ifnull( us.Isreceive,0)=#{isreceive}) and us.userid=#{taskuserid})=1
  405. </if>
  406. order by tk.endTime desc
  407. </select>
  408. <select id="selectPartyTotalInfo" resultType="java.util.HashMap">
  409. select zz.dzzdm,ifnull(dr.drNumber,0) drNumber,date_format(date_format(bz.GJJMRQ,'%Y%m%d'),'%Y"年"%m"月"%d"日"') GJJMRQ,ifnull(jc.jcNumber,0) jcNumber
  410. from ZZ_ZZQKXX zz
  411. left join (select dzzdm,count(1) drNumber from DJ_ztdrxx where date_format(ACTIVITYTIME,'%Y%m')=#{yearMonth} group by dzzdm) dr on zz.dzzdm = dr.dzzdm
  412. left join (select dzzdm,max(GJJMRQ) GJJMRQ from Zz_Bzjcxx group by DZZDM) bz on zz.dzzdm = bz.dzzdm
  413. left join (select #{dzzdm} DZZDM,count(1) jcNumber from Zz_Bzjcxx where DZZDM like concat('',#{dzzdm},'%') and GJJMRQ like concat('%',#{year},'%') and DZZDM !=#{dzzdm}) jc on zz.dzzdm = jc.dzzdm where zz.DZZDM=#{dzzdm}
  414. </select>
  415. <select id="selectfundsBudgetList" resultType="java.util.HashMap">
  416. select p.*,zz.DZZMC,(p.activityFunds+p.rewardFunds) BUDGETFUNDS ,preyear.BUDGETFUNDS ACTUALEXPEND,(p.year-1)
  417. pre,((p.activityFunds+p.rewardFunds)-preyear.BUDGETFUNDS)GRDATION from DJ_FundsBudget p
  418. inner join ZZ_ZZQKXX zz on p.partyCode=zz.DZZDM
  419. left join (select partycode,year, sum(activityFunds+rewardFunds) BUDGETFUNDS from DJ_FundsBudget group by
  420. partyCode,year) preyear on p.partyCode=preyear.partycode and p.year-1=preyear.year -- 上一年记录
  421. where 1=1
  422. <if test="dzzdm!=null and dzzdm !=''">
  423. and p.partyCode like concat('%',#{dzzdm},'%')
  424. </if>
  425. <if test="dzzmc!=null and dzzmc !=''">
  426. and zz.DZZMC like concat('%',#{dzzmc},'%')
  427. </if>
  428. <if test="year != null">
  429. and p.year = #{year}
  430. </if>
  431. order by p.updateTime desc
  432. </select>
  433. <select id="selectZtdrSummary" resultType="java.util.HashMap">
  434. select r.* ,dr.主题党日,#{year} YEAR from ZZ_ZZQKXX z
  435. inner join ZZ_ZZQKXXFB fb on z.DZZDM=fb.DZZDM
  436. left join (
  437. select zz.DZZDM PARTYCODE,
  438. zz.DZZMC,
  439. ifnull(sum(conut1),0) 党员大会,
  440. ifnull(sum(conut2),0) 支委会,
  441. ifnull(sum(conut3),0) 党小组会,
  442. ifnull(sum(conut4),0) 党课
  443. from ZZ_ZZQKXX zz
  444. left join (
  445. select dzzdm,
  446. sum(case when SHYKTYPE = 1 then 1 else 0 end) as conut1,
  447. sum(case when SHYKTYPE = 2 then 1 else 0 end) as conut2,
  448. sum(case when SHYKTYPE = 3 then 1 else 0 end) as conut3,
  449. sum(case when SHYKTYPE = 4 then 1 else 0 end) as conut4
  450. from (
  451. select m.PARTYCODE as dzzdm,
  452. m.SHYKTYPE
  453. from SHYK_MEETING m
  454. where extract(year from m.BEGINTIME)=#{year}
  455. and m.OPERATESTATE != 'D'
  456. ) t1
  457. group by dzzdm
  458. ) u on zz.DZZDM = substr(u.dzzdm, 1, length(zz.DZZDM))
  459. group by zz.DZZDM,zz.DZZMC
  460. ) r on r.PARTYCODE=z.DZZDM -- 三会一课统计信息
  461. left join (
  462. select zz.DZZDM PARTYCODE,
  463. zz.DZZMC,
  464. ifnull(sum(ztcount),0) as 主题党日
  465. from ZZ_ZZQKXX zz
  466. left join (
  467. select zx.DZZDM,sum(1) as ztcount from DJ_ZTDRXX zx
  468. where extract(year from zx.ACTIVITYTIME)=#{year}
  469. and OPERATESTATE!='D'
  470. group by zx.DZZDM
  471. )d on zz.DZZDM=substr(d.dzzdm, 1, length(zz.DZZDM))
  472. group by zz.DZZDM,zz.DZZMC
  473. )dr on dr.PARTYCODE=z.DZZDM -- 主题党日统计信息
  474. where 1=1 and fb.ZZLB not in(500) and z.DZZDM like '001091209%'
  475. <if test="partyCode!=null and partyCode !=''">
  476. and z.DZZDM like concat('%',#{partyCode},'%')
  477. </if>
  478. order by SUBSTR(z.DZZDM,1,LENGTH(z.DZZDM)-3),z.DZZDM
  479. </select>
  480. <select id="selectMzpyjgList" resultType="java.util.HashMap">
  481. select *
  482. from ZZZD_PYJG
  483. </select>
  484. <select id="selectMzpyxxList" resultType="java.util.HashMap">
  485. select zz.DZZMC,ry.XM, p.*,pyjg.HZMC as PYJGMC from ZZ_MZPYXX p
  486. inner join ZZ_ZZQKXX zz on p.SZDZBDM=ZZ.DZZDM
  487. inner join VM_RYJBXX ry on p.RYBM = ry.RYBM
  488. inner join ZZZD_PYJG pyjg on p.PYJG=pyjg.BM
  489. where 1=1
  490. <if test="rybm != null and rybm != ''">
  491. and p.rybm = #{rybm}
  492. </if>
  493. <if test="beginTime != null and beginTime != '' ">
  494. and p.kzpyrq <![CDATA[ >= ]]> #{beginTime}
  495. </if>
  496. <if test="endTime != null and endTime != '' ">
  497. and p.kzpyrq <![CDATA[ <= ]]> #{endTime}
  498. </if>
  499. <if test="username!=null and username !=''">
  500. and ry.xm like concat('%',#{username},'%')
  501. </if>
  502. <if test="dzzdm!=null and dzzdm !=''">
  503. and p.SZDZBDM like concat('%',#{dzzdm},'%')
  504. </if>
  505. <if test="pyjg != null and pyjg != ''">
  506. and p.pyjg = #{pyjg}
  507. </if>
  508. order by p.KZPYRQ desc
  509. </select>
  510. <select id="selectleaderUserList" resultType="java.util.HashMap">
  511. select rs.RYBM,rs.DZZMC,rs.XM
  512. from (
  513. select *
  514. from (
  515. select y.RYBM,u.XM,uz.DZZMC,y.ZLYTYPE
  516. from ZZ_DZZZLY y
  517. inner join VM_RYJBXX u on y.RYBM = u.RYBM
  518. inner join ZZ_ZZQKXX uz on u.SZDZBDM = uz.dzzdm
  519. union all
  520. select c.RYBM,
  521. u.XM,
  522. uz.DZZMC,
  523. 6 ZLYTYPE
  524. from ZZ_BZCYXX c
  525. inner join ZZ_ZZQKXX z on c.dzzdm = z.dzzdm
  526. inner join ZZ_ZZQKXXFB dzzfb on c.DZZDM = dzzfb.DZZDM and c.JC = dzzfb.LDJTJC
  527. left join Zzzd_zwmc zwmc on c.zwmc = zwmc.bm
  528. inner join VM_RYJBXX u on c.RYBM = u.RYBM
  529. inner join ZZ_ZZQKXX uz on u.SZDZBDM = uz.dzzdm
  530. where c.zwmc in ('H001', 'H040')
  531. ) p
  532. where 1=1
  533. <if test="usertype!=null and usertype !=''">
  534. and p.ZLYTYPE =#{usertype}
  535. </if>
  536. <if test="username != null and username != ''">
  537. and p.xm like concat('%',#{username},'%')
  538. </if>
  539. ) rs group by rs.RYBM,rs.DZZMC,rs.XM
  540. </select>
  541. <insert id="batchInsertDnghbf">
  542. insert into DJ_DNGHBF(ID, DZZMC, DZZDM,USERID,USERNAME, CREATEUSERID, CREATEUSERNAME, OPERATETIME, OPERATESTATE,
  543. SYNCSTATE)
  544. <foreach collection="dnghbfList" item="c" separator=" union all ">
  545. select
  546. #{c.id},#{c.dzzmc},#{c.dzzdm},#{c.userid},#{c.username},#{c.createuserid},#{c.createusername},#{c.operatetime},#{c.operatestate},#{c.syncstate}
  547. FROM DUAL
  548. </foreach>
  549. </insert>
  550. <insert id="batchInsertDnghbfmx">
  551. insert into DJ_DNGHBFMX(id, dnghbfid, caredate, carecontent, helpformtype, amount)
  552. <foreach collection="dnghbfmxList" item="c" separator=" union all ">
  553. select #{c.id},#{c.dnghbfid},#{c.caredate},#{c.carecontent},#{c.helpformtype},#{c.amount} FROM DUAL
  554. </foreach>
  555. </insert>
  556. </mapper>