ReportMapper.xml 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262
  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.tofly.workflow.report.mapper.ReportMapper">
  4. <select id="settlementCount" resultType="com.tofly.workflow.report.vo.SettlementVo">
  5. select
  6. (select type_name from TF_BASE_TYPE_P where id = b.process_type) process_type_name,
  7. b.project_name,
  8. b.REGION_NAME || ' ' || ADDRE address,
  9. b.user_phone,
  10. (select name from SYS_DICT where id = user_type) PROJECT_NATURE,
  11. b.household_number,
  12. re.PAYMENT_DATE ,
  13. re.amount,
  14. (select name from sys_dict where id =re.charge_mode) charge_mode,
  15. (select REAL_NAME from sys_user where id =b.duty_user) duty_user ,
  16. (select REAL_NAME from sys_user where id =node.handle_user) hand_User ,
  17. (select name from sys_tenant where id =(select tenant_id from sys_user where id =node.handle_user))
  18. handle_tenant,
  19. re.remark
  20. from TF_PROJECT_BASE_W b
  21. left join tf_process_l c on b.process_id = c.id
  22. left join tf_process_config_l d on ( c.config_id = d.id )
  23. left join tf_process_config_step_l s on (d.id = s.config_id and b.edition = s.edition)
  24. left join tf_process_node_l node on
  25. (node.config_id = s.config_id and node.PROCESS_STEP = s.step_order and node.edition = s.edition and
  26. b.process_id = node.process_id
  27. )
  28. left join TF_CHARGE_REFUND_W re on re.node_id = node.id
  29. where
  30. c.is_del = 0
  31. and d.is_del = 0
  32. and d.is_valid =1
  33. and s.is_valid =1
  34. and s.is_del=0
  35. and node.is_valid =1
  36. and node.is_del = 0
  37. and (s.step_name='用户结算' or s.step_name='结算办理')
  38. and re.id is not null
  39. <if test="reportDto !=null">
  40. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  41. and b.tenant_id=#{reportDto.tenantId}
  42. </if>
  43. <if test="reportDto.beginTime !=null">
  44. and b.REGISTER_TIME>= #{reportDto.beginTime}
  45. </if>
  46. <if test="reportDto.endTime !=null">
  47. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  48. </if>
  49. <if test="reportDto.keywords !=null and reportDto.keywords !=''">
  50. and (
  51. instr(PROJECT_NAME,#{reportDto.keywords})>0
  52. or
  53. instr (REGION_NAME,#{reportDto.keywords})>0
  54. or
  55. instr (ADDRE,#{reportDto.keywords})>0
  56. or
  57. instr (USER_PHONE,#{reportDto.keywords})>0
  58. )
  59. </if>
  60. <if test="reportDto.processTypes!=null and reportDto.processTypes!=''.toString()">
  61. AND b.process_type in
  62. <foreach item="item" index="index" collection="reportDto.processTypes.split(',')" open="(" separator=","
  63. close=")">
  64. #{item}
  65. </foreach>
  66. </if>
  67. <if test="reportDto.projectNatureIds!=null and reportDto.projectNatureIds!=''.toString()">
  68. AND user_type in
  69. <foreach item="item" index="index" collection="reportDto.projectNatureIds.split(',')" open="("
  70. separator="," close=")">
  71. #{item}
  72. </foreach>
  73. </if>
  74. </if>
  75. order by PROJECT_NAME
  76. </select>
  77. <select id="getSignAndApplyData" resultType="com.tofly.workflow.report.vo.SignApplyVo">
  78. select b.PROJECT_NAME,
  79. b. APPLY_USER_NAME,
  80. (select type_name from TF_BASE_TYPE_P where id = b.process_type) process_type_name,
  81. b.REGISTER_TIME,
  82. b.REGION_NAME || ' ' || ADDRE address,
  83. b.USER_PHONE,
  84. (select REAL_NAME from sys_user where id = duty_user) duty_user,-- 勘察人,
  85. b.SURVEY_DATE SURVEY_DATE,-- 勘察日期
  86. b.HOUSEHOLD_NUMBER ,--申请户数
  87. (select name from SYS_DICT where id = user_type) PROJECT_NATURE,--工程性质
  88. b.INSTALL_CONTENT, --安装内容
  89. b.process_id,
  90. m.NAME LABEL_NAME,
  91. (select REAL_NAME from sys_user where id = b.REGISTER_STAFF) REGISTER_STAFF_NAME
  92. from TF_PROJECT_BASE_W b
  93. left join tf_process_l c on b.process_id = c.id
  94. LEFT JOIN
  95. (
  96. SELECT
  97. PROCESS_ID,
  98. MAX( h.ID ) ID
  99. FROM TF_NOW_HANDLE_L h
  100. LEFT JOIN TF_CONFIG_STEP_USER_L su ON ( h.STEP_ID = su.STEP_ID AND h.STEP_NODE = su.STEP_NODE )
  101. WHERE
  102. su.USER_TYPE = 1
  103. GROUP BY
  104. PROCESS_ID
  105. ) h ON b.PROCESS_ID = h.PROCESS_ID
  106. LEFT JOIN TF_NOW_HANDLE_L nh ON ( b.PROCESS_ID = nh.PROCESS_ID AND h.ID = nh.ID )
  107. LEFT JOIN SYS_MENU m ON nh.LABEL = m.ID
  108. where
  109. 1=1
  110. and c.is_del = 0
  111. <if test="reportDto !=null">
  112. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  113. and b.tenant_id=#{reportDto.tenantId}
  114. </if>
  115. <if test="reportDto.beginTime !=null ">
  116. and b.REGISTER_TIME>= #{reportDto.beginTime}
  117. </if>
  118. <if test="reportDto.endTime !=null ">
  119. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  120. </if>
  121. <if test="reportDto.keywords !=null and reportDto.keywords !=''">
  122. and (
  123. instr(PROJECT_NAME,#{reportDto.keywords})>0
  124. or
  125. instr (REGION_NAME,#{reportDto.keywords})>0
  126. or
  127. instr (ADDRE,#{reportDto.keywords})>0
  128. or
  129. instr (USER_PHONE,#{reportDto.keywords})>0
  130. )
  131. </if>
  132. <if test="reportDto.processTypes!=null and reportDto.processTypes!=''.toString()">
  133. AND b.process_type in
  134. <foreach item="item" index="index" collection="reportDto.processTypes.split(',')" open="(" separator=","
  135. close=")">
  136. #{item}
  137. </foreach>
  138. </if>
  139. <if test="reportDto.projectNatureIds!=null and reportDto.projectNatureIds!=''.toString()">
  140. AND user_type in
  141. <foreach item="item" index="index" collection="reportDto.projectNatureIds.split(',')" open="("
  142. separator="," close=")">
  143. #{item}
  144. </foreach>
  145. </if>
  146. </if>
  147. </select>
  148. <select id="getDispatchCount" resultType="com.tofly.workflow.report.vo.ProjectDispatchVo">
  149. select duty_post_name,duty_user,
  150. count(case when user_type='商业' then 1 end ) sysl,
  151. count(case when user_type='工业' then 1 end ) gysl,
  152. count(case when user_type='公服' then 1 end) gfsl,
  153. count(case when user_type='集中小区' then 1 end) jzxqsl,
  154. count(case when user_type='民用' then 1 end)mysl,
  155. count(case when user_type='商业' or user_type='工业' or user_type='公服' then 1 end) fjxqsl,
  156. sum(case when user_type='集中小区' then HOUSEHOLD_NUMBER else 0 end ) jzxq_hs,
  157. sum(case when user_type='民用' then HOUSEHOLD_NUMBER else 0 end ) my_hs,
  158. count(1) project_number,
  159. nvl(sum(HOUSEHOLD_NUMBER),0) household_total
  160. from(
  161. select ( select name from SYS_POST where id = a.duty_post and DELETED != 1 ) duty_post_name,
  162. (select REAL_NAME from sys_user where id =DUTY_USER ) DUTY_USER,
  163. (select name from SYS_DICT where id = a.user_type) user_type,
  164. HOUSEHOLD_NUMBER
  165. from TF_PROJECT_BASE_W a where 1=1
  166. <if test="reportDto !=null">
  167. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  168. and a.tenant_id=#{reportDto.tenantId}
  169. </if>
  170. <if test="reportDto.beginTime !=null ">
  171. and a.REGISTER_TIME>= #{reportDto.beginTime}
  172. </if>
  173. <if test="reportDto.endTime !=null">
  174. <![CDATA[ and a.REGISTER_TIME < =#{reportDto.endTime} ]]>
  175. </if>
  176. <if test="reportDto.keywords !=null and reportDto.keywords !=''">
  177. and (
  178. instr(PROJECT_NAME,#{reportDto.keywords})>0
  179. or
  180. instr (REGION_NAME,#{reportDto.keywords})>0
  181. or
  182. instr (ADDRE,#{reportDto.keywords})>0
  183. or
  184. instr (USER_PHONE,#{reportDto.keywords})>0
  185. )
  186. </if>
  187. <if test="reportDto.processTypes!=null and reportDto.processTypes!=''.toString()">
  188. AND a.process_type in
  189. <foreach item="item" index="index" collection="reportDto.processTypes.split(',')" open="(" separator=","
  190. close=")">
  191. #{item}
  192. </foreach>
  193. </if>
  194. <if test="reportDto.projectNatureIds!=null and reportDto.projectNatureIds!=''.toString()">
  195. AND user_type in
  196. <foreach item="item" index="index" collection="reportDto.projectNatureIds.split(',')" open="("
  197. separator="," close=")">
  198. #{item}
  199. </foreach>
  200. </if>
  201. </if>
  202. ) group by duty_post_name,duty_user
  203. </select>
  204. <select id="getNotInProjectVo" resultType="com.tofly.workflow.report.vo.NotInProjectVo">
  205. select PROJECT_NAME,
  206. (select type_name from TF_BASE_TYPE_P where id = b.process_type) process_type_name,
  207. (select name from SYS_DICT where id = user_type) PROJECT_NATURE,--工程性质
  208. REGION_NAME || ' ' || ADDRE address,
  209. HOUSEHOLD_NUMBER ,--申请户数
  210. REGISTER_TIME, --申请日期
  211. CONTACTS, --联系人
  212. USER_PHONE, --联系电话
  213. (select REAL_NAME from sys_user where id =duty_user) duty_user , --负责人
  214. SURVEY_DATE SURVEY_DATE,-- 勘察日期
  215. DATA_TIME,-- 派工日期
  216. n6.handle_time jfrq -- 缴费日期
  217. from TF_PROJECT_BASE_W b
  218. left join
  219. (
  220. select n.handle_time,n.process_id from tf_process_node_l n
  221. where n.is_valid =1
  222. and n.is_del=0
  223. and ( n.step_name = '合同签订及用户缴费' )
  224. ) n6 on n6.process_id = b.process_id
  225. where 1=1
  226. <if test="reportDto !=null">
  227. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  228. and b.tenant_id=#{reportDto.tenantId}
  229. </if>
  230. <if test="reportDto.beginTime !=null">
  231. and b.REGISTER_TIME>= #{reportDto.beginTime}
  232. </if>
  233. <if test="reportDto.endTime !=null">
  234. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  235. </if>
  236. <if test="reportDto.keywords !=null and reportDto.keywords !=''">
  237. and (
  238. instr(PROJECT_NAME,#{reportDto.keywords})>0
  239. or
  240. instr (REGION_NAME,#{reportDto.keywords})>0
  241. or
  242. instr (ADDRE,#{reportDto.keywords})>0
  243. or
  244. instr (USER_PHONE,#{reportDto.keywords})>0
  245. )
  246. </if>
  247. <if test="reportDto.processTypes!=null and reportDto.processTypes!=''.toString()">
  248. AND b.process_type in
  249. <foreach item="item" index="index" collection="reportDto.processTypes.split(',')" open="(" separator=","
  250. close=")">
  251. #{item}
  252. </foreach>
  253. </if>
  254. <if test="reportDto.projectNatureIds!=null and reportDto.projectNatureIds!=''.toString()">
  255. AND user_type in
  256. <foreach item="item" index="index" collection="reportDto.projectNatureIds.split(',')" open="("
  257. separator="," close=")">
  258. #{item}
  259. </foreach>
  260. </if>
  261. </if>
  262. and b.id not in(
  263. select id from (
  264. select x.*,
  265. case
  266. when(type_name='新安装工程' and STEP_NAME='技术交底' and x.handle_id is null )then '1'
  267. when(type_name='户内改造工程' and STEP_NAME='工程派工' and x.handle_id is null ) then '1'
  268. when(type_name='新安装工程' and STEP_NAME='工程派工' )then '3'
  269. else '0'
  270. end as status
  271. from (
  272. select a.*,
  273. d.node_id,
  274. d.step_name,
  275. h.id handle_id,
  276. (select type_name from TF_BASE_TYPE_P where id = a.process_type) type_name
  277. from TF_PROJECT_BASE_W a
  278. left join (select b.process_id,
  279. b.id node_id,
  280. b.config_id ,
  281. b.step_name,
  282. b.edition,
  283. b.label
  284. from tf_process_node_l b
  285. where (b.step_name = '技术交底' or b.step_name = '工程派工')
  286. and b.is_valid = 1
  287. and b.is_del = 0
  288. and b.node_state = 2) d
  289. on( a.process_id = d.process_id and a.config_id = d.config_id)
  290. left join tf_now_handle_l h on (a.process_id =h.process_id and d.label = h.label and d.edition = h.edition)
  291. ) x
  292. ) where status =1 and (type_name ='户内改造工程' or type_name ='新安装工程')
  293. )
  294. </select>
  295. <select id="preIncomeCount" resultType="com.tofly.workflow.report.vo.PreIncomeVo">
  296. select (select type_name from TF_BASE_TYPE_P where id = b.process_type) process_type_name,
  297. b.project_name,
  298. b.region_name || b.addre address,
  299. b.user_phone,
  300. (select name from SYS_DICT where id = user_type) PROJECT_NATURE,
  301. b.household_number,
  302. re.amount,
  303. (select name from sys_dict where id = re.charge_mode) charge_mode,
  304. (select REAL_NAME from sys_user where id = node.handle_user) hand_User,
  305. re.remark,
  306. re.PAYMENT_DATE
  307. from TF_PROJECT_BASE_W b
  308. left join tf_process_l c
  309. on b.process_id = c.id
  310. left join tf_process_config_l d
  311. on (c.config_id = d.id)
  312. left join tf_process_config_step_l s
  313. on (d.id = s.config_id and b.edition = s.edition)
  314. left join tf_process_node_l node
  315. on (node.config_id = s.config_id and node.PROCESS_STEP = s.step_order and
  316. node.edition = s.edition and b.process_id = node.process_id)
  317. left join TF_CHARGE_REFUND_W re
  318. on re.node_id = node.id
  319. where c.is_del = 0
  320. and d.is_del = 0
  321. and d.is_valid = 1
  322. and s.is_valid = 1
  323. and s.is_del = 0
  324. and node.is_valid = 1
  325. and node.is_del = 0
  326. and (s.step_name = '合同签订及用户缴费' or s.step_name = '用户缴费')
  327. and re.amount is not null
  328. <if test="reportDto !=null">
  329. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  330. and b.tenant_id=#{reportDto.tenantId}
  331. </if>
  332. <if test="reportDto.beginTime !=null">
  333. and b.REGISTER_TIME>= #{reportDto.beginTime}
  334. </if>
  335. <if test="reportDto.endTime !=null">
  336. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  337. </if>
  338. <if test="reportDto.keywords !=null and reportDto.keywords !=''">
  339. and (
  340. instr(PROJECT_NAME,#{reportDto.keywords})>0
  341. or
  342. instr (REGION_NAME,#{reportDto.keywords})>0
  343. or
  344. instr (ADDRE,#{reportDto.keywords})>0
  345. or
  346. instr (USER_PHONE,#{reportDto.keywords})>0
  347. )
  348. </if>
  349. <if test="reportDto.processTypes!=null and reportDto.processTypes!=''.toString()">
  350. AND b.process_type in
  351. <foreach item="item" index="index" collection="reportDto.processTypes.split(',')" open="(" separator=","
  352. close=")">
  353. #{item}
  354. </foreach>
  355. </if>
  356. <if test="reportDto.projectNatureIds!=null and reportDto.projectNatureIds!=''.toString()">
  357. AND user_type in
  358. <foreach item="item" index="index" collection="reportDto.projectNatureIds.split(',')" open="("
  359. separator="," close=")">
  360. #{item}
  361. </foreach>
  362. </if>
  363. </if>
  364. order by PROJECT_NAME
  365. </select>
  366. <select id="hasChargeCount" resultType="com.tofly.workflow.report.vo.HasChargeVo">
  367. select
  368. b.process_id,
  369. b.project_name,
  370. (select type_name from TF_BASE_TYPE_P where id = b.process_type) process_type_name,
  371. (select name from SYS_DICT where id = user_type) PROJECT_NATURE,
  372. b.region_name || b.addre address,
  373. b.household_number,
  374. b.register_time ,
  375. b.contacts contact_user ,
  376. user_Phone,
  377. (select REAL_NAME from sys_user where id =b.duty_user) duty_user ,
  378. b.survey_Date surveyDate,
  379. b.budget budget,
  380. b.budget/household_number budgetAvg,
  381. -- b.advance_Payment,
  382. re.amount,
  383. re.payment_date
  384. from TF_PROJECT_BASE_W b
  385. left join tf_process_l c on b.process_id = c.id
  386. left join tf_process_config_l d on ( c.config_id = d.id )
  387. left join tf_process_config_step_l s on (d.id = s.config_id and b.edition = s.edition)
  388. left join tf_process_node_l node on
  389. (node.config_id = s.config_id and node.PROCESS_STEP = s.step_order and node.edition = s.edition and
  390. b.process_id = node.process_id
  391. )
  392. left join TF_CHARGE_REFUND_W re on re.node_id = node.id
  393. where
  394. c.is_del = 0
  395. and d.is_del = 0
  396. and d.is_valid =1
  397. and s.is_valid =1
  398. and s.is_del=0
  399. and node.is_valid =1
  400. and node.is_del = 0
  401. and (s.step_name='合同签订及用户缴费' or s.step_name='用户缴费' or s.STEP_NAME='合同签订及缴费')
  402. and re.amount is not null
  403. --and b.project_name='(隐患户)安昌重庆安逸包'
  404. --and b.process_id=1699077770691317761
  405. --and re.id is not null
  406. <if test="reportDto !=null">
  407. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  408. and b.tenant_id=#{reportDto.tenantId}
  409. </if>
  410. <if test="reportDto.beginTime !=null">
  411. and b.REGISTER_TIME>= #{reportDto.beginTime}
  412. </if>
  413. <if test="reportDto.endTime !=null">
  414. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  415. </if>
  416. <if test="reportDto.keywords !=null and reportDto.keywords !=''">
  417. and (
  418. instr(PROJECT_NAME,#{reportDto.keywords})>0
  419. or
  420. instr (REGION_NAME,#{reportDto.keywords})>0
  421. or
  422. instr (ADDRE,#{reportDto.keywords})>0
  423. or
  424. instr (USER_PHONE,#{reportDto.keywords})>0
  425. )
  426. </if>
  427. <if test="reportDto.processTypes!=null and reportDto.processTypes!=''.toString()">
  428. AND b.process_type in
  429. <foreach item="item" index="index" collection="reportDto.processTypes.split(',')" open="(" separator=","
  430. close=")">
  431. #{item}
  432. </foreach>
  433. </if>
  434. <if test="reportDto.projectNatureIds!=null and reportDto.projectNatureIds!=''.toString()">
  435. AND user_type in
  436. <foreach item="item" index="index" collection="reportDto.projectNatureIds.split(',')" open="("
  437. separator="," close=")">
  438. #{item}
  439. </foreach>
  440. </if>
  441. </if>
  442. order by PROJECT_NAME
  443. </select>
  444. <select id="acceptCount" resultType="com.tofly.workflow.report.vo.AcceptVo">
  445. select b.project_name,
  446. b.process_id,
  447. (select type_name from TF_BASE_TYPE_P where id = b.process_type) process_type_name,
  448. --process_type,
  449. (select name from SYS_DICT where id = user_type) PROJECT_NATURE,
  450. b.region_name || b.addre address,
  451. b.household_number,
  452. b.register_time,
  453. b.contacts contact_user,
  454. user_Phone,
  455. n6.handle_time pay_Handle_Time,
  456. (select REAL_NAME from sys_user where id = b.duty_user) duty_user,
  457. b.survey_Date surveyDate,
  458. --缴费日期,
  459. b.data_Time dispatch_date, --派工日期
  460. (select name from SYS_DEPT where id = b.build_Unit) build_unit_name , -- 施工单位
  461. ( select name from TF_CONSTRUCTION_TEAM_P where id = b.team_Id) team_name , -- 施工班组
  462. (select REAL_NAME from sys_user where id = b.build_User_Id) build_user_name, --施工负责人
  463. ( select min(n1.create_time) from tf_process_node_l n1
  464. left join tf_process_l p1 on n1.process_id = p1.id
  465. where n1.is_valid = 1 and n1.is_del=0
  466. and p1.is_del=0
  467. and p1.relation_id =b.process_id
  468. and n1.step_name = '工程领料'
  469. ) first_apply_time , -- 领料日期
  470. ( select min(n1.create_time) from tf_process_node_l n1
  471. left join tf_process_l p1 on n1.process_id = p1.id
  472. where n1.is_valid = 1 and n1.is_del=0
  473. and p1.is_del=0
  474. and p1.relation_id =b.process_id
  475. and n1.step_name = '工程退料'
  476. ) first_Refund_Time, -- 日期
  477. n2.create_time commit_time, -- 提交验收申请日期,
  478. --验收结果
  479. x.result_message,
  480. --验收合格日期
  481. x.throw_time
  482. -- 退料日期
  483. from TF_PROJECT_BASE_W b
  484. -- left join tf_process_node_l n on (n.process_id = p.id )
  485. left join tf_process_node_l n2 on (n2.process_id = b.process_id)
  486. left join
  487. (
  488. select n.handle_time,n.process_id from tf_process_node_l n
  489. where n.is_valid =1
  490. and n.is_del=0
  491. and ( n.step_name = '合同签订及用户缴费' )
  492. ) n6 on n6.process_id = b.process_id
  493. left join (
  494. select *from (
  495. select case
  496. when count_throw = total then
  497. '合格'
  498. when count_bh > 0 then
  499. '不合格'
  500. else
  501. '审核中'
  502. end result_message,
  503. throw_time,
  504. process_id
  505. from (
  506. select
  507. n.process_id,
  508. count(1) total,
  509. count(case
  510. when NODE_STATE = 2 then
  511. 1
  512. end) count_throw,
  513. count(case
  514. when NODE_STATE = 3 then
  515. 1
  516. end) count_bh,
  517. max(HANDLE_TIME) throw_time
  518. --select *
  519. from tf_process_node_l n
  520. left join (
  521. select l.step_name,l.config_id,l.edition,l.step_order
  522. from tf_process_config_step_l l
  523. left join tf_process_config_step_l l2
  524. on (l.config_id = l2.config_id
  525. and l.edition = l2.edition
  526. and l.upper_step = to_char(l2.step_order))
  527. where l2.step_name='综合验收'
  528. ) x on ( n.process_step = x.step_order and n.config_id = x.config_id and n.edition = x.edition)
  529. where x.step_name is not null and n.is_valid = 1 and n.is_del = 0
  530. group by n.process_id
  531. )
  532. )
  533. ) x on b.process_id =x.process_id
  534. where
  535. --p.is_del = 0
  536. -- and n.is_valid =1
  537. -- and n.is_del=0
  538. n2.is_valid =1
  539. and n2.is_del=0
  540. and ( n2.step_name = '综合验收' )
  541. and process_type=1568576682649546753
  542. <if test="reportDto !=null">
  543. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  544. and b.tenant_id=#{reportDto.tenantId}
  545. </if>
  546. <if test="reportDto.beginTime !=null">
  547. and b.REGISTER_TIME>= #{reportDto.beginTime}
  548. </if>
  549. <if test="reportDto.endTime !=null">
  550. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  551. </if>
  552. <if test="reportDto.keywords !=null and reportDto.keywords !=''">
  553. and (
  554. instr(PROJECT_NAME,#{reportDto.keywords})>0
  555. or
  556. instr (REGION_NAME,#{reportDto.keywords})>0
  557. or
  558. instr (ADDRE,#{reportDto.keywords})>0
  559. or
  560. instr (USER_PHONE,#{reportDto.keywords})>0
  561. )
  562. </if>
  563. <if test="reportDto.processTypes!=null and reportDto.processTypes!=''.toString()">
  564. AND b.process_type in
  565. <foreach item="item" index="index" collection="reportDto.processTypes.split(',')" open="(" separator=","
  566. close=")">
  567. #{item}
  568. </foreach>
  569. </if>
  570. <if test="reportDto.projectNatureIds!=null and reportDto.projectNatureIds!=''.toString()">
  571. AND user_type in
  572. <foreach item="item" index="index" collection="reportDto.projectNatureIds.split(',')" open="("
  573. separator="," close=")">
  574. #{item}
  575. </foreach>
  576. </if>
  577. </if>
  578. -- and n.step_name='领料确认'
  579. order by PROJECT_NAME
  580. </select>
  581. <select id="completeCount" resultType="com.tofly.workflow.report.vo.CompleteVo">
  582. select b.project_name,
  583. b.process_id,
  584. (select type_name from TF_BASE_TYPE_P where id = b.process_type) process_type_name,
  585. (select name from SYS_DICT where id = user_type) PROJECT_NATURE,
  586. b.region_name || b.addre address,
  587. b.household_number,
  588. b.register_time,
  589. b.contacts contact_user,
  590. user_Phone,
  591. (select REAL_NAME from sys_user where id = b.duty_user) duty_user,
  592. b.survey_Date surveyDate,
  593. b.budget,
  594. b.budget/b.household_number avgBudget,
  595. b.advance_payment ,
  596. n6.handle_time pay_handle_time ,
  597. b.data_Time dispatch_date,
  598. (select name from SYS_DEPT where id = b.build_Unit) build_unit_name ,
  599. ( select name from TF_CONSTRUCTION_TEAM_P where id = b.team_Id) team_name ,
  600. (select REAL_NAME from sys_user where id = b.build_User_Id) build_user_name,
  601. nl.create_time first_apply_time ,
  602. nt.create_time lfirst_Refund_Time,
  603. b.apply_date,
  604. b.total_Price charge_Number,
  605. x.result_message,
  606. x.throw_time ,
  607. n3.handle_time charge_handle_time ,
  608. n5.handle_time complete_handle_time,
  609. n2.create_time commitTime
  610. from TF_PROJECT_BASE_W b
  611. left join(
  612. select *from tf_process_node_l n where n.is_valid =1
  613. and n.is_del=0
  614. and ( n.step_name = '综合验收' )
  615. ) n2 on n2.process_id = b.process_id
  616. left join
  617. (
  618. select re.amount,n.handle_time,n.process_id from tf_process_node_l n
  619. left join TF_CHARGE_REFUND_W re on re.node_id = n.id
  620. where n.is_valid =1
  621. and n.is_del=0
  622. and ( n.step_name = '用户结算' )
  623. ) n3 on n3.process_id = b.process_id
  624. left join
  625. (
  626. select n.number_value,n.handle_time,n.process_id from tf_process_node_l n
  627. where n.is_valid =1
  628. and n.is_del=0
  629. and ( n.step_name = '工程结算' )
  630. ) n4 on n4.process_id = b.process_id
  631. left join
  632. (
  633. select n.handle_time,n.process_id from tf_process_node_l n
  634. where n.is_valid =1
  635. and n.is_del=0
  636. and ( n.step_name = '竣工资料移交' )
  637. ) n5 on n5.process_id = b.process_id
  638. left join
  639. (
  640. select n.handle_time,n.process_id from tf_process_node_l n
  641. where n.is_valid =1
  642. and n.is_del=0
  643. and ( n.step_name = '合同签订及用户缴费' )
  644. ) n6 on n6.process_id = b.process_id
  645. left join (
  646. select *from (
  647. select case
  648. when count_throw = total then
  649. '合格'
  650. when count_bh > 0 then
  651. '不合格'
  652. else
  653. '审核中'
  654. end result_message,
  655. throw_time,
  656. process_id
  657. from (
  658. select
  659. n.process_id,
  660. count(1) total,
  661. count(case
  662. when NODE_STATE = 2 then
  663. 1
  664. end) count_throw,
  665. count(case
  666. when NODE_STATE = 3 then
  667. 1
  668. end) count_bh,
  669. max(HANDLE_TIME) throw_time
  670. from tf_process_node_l n
  671. left join (
  672. select l.step_name,l.config_id,l.edition,l.step_order
  673. from tf_process_config_step_l l
  674. left join tf_process_config_step_l l2
  675. on (l.config_id = l2.config_id
  676. and l.edition = l2.edition
  677. and l.upper_step = to_char(l2.step_order))
  678. where l2.step_name='综合验收'
  679. ) x on ( n.process_step = x.step_order and n.config_id = x.config_id and n.edition = x.edition)
  680. where x.step_name is not null and n.is_valid = 1 and n.is_del = 0
  681. group by n.process_id
  682. )
  683. )
  684. ) x on b.process_id =x.process_id
  685. left join (
  686. select p1.relation_id ,min(n1.create_time) create_time from tf_process_node_l n1
  687. left join tf_process_l p1 on n1.process_id = p1.id
  688. where n1.is_valid = 1 and n1.is_del=0
  689. and p1.is_del=0
  690. and n1.step_name = '工程退料'
  691. group by p1.relation_id
  692. ) nt on nt.relation_id = b.process_id
  693. left join (
  694. select p1.relation_id ,min(n1.create_time) create_time from tf_process_node_l n1
  695. left join tf_process_l p1 on n1.process_id = p1.id
  696. where n1.is_valid = 1 and n1.is_del=0
  697. and p1.is_del=0
  698. and n1.step_name = '工程领料'
  699. group by p1.relation_id
  700. ) nl on nl.relation_id = b.process_id
  701. where
  702. process_type=1568576682649546753
  703. and b.apply_date is not null
  704. and n5.handle_time is not null
  705. and n3.handle_time is not null
  706. and x.result_message is not null
  707. <if test="reportDto !=null">
  708. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  709. and b.tenant_id=#{reportDto.tenantId}
  710. </if>
  711. <if test="reportDto.beginTime !=null">
  712. and b.REGISTER_TIME>= #{reportDto.beginTime}
  713. </if>
  714. <if test="reportDto.endTime !=null">
  715. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  716. </if>
  717. <if test="reportDto.keywords !=null and reportDto.keywords !=''">
  718. and (
  719. instr(PROJECT_NAME,#{reportDto.keywords})>0
  720. or
  721. instr (REGION_NAME,#{reportDto.keywords})>0
  722. or
  723. instr (ADDRE,#{reportDto.keywords})>0
  724. or
  725. instr (USER_PHONE,#{reportDto.keywords})>0
  726. )
  727. </if>
  728. <if test="reportDto.processTypes!=null and reportDto.processTypes!=''.toString()">
  729. AND b.process_type in
  730. <foreach item="item" index="index" collection="reportDto.processTypes.split(',')" open="(" separator=","
  731. close=")">
  732. #{item}
  733. </foreach>
  734. </if>
  735. <if test="reportDto.projectNatureIds!=null and reportDto.projectNatureIds!=''.toString()">
  736. AND user_type in
  737. <foreach item="item" index="index" collection="reportDto.projectNatureIds.split(',')" open="("
  738. separator="," close=")">
  739. #{item}
  740. </foreach>
  741. </if>
  742. </if>
  743. order by PROJECT_NAME
  744. </select>
  745. <select id="allRoundCount" resultType="com.tofly.workflow.report.vo.AllRoundVo">
  746. select
  747. (select type_name from TF_BASE_TYPE_P where id = a.process_type) process_type_name,
  748. a.total_household_number,
  749. a.register_number,
  750. a1.ct has_charge, --已缴费数
  751. a.register_number - a2.ct2 no_begin, --未开工数
  752. a2.ct2 has_begin,--已开工数
  753. a7.ct complete_Num, --工程完结归档
  754. a4.ct has_accept, -- 已验收
  755. a.register_number-a4.ct no_accept , --未验收
  756. a5.ct has_settle , --工程结算
  757. a6.ct to_Regular_Count--转固数量
  758. from (
  759. select b.process_type, -- 工程类型
  760. sum(b.household_number) total_household_number, --总户数
  761. count(case
  762. when b.register_time is not null then
  763. 1
  764. end) register_number -- 工程登记数
  765. from TF_PROJECT_BASE_W b
  766. where 1=1
  767. <if test="reportDto !=null">
  768. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  769. and b.tenant_id=#{reportDto.tenantId}
  770. </if>
  771. <if test="reportDto.beginTime !=null">
  772. and b.REGISTER_TIME>= #{reportDto.beginTime}
  773. </if>
  774. <if test="reportDto.endTime !=null">
  775. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  776. </if>
  777. </if>
  778. group by process_type ) a
  779. left join (
  780. select b.process_type,
  781. count(case
  782. when node.handle_time is not null then
  783. 1
  784. end) ct
  785. from TF_PROJECT_BASE_W b
  786. left join tf_process_l c
  787. on b.process_id = c.id
  788. left join tf_process_config_l d
  789. on (c.config_id = d.id)
  790. left join tf_process_config_step_l s
  791. on (d.id = s.config_id and b.edition = s.edition)
  792. left join tf_process_node_l node
  793. on (node.config_id = s.config_id and
  794. node.PROCESS_STEP = s.step_order and
  795. node.edition = s.edition and
  796. b.process_id = node.process_id)
  797. where 1 = 1
  798. and d.is_del = 0
  799. and d.is_valid = 1
  800. and s.is_valid = 1
  801. and s.is_del = 0
  802. and (s.step_name = '合同签订及用户缴费' or s.step_name = '用户缴费')
  803. <if test="reportDto !=null">
  804. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  805. and b.tenant_id=#{reportDto.tenantId}
  806. </if>
  807. <if test="reportDto.beginTime !=null">
  808. and b.REGISTER_TIME>= #{reportDto.beginTime}
  809. </if>
  810. <if test="reportDto.endTime !=null">
  811. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  812. </if>
  813. </if>
  814. group by b.process_type) a1
  815. on a.process_type = a1.process_type
  816. left join (
  817. select b.process_type,
  818. count(case
  819. when node.handle_time is null then
  820. 1
  821. end) ct,
  822. count(case
  823. when node.handle_state = 1 then
  824. 1
  825. end) ct2
  826. from TF_PROJECT_BASE_W b
  827. left join tf_process_l c
  828. on b.process_id = c.id
  829. left join tf_process_config_l d
  830. on (c.config_id = d.id)
  831. left join tf_process_config_step_l s
  832. on (d.id = s.config_id and b.edition = s.edition)
  833. left join tf_process_node_l node
  834. on (node.config_id = s.config_id and
  835. node.PROCESS_STEP = s.step_order and
  836. node.edition = s.edition and
  837. b.process_id = node.process_id)
  838. where 1 = 1
  839. and d.is_del = 0
  840. and d.is_valid = 1
  841. and s.is_valid = 1
  842. and s.is_del = 0
  843. and (s.step_name = '开工报告')
  844. <if test="reportDto !=null">
  845. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  846. and b.tenant_id=#{reportDto.tenantId}
  847. </if>
  848. <if test="reportDto.beginTime !=null">
  849. and b.REGISTER_TIME>= #{reportDto.beginTime}
  850. </if>
  851. <if test="reportDto.endTime !=null">
  852. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  853. </if>
  854. </if>
  855. group by b.process_type) a2
  856. on a.process_type = a2.process_type
  857. left join (
  858. select b.process_type,
  859. count(case
  860. when node.handle_time is null then
  861. 1
  862. end) ct,
  863. count(case
  864. when node.handle_state = 1 then
  865. 1
  866. end) ct2
  867. from TF_PROJECT_BASE_W b
  868. left join tf_process_l c
  869. on b.process_id = c.id
  870. left join tf_process_config_l d
  871. on (c.config_id = d.id)
  872. left join tf_process_config_step_l s
  873. on (d.id = s.config_id and b.edition = s.edition)
  874. left join tf_process_node_l node
  875. on (node.config_id = s.config_id and
  876. node.PROCESS_STEP = s.step_order and
  877. node.edition = s.edition and
  878. b.process_id = node.process_id)
  879. where 1 = 1
  880. and d.is_del = 0
  881. and d.is_valid = 1
  882. and s.is_valid = 1
  883. and s.is_del = 0
  884. and (s.step_name = '工程验收')
  885. <if test="reportDto !=null">
  886. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  887. and b.tenant_id=#{reportDto.tenantId}
  888. </if>
  889. <if test="reportDto.beginTime !=null">
  890. and b.REGISTER_TIME>= #{reportDto.beginTime}
  891. </if>
  892. <if test="reportDto.endTime !=null">
  893. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  894. </if>
  895. </if>
  896. group by b.process_type) a3
  897. on a.process_type = a3.process_type
  898. left join (
  899. select PROCESS_TYPE,count(1) ct
  900. from TF_PROJECT_BASE_W b
  901. left join tf_process_node_l n2
  902. on (n2.process_id = b.process_id)
  903. where n2.step_name = '综合验收'
  904. and n2.handle_time is not null
  905. and n2.is_valid = 1
  906. and n2.is_del = 0
  907. and HANDLE_STATE= 1
  908. <if test="reportDto !=null">
  909. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  910. and b.tenant_id=#{reportDto.tenantId}
  911. </if>
  912. <if test="reportDto.beginTime !=null">
  913. and b.REGISTER_TIME>= #{reportDto.beginTime}
  914. </if>
  915. <if test="reportDto.endTime !=null">
  916. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  917. </if>
  918. </if>
  919. group by PROCESS_TYPE
  920. ) a4 on a.process_type = a4.process_type
  921. left join (
  922. select PROCESS_TYPE,count(1) ct
  923. from TF_PROJECT_BASE_W b
  924. left join tf_process_node_l n2
  925. on (n2.process_id = b.process_id)
  926. where (n2.step_name = '用户结算' or n2.step_name = '结算办理')
  927. and n2.handle_time is not null
  928. and n2.is_valid = 1
  929. and n2.is_del = 0
  930. and HANDLE_STATE= 1
  931. <if test="reportDto !=null">
  932. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  933. and b.tenant_id=#{reportDto.tenantId}
  934. </if>
  935. <if test="reportDto.beginTime !=null">
  936. and b.REGISTER_TIME>= #{reportDto.beginTime}
  937. </if>
  938. <if test="reportDto.endTime !=null">
  939. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  940. </if>
  941. </if>
  942. group by PROCESS_TYPE
  943. ) a5 on a.process_type = a5.process_type
  944. left join (
  945. select PROCESS_TYPE,count(1) ct
  946. from TF_PROJECT_BASE_W b
  947. left join tf_process_node_l n2
  948. on (n2.process_id = b.process_id)
  949. where n2.step_name = '转固'
  950. and n2.handle_time is not null
  951. and n2.is_valid = 1
  952. and n2.is_del = 0
  953. and HANDLE_STATE= 1
  954. <if test="reportDto !=null">
  955. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  956. and b.tenant_id=#{reportDto.tenantId}
  957. </if>
  958. <if test="reportDto.beginTime !=null">
  959. and b.REGISTER_TIME>= #{reportDto.beginTime}
  960. </if>
  961. <if test="reportDto.endTime !=null">
  962. <![CDATA[ and b.REGISTER_TIME < =#{reportDto.endTime} ]]>
  963. </if>
  964. </if>
  965. group by PROCESS_TYPE
  966. ) a6 on a.process_type = a6.process_type
  967. left join(
  968. select process_type, count(1) ct from tf_process_l where PROCESS_STATE = '4'
  969. <if test="reportDto !=null">
  970. <if test="reportDto.tenantId !=null and reportDto.tenantId !='' ">
  971. and tenant_id=#{reportDto.tenantId}
  972. </if>
  973. <if test="reportDto.beginTime !=null">
  974. and REGISTER_TIME>= #{reportDto.beginTime}
  975. </if>
  976. <if test="reportDto.endTime !=null">
  977. <![CDATA[ and REGISTER_TIME < =#{reportDto.endTime} ]]>
  978. </if>
  979. </if>
  980. group by process_type
  981. ) a7 on a.process_type = a7.process_type
  982. </select>
  983. <select id="getTotalAmount" resultType="java.lang.Long">
  984. select sum(amount)
  985. from TF_CHARGE_REFUND_W c
  986. inner join TF_PROCESS_NODE_L n on c.NODE_ID=n.id
  987. where c.PROCESS_ID = #{processId}
  988. and n.IS_VALID=1
  989. </select>
  990. <select id="getContract" resultType="com.tofly.workflow.report.vo.ContractVo">
  991. select *
  992. from (select coalesce(contract.TOTAL_CONTRACT, 0) TOTAL_CONTRACT,
  993. coalesce(contract.DEDUCT_EXPENSES, 0) DEDUCT_EXPENSES,
  994. coalesce(contract.WATER_ELECTRICITY, 0) WATER_ELECTRICITY,
  995. dist.name as settlementMode
  996. from tf_contract_w contract
  997. inner join SYS_DICT dist on contract.SETTLEMENT_MODE = dist.id
  998. inner join TF_PROCESS_NODE_L node on contract.NODE_ID=node.id
  999. WHERE contract.process_id = #{processId}
  1000. and node.IS_VALID=1
  1001. order by contract.id desc)
  1002. where ROWNUM = 1
  1003. </select>
  1004. <select id="getProcessTypeList" resultType="com.tofly.workflow.report.vo.ProcessType">
  1005. select project.PROCESS_ID,
  1006. type.type_name
  1007. from TF_PROJECT_BASE_W project
  1008. inner join TF_BASE_TYPE_P type on project.process_type = type.id
  1009. inner join TF_PROCESS_L process on project.PROCESS_ID = process.ID
  1010. where process.PASSING_NODE is not null
  1011. and process.IS_DEL=0
  1012. <if test="tenantId !=null and tenantId !='' ">
  1013. and project.tenant_id=#{tenantId}
  1014. </if>
  1015. <if test="beginTime !=null">
  1016. and project.REGISTER_TIME &gt;= #{beginTime}
  1017. </if>
  1018. <if test="endTime !=null">
  1019. and project.REGISTER_TIME &lt;= #{endTime}
  1020. </if>
  1021. </select>
  1022. <!-- <select id="getHasStep" resultType="java.lang.String">-->
  1023. <!-- select count(1) from (select distinct p.ID-->
  1024. <!-- from TF_PROCESS_L p-->
  1025. <!-- inner join TF_PROCESS_NODE_L n on p.ID = n.PROCESS_ID-->
  1026. <!-- and n.HANDLE_STATE = 1-->
  1027. <!-- where n.IS_VALID = 1-->
  1028. <!-- and n.STEP_NAME = #{stepName}-->
  1029. <!-- and p.ID in-->
  1030. <!-- <foreach collection="processIdList" item="id" separator="," open="(" close=")">-->
  1031. <!-- #{id}-->
  1032. <!-- </foreach>-->
  1033. <!-- ) t-->
  1034. <!-- </select>-->
  1035. <select id="getHasStep" resultType="java.lang.String">
  1036. select count(1)
  1037. from TF_PROCESS_L p
  1038. inner join (select distinct PROCESS_ID
  1039. from TF_PROCESS_NODE_L pn
  1040. inner join SYS_MENU sm on pn.LABEL = sm.ID
  1041. where
  1042. pn.IS_VALID = 1
  1043. and sm.name = #{stepName}
  1044. and pn.NODE_STATE = 2
  1045. and pn.PROCESS_ID not in (select PROCESS_ID
  1046. from TF_PROCESS_NODE_L pn2
  1047. inner join SYS_MENU sm on pn2.LABEL = sm.ID
  1048. where
  1049. pn2.IS_VALID = 1
  1050. and sm.name = #{stepName}
  1051. and pn2.NODE_STATE != 2)) n
  1052. on p.ID = n.PROCESS_ID
  1053. where
  1054. p.id in
  1055. <foreach collection="processIdList" item="id" separator="," open="(" close=")">
  1056. #{id}
  1057. </foreach>
  1058. </select>
  1059. <select id="getToRegularCount" resultType="java.lang.String">
  1060. select count(1) from (
  1061. select * from TF_TRANSFER_FIXED_ASSETS_W t inner join TF_PROCESS_L p on p.ID = t.PROCESS_ID
  1062. <where>
  1063. <if test="processIdList !=null and processIdList.size() > 0 ">
  1064. p.ID in
  1065. <foreach collection="processIdList" item="id" separator="," open="(" close=")">
  1066. #{id}
  1067. </foreach>
  1068. </if>
  1069. </where>
  1070. ) t
  1071. </select>
  1072. <select id="getHouseHoldNumber" resultType="java.lang.String">
  1073. select sum(HOUSEHOLD_NUMBER) from TF_REGISTER_ITEM_W
  1074. <where>
  1075. <if test="processIdList !=null and processIdList.size() > 0 ">
  1076. PROCESS_ID in
  1077. <foreach collection="processIdList" item="id" separator="," open="(" close=")">
  1078. #{id}
  1079. </foreach>
  1080. </if>
  1081. </where>
  1082. </select>
  1083. <select id="getChargeWList" resultType="com.tofly.workflow.buss.entity.TfChargeW">
  1084. select c.*
  1085. from TF_CHARGE_W c
  1086. inner join TF_PROCESS_NODE_L n on c.NODE_ID = n.id
  1087. where c.PROCESS_ID = #{processId}
  1088. and n.IS_VALID = 1
  1089. </select>
  1090. </mapper>