SHYKCQuery.xml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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.SHYKCQuery">
  4. <select id="selectMeetingList" resultType="java.util.HashMap">
  5. SELECT m.MEETINGID,
  6. m.MEETINGNAME,
  7. m.SHYKTYPE,
  8. z.DZZMC as PARTYNAME,
  9. m.PARTYCODE,
  10. m.MEETINGADDRESS,
  11. m.CHAIRUSER,
  12. m.RECORDUSER,
  13. m.BEGINTIME,
  14. m.ENDTIME,
  15. m.ISTEMP,
  16. m.SHYKSTATUS,
  17. m.CREATETIME,
  18. m.CREATEUSERID,
  19. m.CREATEUSERNAME,
  20. m.UPDATETIME,
  21. m.UPDATEUSERID,
  22. m.UPDATEUSERNAME,
  23. m.MEETINGAPPROVESTATUS,
  24. m.MEETINGAPPROVEUSERNAME,
  25. m.DECISIONSTATUS,-- 决议填写状态 0保存中,1已提交
  26. m.ISUPLOADIMG, -- 是否上传会议图片 0未上传,1已上传
  27. m.MEETINGRECORDSTATE,-- 会议填写状态 0保存中,1已提交
  28. SUBSTR(m.PARTYCODE,1,12) as DWDZZDM,
  29. dw.DZZMC as DWMC
  30. , m.isFirstTopic
  31. , m.topicContent
  32. , st.shykTypes
  33. , st.shykTypeNames
  34. FROM SHYK_MEETING m
  35. inner join ZZ_ZZQKXX z on m.partycode=z.dzzdm
  36. inner join ZZ_ZZQKXX dw on SUBSTR(m.partycode,1,12)=dw.DZZDM
  37. left join (
  38. select t.meetingId
  39. , GROUP_CONCAT(shykType order by shykType SEPARATOR ', ') as shykTypes
  40. , GROUP_CONCAT(dic.DICVALUE order by shykType SEPARATOR ', ') as shykTypeNames
  41. from SHYK_Meeting_Type t
  42. inner join cf_dictionary dic on t.shykType = dic.DICKEY and dic.DICTYPEKEY = 'shykType'
  43. where 1=1
  44. <if test="shykType != null and shykType.size()>0">
  45. and shykType in
  46. <foreach collection="shykType" item="shyktype" index="index" open="(" close=")" separator=",">
  47. #{shyktype}
  48. </foreach>
  49. </if>
  50. group by meetingId
  51. ) st on m.meetingId = st.meetingId
  52. where 1=1 and m.OPERATESTATE in ('A','M')
  53. <if test="partyCode != null and partyCode != ''">
  54. and m.partyCode like concat('',#{partyCode},'%')
  55. </if>
  56. <if test="meetingName != null and meetingName != ''">
  57. and m.meetingName like concat('%',#{meetingName},'%')
  58. </if>
  59. <if test="meetingAddress != null and meetingAddress != ''">
  60. and m.meetingAddress like concat('%',#{meetingAddress},'%')
  61. </if>
  62. <if test="shykStatus != null">
  63. and m.shykStatus = #{shykStatus}
  64. </if>
  65. <if test="beginTime != null and beginTime != '' ">
  66. and m.beginTime <![CDATA[ >= ]]> date_format(#{beginTime},'%Y%m%d')
  67. </if>
  68. <if test="endTime != null and endTime != '' ">
  69. and m.beginTime <![CDATA[ < ]]> date_add(date_format(#{endTime},'%Y%m%d'),interval 1 day)
  70. </if>
  71. <if test="ssdzzdm != null and ssdzzdm != ''">
  72. and m.partyCode = #{ssdzzdm}
  73. </if>
  74. order by m.BEGINTIME desc
  75. </select>
  76. <select id="selectMeetingListAllCount" resultType="java.lang.Long">
  77. SELECT count(1)
  78. FROM SHYK_MEETING m
  79. inner join ZZ_ZZQKXX z on m.PARTYCODE=z.DZZDM
  80. where m.OPERATESTATE in ('A','M') and m.SHYKSTATUS <![CDATA[ <> ]]> 2
  81. <if test="partyCode != null and partyCode != ''">
  82. and m.PARTYCODE like concat('%',#{partyCode},'%')
  83. </if>
  84. <if test="meetingName != null and meetingName != ''">
  85. and m.MEETINGNAME like concat('%',#{meetingName},'%')
  86. </if>
  87. <if test="meetingAddress != null and meetingAddress != ''">
  88. and m.MEETINGADDRESS like concat('%',#{meetingAddress},'%')
  89. </if>
  90. <if test="shykStatus != null">
  91. and m.SHYKSTATUS = #{shykStatus}
  92. </if>
  93. <if test="beginTime != null and beginTime != '' ">
  94. and m.BEGINTIME <![CDATA[ >= ]]> date_format(#{beginTime},'%Y%m%d')
  95. </if>
  96. <if test="endTime != null and endTime != '' ">
  97. and m.BEGINTIME <![CDATA[ < ]]> date_add(date_format(#{endTime},'%Y%m%d'),interval 1 day)
  98. </if>
  99. <if test="day != null and day != '' ">
  100. </if>
  101. <if test="shykType != null and shykType.size()>0">
  102. and m.SHYKTYPE in
  103. <foreach collection="shykType" item="shyktype" index="index" open="(" close=")" separator=",">
  104. #{shyktype}
  105. </foreach>
  106. </if>
  107. <if test="ssdzzdm != null and ssdzzdm != ''">
  108. and m.PARTYCODE = #{ssdzzdm}
  109. </if>
  110. </select>
  111. <!--选择议题-->
  112. <select id="selectTopicModelListOfChoose" resultType="java.util.HashMap">
  113. select m.ID,m.MBMC,m.SHYKLX,m.CJRQ,m.SORT,t.MEETINGTOPICID from shyk_mb_ytmb m
  114. left join shyk_meetingtopic t on m.ID=t.MODELID and t.MEETINGID=#{meetingId} and t.OPERATESTATE <![CDATA[ <> ]]>
  115. 'D'
  116. where 1=1 and m.OPERATESTATE <![CDATA[ <> ]]> 'D'
  117. <if test="shykType != null">
  118. and m.SHYKLX = #{shykType}
  119. </if>
  120. order by m.SORT
  121. </select>
  122. <select id="selectMeetingUserList" resultType="java.util.HashMap">
  123. select mu.MEETINGUSERID, mu.MEETINGID,mu.USERNAME,mu.USERCODE, mu.PARTYNAME,mu.PARTYCODE,
  124. mu.SIGNINSTATUS,mu.SIGNINUSERCODE,mu.SIGNINUSERNAME,mu.SIGNINTIME,mu.CHECKINSTATUS,
  125. mu.CHECKINUSERCODE,mu.CHECKINUSERNAME, mu.CHECKINTIME,mu.USERREMARK,mu.APPROVESTATUS, mu.APPROVEOPINION,
  126. mu.APPROVEUSERCODE,mu.APPROVEUSERNAME,mu.MAKEUUPSTUDY,
  127. u.XM,u.SFZH,u.JG,p.DZZMC,xb.HZMC as XBMC,mu.USERCODE as RYBM,u.RYJBXXBS,u.SZDZBDM,
  128. (case when ue.MEETINGUSERID is not null then 1 else 0 end) as ISEVALUATE
  129. from SHYK_MeetingUser mu
  130. inner join VM_RYJBXX u on mu.USERCODE = u.RYBM
  131. inner join ZZ_ZZQKXX p on u.SZDZBDM=p.DZZDM
  132. left join zd_xbm xb on u.XB=xb.BM -- 性别
  133. left join SHYK_USEREVALUATE ue on mu.MEETINGUSERID=ue.MEETINGUSERID and ue.OPERATESTATE not in('D')
  134. where mu.MEETINGID=#{meetingId}
  135. and mu.OPERATESTATE <![CDATA[ <> ]]> 'D'
  136. order by mu.PARTYCODE,mu.USERCODE
  137. </select>
  138. <select id="selectMeetingDemocracyReviewList" resultType="com.ghsc.partybuild.vo.shyk.MeetingDemocracyReviewVo">
  139. select mdr.democracyreviewid ,mdr.meetingid,mdr.usercode,mdr.startdate,mdr.enddate,mdr.democracyreviewresulttype
  140. ,mdr.createtime,mdr.createuserid,mdr.updatetime,mdr.updateuserid
  141. ,p.dzzdm as partyCode,p.dzzmc as partyName,us.xm as userName
  142. ,dic.DICVALUE as democracyReviewResultTypeName
  143. from SHYK_Meeting_DemocracyReview mdr
  144. inner join vm_ryjbxx us on mdr.userCode = us.rybm
  145. inner join zz_zzqkxx p on us.SZDZBDM = p.dzzdm
  146. inner join cf_dictionary dic on dic.DICKEY = mdr.democracyreviewresulttype and dic.DICTYPEKEY='DemocracyReviewResultType'
  147. where mdr.meetingId = #{meetingId}
  148. order by p.dzzdm,CONVERT(us.XM USING gbk)
  149. </select>
  150. <select id="selectMeetingTypeList" resultType="com.ghsc.partybuild.vo.shyk.MeetingTypeVo">
  151. select mt.meetingid,mt.shyktype,dic.DICVALUE as shykTypeName
  152. from SHYK_Meeting_Type mt
  153. inner join cf_dictionary dic on dic.DICKEY = mt.shykType and dic.DICTYPEKEY='shykType'
  154. where mt.meetingId = #{meetingId}
  155. order by mt.shykType
  156. </select>
  157. <select id="selectMeetingTopicList" resultType="java.util.HashMap">
  158. select * from shyk_meetingtopic
  159. where MEETINGID=#{meetingId} and OPERATESTATE <![CDATA[ <> ]]> 'D'
  160. </select>
  161. <!--删除会议成员-->
  162. <update id="deteteMeetingUser" parameterType="java.lang.String">
  163. update SHYK_MeetingUser set OPERATESTATE='D',OPERATETIME=sysdate(),SYNCSTATE='N' where MEETINGID=#{meetingId}
  164. and OPERATESTATE <![CDATA[ <> ]]> 'D'
  165. </update>
  166. <!--删除会议民主评议成员-->
  167. <update id="deteteMeetingDemocracyreview" parameterType="java.lang.String">
  168. delete from shyk_meeting_democracyreview where MEETINGID=#{meetingId}
  169. </update>
  170. <!--删除会议民主评议成员-->
  171. <update id="deteteMeetingType" parameterType="java.lang.String">
  172. delete from shyk_meeting_type where MEETINGID=#{meetingId}
  173. </update>
  174. <!--删除会议议题-->
  175. <update id="deleteMeetingTopic" parameterType="java.lang.String">
  176. update shyk_meetingtopic set OPERATESTATE='D',OPERATETIME=sysdate(),SYNCSTATE='N' where MEETINGID=#{meetingId}
  177. and OPERATESTATE <![CDATA[ <> ]]> 'D'
  178. </update>
  179. <!--删除会议决议-->
  180. <update id="deleteMeetingDecision" parameterType="java.lang.String">
  181. update SHYK_MeetingDecision set OPERATESTATE='D',OPERATETIME=sysdate(),SYNCSTATE='N' where MEETINGID=#{meetingId}
  182. and OPERATESTATE <![CDATA[ <> ]]> 'D'
  183. </update>
  184. <!--删除会议-->
  185. <update id="deleteMeeting" parameterType="java.lang.String">
  186. update SHYK_Meeting set OPERATESTATE='D',OPERATETIME=sysdate(),SYNCSTATE='N' where MEETINGID=#{meetingId}
  187. </update>
  188. <!--会议历史地址-->
  189. <select id="selectHistoryAddressList" resultType="java.util.HashMap">
  190. select MEETINGADDRESS from (
  191. select MEETINGADDRESS,max(CREATETIME) CREATETIME from SHYK_MEETING m
  192. where 1=1
  193. and m.OPERATESTATE <![CDATA[ <> ]]> 'D'
  194. and m.CREATEUSERID=#{userId}
  195. group by MEETINGADDRESS
  196. ) meet order by CREATETIME desc
  197. </select>
  198. <!--统计三会一课-->
  199. <select id="selectMeetingTotalList" resultType="java.util.HashMap">
  200. select t1.*,0 as total from (
  201. select DZZDM,DZZMC,CHILDCOUNT,YY,QUARTER,SHYKTYPE,
  202. case SHYKTYPE when 1 then '党员大会'
  203. when 2 then '支委会'
  204. when 3 then '党小组会'
  205. when 4 then '党课'
  206. else '' end SHYKTYPENAME
  207. ,MONTH_FIRST,MONTH_SECOND,MONTH_THIRD from (
  208. select *
  209. ,SUM(IF (month_order='1',num,0)) 'month_first',
  210. SUM(IF (month_order='2',num,0)) 'month_second',
  211. SUM(IF (month_order='3',num,0)) 'month_third' from(
  212. select t1.DZZDM,t1.DZZMC,t1.CHILDCOUNT,t1.YY,t1.QUARTER,t1.SHYKTYPE,t1.MONTH_ORDER,ifnull(t2.NUM,0) as NUM
  213. from (
  214. -- 组织、年度、季度、会议类型、季度第几月
  215. select * from(
  216. select dzzdm,dzzmc,CHILDCOUNT,yy,quarter,shyktype,dmq1.month_order from (
  217. select z.dzzdm,z.dzzmc, 0 as CHILDCOUNT,#{year} as yy,#{quarter} as quarter,dq1.shyktype
  218. from ZZ_ZZQKXX z
  219. cross join (select dq.DICKEY as shyktype from cf_dictionary dq where dq.DICTYPEKEY='quarterType') dq1
  220. ) t1 cross join (select dmq.DICKEY as month_order from cf_dictionary dmq where dmq.DICTYPEKEY=
  221. 'monthQuarterType') dmq1
  222. ) z
  223. where 1=1
  224. <if test="dzzdm!=null and dzzdm !=''">
  225. and dzzdm like concat('',#{dzzdm},'%')
  226. </if>
  227. <if test="zzfbType != null">
  228. and SUBSTR(dzzdm,1,12) in(select dzzdm from ZZ_DZZFBQK where zzfb= #{zzfbType})
  229. </if>
  230. <if test="ssdzzdm!=null and ssdzzdm !=''">
  231. and dzzdm = #{ssdzzdm}
  232. </if>
  233. ) t1
  234. left join (
  235. -- 统计三会一课
  236. select z.dzzdm,m.yy,m.quarter,m.shyktype,m.month_order,count(m.partyCode) num
  237. from ZZ_ZZQKXX z
  238. inner join (select date_format(begintime,'%Y') as yy,QUARTER(begintime) as quarter,date_format(begintime,'%m') as
  239. mon,
  240. date_format(begintime,'%m')-(QUARTER(begintime)-1)*3 month_order, partycode, shyktype from SHYK_MEETING
  241. where 1=1 and OPERATESTATE <![CDATA[ <> ]]> 'D' and SHYKSTATUS not in (2) -- 排除已取消
  242. ) m on (z.dzzdm = m.partyCode or z.dzzdm = substr(m.partyCode, 1, length(z.dzzdm)))
  243. where 1=1
  244. <if test="dzzdm!=null and dzzdm !=''">
  245. and z.dzzdm like concat('',#{dzzdm},'%')
  246. </if>
  247. <if test="zzfbType != null">
  248. and SUBSTR(z.dzzdm,1,12) in(select dzzdm from ZZ_DZZFBQK where zzfb= #{zzfbType})
  249. </if>
  250. <if test="ssdzzdm!=null and ssdzzdm !=''">
  251. and z.dzzdm = #{ssdzzdm}
  252. </if>
  253. group by z.dzzdm,m.yy,m.quarter,m.month_order,m.shyktype
  254. order by z.dzzdm,m.yy,m.quarter,m.month_order,m.shyktype
  255. ) t2 on t1.dzzdm=t2.dzzdm and t1.yy=t2.yy and t1.quarter=t2.quarter and t1.month_order=t2.month_order and
  256. t1.shyktype=t2.shyktype
  257. where 1=1
  258. <if test="dzzdm!=null and dzzdm !=''">
  259. and t1.dzzdm like concat('',#{dzzdm},'%')
  260. </if>
  261. <if test="zzfbType != null">
  262. and SUBSTR(t1.dzzdm,1,12) in(select dzzdm from ZZ_DZZFBQK where zzfb= #{zzfbType})
  263. </if>
  264. <if test="ssdzzdm!=null and ssdzzdm !=''">
  265. and t1.dzzdm = #{ssdzzdm}
  266. </if>
  267. ) t1
  268. order by dzzdm,yy,quarter,shyktype,month_order
  269. ) t1
  270. -- piv ot (max(num) for month_order in ('1' as month_first,'2' AS month_second,'3' AS month_third ))
  271. order by dzzdm,yy,quarter,shyktype
  272. ) t1
  273. where 1=1
  274. <if test="dzzdm!=null and dzzdm !=''">
  275. and (dzzdm=#{dzzdm} or length(dzzdm)=(length(#{dzzdm})+3))
  276. </if>
  277. <if test="ssdzzdm!=null and ssdzzdm !=''">
  278. and dzzdm = #{ssdzzdm}
  279. </if>
  280. order by dzzdm,yy,quarter,shyktype
  281. </select>
  282. <select id="selectMeetingTotalNew" resultType="java.util.HashMap">
  283. select #{dzzdm} as DZZDM,#{year} as YY,#{quarter} as QUARTER,SHYKTYPE,
  284. sum(case
  285. when BEGINTIME >= date_format(#{month1_bt},'%Y-%m-%d') and BEGINTIME <![CDATA[ < ]]> date_format(#{month1_et},'%Y-%m-%d')
  286. then 1
  287. else 0 end) as MONTH1,
  288. sum(case
  289. when BEGINTIME >= date_format(#{month2_bt},'%Y-%m-%d') and BEGINTIME <![CDATA[ < ]]> date_format(#{month2_bt},'%Y-%m-%d')
  290. then 1
  291. else 0 end) as MONTH2,
  292. sum(case
  293. when BEGINTIME >= date_format(#{month3_bt},'%Y-%m-%d') and BEGINTIME <![CDATA[ < ]]> date_format(#{month3_bt},'%Y-%m-%d')
  294. then 1
  295. else 0 end) as MONTH3,
  296. count(1) as YEARCOUNT,
  297. sum(case when QUARTER(BEGINTIME)=1 then 1 else 0 end) as QUARTERCOUNT1,
  298. sum(case when QUARTER(BEGINTIME)=2 then 1 else 0 end) as QUARTERCOUNT2,
  299. sum(case when QUARTER(BEGINTIME)=3 then 1 else 0 end) as QUARTERCOUNT3,
  300. sum(case when QUARTER(BEGINTIME)=4 then 1 else 0 end) as QUARTERCOUNT4
  301. from SHYK_MEETING
  302. where 1=1 and OPERATESTATE not in('D') and SHYKSTATUS not in (2) -- 排除已取消
  303. and PARTYCODE =#{dzzdm}
  304. and Extract(year from BEGINTIME)=#{year}
  305. group by #{dzzdm},SHYKTYPE
  306. order by SHYKTYPE
  307. </select>
  308. <select id="selectPartyPlanList" resultType="java.util.HashMap">
  309. select
  310. p.DZZDM,p.DZZMC,p.ZZLB,
  311. SUBSTR(p.DZZDM,1,LENGTH(p.DZZDM)-3) PARENTCODE ,-- 父级组织代码,
  312. plan.PLANID PLANID,
  313. dcUser.DICVALUE PLANTYPE_USERNAME,
  314. dcBranch.DICVALUE PLANTYPE_BRANCHNAME,
  315. dcGroup.DICVALUE PLANTYPE_GROUPNAME,
  316. dcClass.DICVALUE PLANTYPE_CLASSNAME,
  317. p.DZZDM PARTYCODE,
  318. p.DZZMC PARTYNAME,
  319. plan.PLANTYPE_USER PLANTYPEUSER,
  320. plan.PLANTYPE_BRANCH PLANTYPEBRANCH,
  321. plan.PLANTYPE_GROUP PLANTYPEGROUP,
  322. plan.PLANTYPE_CLASS PLANTYPECLASS
  323. from ZZ_ZZQKXX p
  324. left join ZZ_DZZFBQK fbType on p.DZZDM = fbType.DZZDM
  325. left join SHYK_PARTYPLAN plan on p.DZZDM=plan.PARTYCODE
  326. left join CF_DICTIONARY dcUser on plan.PLANTYPE_USER=dcUser.DICKEY and dcUser.DICTYPEKEY='SHYK_PartyPlan' -- 党员大会
  327. left join CF_DICTIONARY dcBranch on plan.PLANTYPE_BRANCH=dcBranch.DICKEY and
  328. dcBranch.DICTYPEKEY='SHYK_PartyPlan' -- 支委会
  329. left join CF_DICTIONARY dcGroup on plan.PLANTYPE_GROUP=dcGroup.DICKEY and dcGroup.DICTYPEKEY='SHYK_PartyPlan'
  330. -- 党小组会
  331. left join CF_DICTIONARY dcClass on plan.PLANTYPE_CLASS=dcClass.DICKEY and dcClass.DICTYPEKEY='SHYK_PartyPlan'
  332. -- 党课
  333. where 1=1
  334. <if test="dzzdm!=null and dzzdm !=''">
  335. and p.DZZDM like concat('%',#{dzzdm},'%') and length(p.DZZDM)=(length(#{dzzdm})+3)
  336. </if>
  337. <if test="zzfbType != null">
  338. and SUBSTR(p.dzzdm,1,12) in(select DZZDM from ZZ_DZZFBQK where ZZFB= #{zzfbType})
  339. </if>
  340. order by fbType.SORT
  341. </select>
  342. <select id="selectPlanList" resultType="java.util.HashMap">
  343. select PARTYCODE,PARTYNAME,PLANTYPE_USER,PLANTYPE_BRANCH,PLANTYPE_GROUP,PLANTYPE_CLASS from SHYK_PartyPlan p
  344. where OPERATESTATE not in('D')
  345. <if test="dzzdm!=null and dzzdm !=''">
  346. and p.PARTYCODE like concat('',#{dzzdm},'%')
  347. </if>
  348. <if test="ssdzzdm!=null and ssdzzdm !=''">
  349. and p.PARTYCODE=#{ssdzzdm}
  350. </if>
  351. </select>
  352. <select id="selectMyMeetingList" resultType="java.util.HashMap">
  353. select
  354. m.MEETINGID,
  355. m.MEETINGNAME,
  356. m.SHYKTYPE,
  357. z.DZZMC as PARTYNAME,
  358. m.PARTYCODE,
  359. m.MEETINGADDRESS,
  360. m.CHAIRUSER,
  361. m.RECORDUSER,
  362. m.BEGINTIME,
  363. m.ENDTIME,
  364. m.ISTEMP,
  365. m.SHYKSTATUS,
  366. m.CREATETIME,
  367. m.CREATEUSERID,
  368. m.CREATEUSERNAME,
  369. m.UPDATETIME,
  370. m.UPDATEUSERID,
  371. m.UPDATEUSERNAME,
  372. m.MEETINGAPPROVESTATUS,
  373. m.MEETINGAPPROVEUSERNAME,
  374. us.MEETINGUSERID,
  375. ue.TEACHNAME,
  376. (case when sysdate()>m.ENDTIME then 1 else 0 end) as ISEND,
  377. topic.TOPICNAME,
  378. (case when ue.MEETINGUSERID is not null then 1 else 0 end) as ISEVALUATE
  379. from SHYK_MEETING m
  380. inner join SHYK_MEETINGUSER us on m.MEETINGID=us.MEETINGID
  381. inner join ZZ_ZZQKXX z on m.PARTYCODE=z.DZZDM
  382. left join SHYK_USEREVALUATE ue on us.MEETINGUSERID=ue.MEETINGUSERID and ue.OPERATESTATE not in('D')
  383. left join SHYK_MEETINGTOPIC topic on topic.MEETINGID=m.MEETINGID and topic.OPERATESTATE not in('D') and topic.MODELID is null
  384. where 1=1 and m.OPERATESTATE <![CDATA[ <> ]]> 'D' and us.USERCODE=#{userCode}
  385. and us.OPERATESTATE <![CDATA[ <> ]]> 'D'
  386. <if test="beginTime != null and beginTime != '' ">
  387. and m.BEGINTIME <![CDATA[ >= ]]> date_format(#{beginTime},'%Y%m%d')
  388. </if>
  389. <if test="endTime != null and endTime != '' ">
  390. and m.BEGINTIME <![CDATA[ < ]]> date_add(date_format(#{endTime},'%Y%m%d'),interval 1 day)
  391. </if>
  392. <if test="day != null and day != '' ">
  393. and date_format(m.BEGINTIME,'%Y-%m-%d') = #{day}
  394. </if>
  395. <if test="isEvaluate != null">
  396. <if test="isEvaluate==1">
  397. and ue.MEETINGUSERID is not null
  398. </if>
  399. <if test="isEvaluate==0">
  400. and ue.MEETINGUSERID is null
  401. </if>
  402. </if>
  403. <if test="shykType != null">
  404. and m.SHYKTYPE=#{shykType}
  405. </if>
  406. <if test="meetingName != null and meetingName != ''">
  407. and topic.TOPICNAME like concat('%',#{meetingName},'%')
  408. </if>
  409. <if test="meetingAddress != null and meetingAddress != ''">
  410. and m.MEETINGADDRESS like concat('%',#{meetingAddress},'%')
  411. </if>
  412. <if test="partyCode!=null and partyCode !=''">
  413. and m.PARTYCODE like concat('',#{partyCode},'%')
  414. </if>
  415. order by BEGINTIME desc
  416. </select>
  417. <resultMap type="java.util.HashMap" id="meetingEvaluateProjectMap">
  418. <result column="SHYKEVALUATETYPE" jdbcType="NUMERIC" property="SHYKEVALUATETYPE"/>
  419. <result column="PROJECTNAME" jdbcType="VARCHAR" property="PROJECTNAME"/>
  420. <result column="PROJECTID" jdbcType="VARCHAR" property="PROJECTID"/>
  421. <result column="USEREVALUATEID" jdbcType="VARCHAR" property="USEREVALUATEID"/>
  422. <result column="SHYKEVALUATERESULTTYPE" jdbcType="NUMERIC" property="SHYKEVALUATERESULTTYPE"/>
  423. <result column="SHYKEVALUATERESULTTYPENAME" jdbcType="VARCHAR" property="SHYKEVALUATERESULTTYPENAME"/>
  424. <result column="RECOMMEND" jdbcType="CLOB" property="RECOMMEND" javaType="String"/>
  425. </resultMap>
  426. <select id="selectMeetingEvaluateProjectList" resultMap="meetingEvaluateProjectMap">
  427. select dic.DICKEY as SHYKEVALUATETYPE,dic.DICVALUE as PROJECTNAME,ue.PROJECTID,ue.USEREVALUATEID,ue.SHYKEVALUATERESULTTYPE,ue.SHYKEVALUATERESULTTYPENAME,ue.RECOMMEND
  428. from (select * from CF_DICTIONARY where DICTYPEKEY='shykEvaluateType') dic
  429. left join (
  430. select p.SHYKEVALUATETYPE,p.PROJECTID,p.USEREVALUATEID,p.SHYKEVALUATERESULTTYPE,dicResult.DICVALUE as SHYKEVALUATERESULTTYPENAME,p.RECOMMEND
  431. from SHYK_USEREVALUATE ue
  432. inner join SHYK_USEREVALUATEPROJECT p on p.USEREVALUATEID=ue.USEREVALUATEID
  433. inner join CF_DICTIONARY dicResult on p.SHYKEVALUATERESULTTYPE=dicResult.DICKEY and dicResult.DICTYPEKEY='shykEvaluateResultType'
  434. where ue.OPERATESTATE not in('D') and p.OPERATESTATE not in('D')
  435. and ue.MEETINGUSERID=#{meetingUserId}
  436. ) ue on dic.DICKEY=ue.SHYKEVALUATETYPE
  437. where 1=1
  438. order by dic.DICKEY
  439. </select>
  440. <!--删除评分项-->
  441. <update id="deleteMeetingEvaluateProject" parameterType="java.lang.String">
  442. update SHYK_USEREVALUATEPROJECT set OPERATESTATE='D',OPERATETIME=sysdate(),SYNCSTATE='N' where USEREVALUATEID=#{userevaluateId}
  443. and OPERATESTATE <![CDATA[ <> ]]> 'D'
  444. </update>
  445. <select id="selectMeetingListByApp" resultType="java.util.HashMap">
  446. SELECT MEETINGID,
  447. MEETINGNAME,
  448. SHYKTYPE,
  449. z.DZZMC as PARTYNAME ,
  450. PARTYCODE,
  451. MEETINGADDRESS,
  452. CHAIRUSER,
  453. RECORDUSER,
  454. BEGINTIME,
  455. ENDTIME,
  456. ISTEMP,
  457. SHYKSTATUS,
  458. CREATETIME,
  459. CREATEUSERID,
  460. CREATEUSERNAME,
  461. UPDATETIME,
  462. UPDATEUSERID,
  463. UPDATEUSERNAME,
  464. MEETINGAPPROVESTATUS,
  465. MEETINGAPPROVEUSERNAME,
  466. (case when dw2.ZZLB =100 then dw2.DZZMC else dw.DZZMC end) DWMC,
  467. DECISIONSTATUS,-- 决议填写状态 0保存中,1已提交
  468. ISUPLOADIMG, -- 是否上传会议图片 0未上传,1已上传
  469. MEETINGRECORDSTATE,-- 会议填写状态 0保存中,1已提交
  470. ROUND((ENDTIME - BEGINTIME) * 24,2) as MEETINGTIME, -- 会议时长(小时)
  471. (case
  472. when BEGINTIME <![CDATA[ > ]]> sysdate() then 1 else 2 end ) as STATUS, -- 1会议未开始,2会议已开始
  473. (sysdate()-ENDTIME) as endLongTime -- 会议结束时长
  474. FROM SHYK_MEETING m
  475. inner join ZZ_ZZQKXX z on m.PARTYCODE=z.DZZDM
  476. inner join ZZ_ZZQKXX dw on SUBSTR(m.PARTYCODE,1,12)=dw.DZZDM
  477. inner join (
  478. select zz2.DZZDM,zz2.DZZMC,fb2.ZZLB from ZZ_ZZQKXX zz2 inner join ZZ_ZZQKXXFB fb2 on zz2.DZZDM=fb2.DZZDM
  479. ) dw2 on SUBSTR(m.PARTYCODE,1,15)=dw2.DZZDM
  480. where 1=1 and m.OPERATESTATE <![CDATA[ <> ]]> 'D' and m.SHYKSTATUS <![CDATA[ <> ]]> 2
  481. <if test="type != null">
  482. <if test="type==1">-- 未开始
  483. and m.BEGINTIME <![CDATA[ >= ]]> sysdate()
  484. and m.SHYKSTATUS not in (2) -- 排除已取消
  485. </if>
  486. <if test="type==2">-- 已结束
  487. and m.ENDTIME <![CDATA[ < ]]> sysdate()
  488. and m.SHYKSTATUS not in (2) -- 排除已取消
  489. </if>
  490. </if>
  491. <if test="dzzdm !=null and dzzdm !=''">
  492. and m.PARTYCODE like concat('%',#{dzzdm},'%')
  493. </if>
  494. <if test="shykTypeList != null and shykTypeList.size()>0">
  495. and m.SHYKTYPE in
  496. <foreach collection="shykTypeList" item="shyktype" index="index" open="(" close=")" separator=",">
  497. #{shyktype}
  498. </foreach>
  499. </if>
  500. <if test="title != null and title != ''">
  501. and m.MEETINGNAME like concat('%',#{title},'%')
  502. </if>
  503. <if test="startDate != null and startDate != '' ">
  504. and m.BEGINTIME <![CDATA[ >= ]]> date_format(#{startDate},'%Y%m%d')
  505. </if>
  506. <if test="endDate != null and endDate != '' ">
  507. and m.BEGINTIME <![CDATA[ < ]]> date_add(date_format(#{endDate},'%Y%m%d'),interval 1 day)
  508. </if>
  509. order by BEGINTIME desc
  510. </select>
  511. <select id="selectMeetingPlanTotalList" resultType="java.util.HashMap">
  512. select ztp.SHYKTYPE,
  513. (case ztp.SHYKTYPE
  514. when 1 then '党员大会'
  515. when 2 then '支委会'
  516. when 3 then '党小组会'
  517. when 4 then '党课'
  518. else '' end) as shykTypeName,
  519. ztp.DZZDM, ztp.DZZMC, ztp.planType,
  520. (case ztp.PLANTYPE when 1 then '每月一次'
  521. when 2 then '每季度一次'
  522. when 3 then '每半年一次'
  523. when 4 then '每年一次'
  524. else '' end) as planTypeName,
  525. sum(
  526. case when m.MEETINGID is not null and ztp.PLANTYPE = 1 and date_format(m.BEGINTIME,'%Y') = #{year} and date_format(m.BEGINTIME,'%m') = #{month} then 1 -- 每月一次
  527. when m.MEETINGID is not null and ztp.PLANTYPE = 2 and date_format(m.BEGINTIME,'%Y') = #{year} and QUARTER(m.BEGINTIME) = #{quarter} then 1 -- 每季度一次
  528. when m.MEETINGID is not null and ztp.PLANTYPE = 3 and date_format(m.BEGINTIME,'%Y') = #{year} and #{quarter} in(1,2) and QUARTER(m.BEGINTIME) in (1,2) then 1 -- 每半年一次
  529. when m.MEETINGID is not null and ztp.PLANTYPE = 3 and date_format(m.BEGINTIME,'%Y') = #{year} and #{quarter} in(3,4) and QUARTER(m.BEGINTIME) in (3,4) then 1 -- 每半年一次
  530. when m.MEETINGID is not null and ztp.PLANTYPE = 4 and date_format(m.BEGINTIME,'%Y') = #{year} then 1
  531. else 0 end -- 每年一次
  532. ) as planCount
  533. from (
  534. select t1.SHYKTYPE,
  535. z.DZZDM,
  536. z.DZZMC,
  537. (case t1.SHYKTYPE
  538. when 1 then pn.PLANTYPE_USER
  539. when 2 then pn.PLANTYPE_BRANCH
  540. when 3 then pn.PLANTYPE_GROUP
  541. when 4 then pn.PLANTYPE_CLASS
  542. else 99 end) as planType
  543. from (select level SHYKTYPE from dual connect by 0 + level <![CDATA[ <= 4 ]]>) t1,
  544. ZZ_ZZQKXX z
  545. inner join SHYK_PARTYPLAN pn on pn.PARTYCODE = z.DZZDM
  546. ) ztp
  547. left join SHYK_MEETING m on ztp.DZZDM = m.PARTYCODE and ztp.SHYKTYPE = m.SHYKTYPE and m.OPERATESTATE not in('D') and m.SHYKSTATUS not in (2) -- 排除已取消
  548. where 1=1
  549. <if test="dzzdm !=null and dzzdm !=''">
  550. and ztp.DZZDM=#{dzzdm}
  551. </if>
  552. <if test="dzzdmSearch !=null and dzzdmSearch !=''">
  553. and ztp.DZZDM like concat('%',#{dzzdmSearch},'%')
  554. </if>
  555. group by ztp.SHYKTYPE, ztp.DZZDM, ztp.DZZMC, ztp.PLANTYPE
  556. </select>
  557. <select id="selectMyMeetingListForApp" resultType="java.util.HashMap">
  558. SELECT m.MEETINGID,
  559. m.MEETINGNAME,
  560. m.SHYKTYPE,
  561. z.DZZMC as PARTYNAME ,
  562. m.PARTYCODE,
  563. m.MEETINGADDRESS,
  564. m.CHAIRUSER,
  565. m.RECORDUSER,
  566. m.BEGINTIME,
  567. m.ENDTIME,
  568. m.ISTEMP,
  569. m.SHYKSTATUS,
  570. m.CREATETIME,
  571. m.CREATEUSERID,
  572. m.CREATEUSERNAME,
  573. m.UPDATETIME,
  574. m.UPDATEUSERID,
  575. m.UPDATEUSERNAME,
  576. m.MEETINGAPPROVESTATUS,
  577. m.MEETINGAPPROVEUSERNAME,
  578. dw.DZZMC as DWMC,
  579. m.DECISIONSTATUS,-- 决议填写状态 0保存中,1已提交
  580. ISUPLOADIMG, -- 是否上传会议图片 0未上传,1已上传
  581. MEETINGRECORDSTATE,-- 会议填写状态 0保存中,1已提交
  582. ROUND((ENDTIME - BEGINTIME) * 24,2) as MEETINGTIME, -- 会议时长(小时)
  583. (case
  584. when BEGINTIME > sysdate() then 1 else 2 end ) as STATUS, -- 1会议未开始,2会议已开始
  585. (sysdate()-ENDTIME) as endLongTime -- 会议结束时长
  586. FROM SHYK_MEETING m
  587. inner join ZZ_ZZQKXX z on m.PARTYCODE=z.DZZDM
  588. inner join ZZ_ZZQKXX dw on SUBSTR(m.PARTYCODE,1,12)=dw.DZZDM
  589. inner join SHYK_MEETINGUSER us on m.MEETINGID = us.MEETINGID
  590. where 1=1 and m.OPERATESTATE <![CDATA[ <> ]]> 'D' and m.SHYKSTATUS <![CDATA[ <> ]]> 2
  591. and us.OPERATESTATE <![CDATA[ <> ]]> 'D'
  592. and us.USERCODE = #{userId}
  593. order by BEGINTIME desc
  594. </select>
  595. </mapper>