YhKhjbxxMapper.xml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  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.feesapi.yhgl.mapper.YhKhjbxxMapper">
  4. <!--自定义获取用户最大yhbh -->
  5. <select id="selectMaxYhbh_jk" resultType="int">
  6. SELECT nvl(max(yhbh), 0)
  7. from yh_khjbxx
  8. where yhbh like '3%'
  9. </select>
  10. <select id="selectMaxYhbh_fjk" resultType="int">
  11. SELECT nvl(max(yhbh), 0)
  12. from yh_khjbxx
  13. where yhbh like '2%'
  14. </select>
  15. <!--自定义获取用户是否存在 -->
  16. <select id="selectExistYhbh" resultType="int">
  17. SELECT COUNT(0) sl
  18. FROM yh_khjbxx
  19. WHERE yhbh = #{yhbh}
  20. </select>
  21. <!--查询当前财务日期cwrq -->
  22. <select id="selectCwrq" resultType="java.util.Map">
  23. select cwrq
  24. from sys_gdcsb
  25. where gdbz = '0'
  26. </select>
  27. <!--查询用户余额 -->
  28. <select id="selectUserBalance" resultType="java.util.Map">
  29. SELECT yhbh, nvl(yfje, 0) yfje, nvl(kjje, 0) kjje, nvl(syje, 0) syje, nvl(nbsyje, 0) nbsyje
  30. FROM yy_zjzh
  31. WHERE yhbh = #{yhbh}
  32. </select>
  33. <!-- 查询当前用户是否存在多只表 -->
  34. <select id="selectCbkh" resultType="com.tofly.feesapi.yhgl.entity.dto.CbkxxDto">
  35. SELECT cbkh,
  36. cbkid,
  37. jfzt
  38. FROM yh_cbkxx
  39. WHERE yhbh = #{yhbh}
  40. </select>
  41. <!-- 水表档案是否存在-->
  42. <select id="selectExistCbkxx" resultType="int">
  43. SELECT COUNT(0) sl
  44. FROM yh_cbkxx
  45. WHERE yhbh = #{yhbh}
  46. </select>
  47. <select id="selectYhDa" resultType="com.tofly.feesapi.yhgl.entity.Yhkhjbxx2">
  48. select a.*, e.cbpqmc AS sscbpqmc, f.cbbmc AS sscbbmc
  49. FROM yh_khjbxx a
  50. LEFT JOIN bm_cbpq e on a.sscbpq = e.cbpqbm
  51. LEFT JOIN bm_cbb f on a.sscbb = f.cbbbm
  52. WHERE a.yhbh = #{yhbh}
  53. </select>
  54. <select id="getYhDbhxxPage" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxDbhSelect">
  55. <include refid="yhkhjbxx_dbhsql"></include>
  56. union all
  57. <include refid="dbhsql"></include>
  58. </select>
  59. <sql id="yhkhjbxx_dbhsql">
  60. select
  61. a.yhbh,
  62. a.yhxm,
  63. a.yhdz,
  64. a.lxdh,
  65. a.dbhndljl,
  66. b.sdsl as dbhyhsdsl,
  67. b.sdys as dbhyhsdyf,
  68. to_char(sysdate,'yyyyMM')as yhyear,
  69. e.cbpqmc as sscbpqmc,
  70. f.cbbmc as sscbbmc
  71. from yh_khjbxx a
  72. left join bm_cbpq e on a.sscbpq = e.cbpqbm
  73. left join bm_cbb f on a.sscbb = f.cbbbm
  74. left join bm_dbhysyh b on b.year= to_char(sysdate,'yyyy')
  75. where 1=1 and khlb='2'
  76. <!--模糊查询 -->
  77. <if test="filter.searchText!=null">
  78. AND ( a.yhbh like '%${filter.searchText}%'
  79. OR a.yhxm like '%${filter.searchText}%'
  80. OR a.yhdz like '%${filter.searchText}%'
  81. OR a.lxdh like '%${filter.searchText}%')
  82. </if>
  83. <!--所属公司-->
  84. <if test="filter.ssgs!=null">
  85. AND a.ssgs=#{filter.ssgs}
  86. </if>
  87. <!--所属片区-->
  88. <if test="filter.sscbpq!=null">
  89. AND a.sscbpq=#{filter.sscbpq}
  90. </if>
  91. <if test="filter.sscbb!=null">
  92. <choose>
  93. <when test="filter.sscbb.indexOf(',')!=-1">
  94. AND a.sscbb in
  95. <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
  96. close=")">
  97. #{item}
  98. </foreach>
  99. </when>
  100. <otherwise>
  101. AND a.sscbb=#{filter.sscbb}
  102. </otherwise>
  103. </choose>
  104. </if>
  105. <if test="filter.yhbhStart!=null">
  106. <![CDATA[ AND a.yhbh>=#{filter.yhbhStart} ]]>
  107. </if>
  108. <if test="filter.yhbhEnd!=null">
  109. <![CDATA[ AND a.yhbh<=#{filter.yhbhEnd} ]]>
  110. </if>
  111. <if test="filter.year!=null">
  112. AND to_char(sysdate,'yyyyMM')=#{filter.year}
  113. </if>
  114. </sql>
  115. <sql id="dbhsql">
  116. select
  117. a.yhbh,
  118. a.yhxm,
  119. a.yhdz,
  120. a.lxdh,
  121. a.dbhndljl,
  122. a.dbhyhsdsl,
  123. a.dbhyhsdyf,
  124. a.yhyear,
  125. e.cbpqmc AS sscbpqmc,
  126. f.cbbmc AS sscbbmc
  127. FROM yh_khjbxx_dbhls a
  128. LEFT JOIN bm_cbpq e on a.sscbpq = e.cbpqbm
  129. LEFT JOIN bm_cbb f on a.sscbb = f.cbbbm
  130. where 1=1
  131. <!--模糊查询 -->
  132. <if test="filter.searchText!=null">
  133. AND ( a.yhbh like '%${filter.searchText}%'
  134. OR a.yhxm like '%${filter.searchText}%'
  135. OR a.yhdz like '%${filter.searchText}%'
  136. OR a.lxdh like '%${filter.searchText}%')
  137. </if>
  138. <!--所属公司-->
  139. <if test="filter.ssgs!=null">
  140. AND a.ssgs=#{filter.ssgs}
  141. </if>
  142. <!--所属片区-->
  143. <if test="filter.sscbpq!=null">
  144. AND a.sscbpq=#{filter.sscbpq}
  145. </if>
  146. <if test="filter.sscbb!=null">
  147. <choose>
  148. <when test="filter.sscbb.indexOf(',')!=-1">
  149. AND a.sscbb in
  150. <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
  151. close=")">
  152. #{item}
  153. </foreach>
  154. </when>
  155. <otherwise>
  156. AND a.sscbb=#{filter.sscbb}
  157. </otherwise>
  158. </choose>
  159. </if>
  160. <if test="filter.yhbhStart!=null">
  161. <![CDATA[ AND a.yhbh>=#{filter.yhbhStart} ]]>
  162. </if>
  163. <if test="filter.yhbhEnd!=null">
  164. <![CDATA[ AND a.yhbh<=#{filter.yhbhEnd} ]]>
  165. </if>
  166. <if test="filter.year!=null">
  167. AND a.yhyear=#{filter.year}
  168. </if>
  169. </sql>
  170. <!--查询未分配抄表本用户-->
  171. <sql id="querySql_cbbwfp">
  172. select
  173. a.*,
  174. b.cbpqmc sscbpqmc,
  175. c.cbbmc sscbbmc
  176. from
  177. yh_khjbxx a
  178. left join
  179. bm_cbpq b on a.sscbpq=b.cbpqbm
  180. left join
  181. bm_cbb c on a.sscbb = c.cbbbm
  182. where
  183. 1=1
  184. and
  185. a.sscbb is null
  186. <!--模糊查询 -->
  187. <if test="filter.searchText!=null">
  188. AND ( a.yhbh like '%${filter.searchText}%'
  189. OR a.yhxm like '%${filter.searchText}%'
  190. OR a.yhdz like '%${filter.searchText}%'
  191. OR a.lxdh like '%${filter.searchText}%')
  192. </if>
  193. <!--所属公司-->
  194. <if test="filter.ssgs!=null">
  195. AND a.ssgs=#{filter.ssgs}
  196. </if>
  197. <!--所属片区-->
  198. <if test="filter.sscbpq!=null">
  199. AND a.sscbpq=#{filter.sscbpq}
  200. </if>
  201. <if test="filter.sscbb!=null">
  202. <choose>
  203. <when test="filter.sscbb.indexOf(',')!=-1">
  204. AND a.sscbb in
  205. <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
  206. close=")">
  207. #{item}
  208. </foreach>
  209. </when>
  210. <otherwise>
  211. AND a.sscbb=#{filter.sscbb}
  212. </otherwise>
  213. </choose>
  214. </if>
  215. <if test="filter.cby!=null">
  216. AND c.cby=#{filter.cby}
  217. </if>
  218. <if test="filter.qyfzr!=null">
  219. AND c.qyfzr=#{filter.qyfzr}
  220. </if>
  221. order by
  222. a.yhbh asc
  223. </sql>
  224. <!--查询已分配抄表本用户-->
  225. <sql id="querySql_cbbyfp">
  226. select a.*,b.cbpqmc sscbpqmc,c.cbbmc sscbbmc from yh_khjbxx a
  227. left join bm_cbpq b on a.sscbpq=b.cbpqbm
  228. left join bm_cbb c on a.sscbb = c.cbbbm
  229. where 1=1 and sscbb is not null
  230. <!--模糊查询 -->
  231. <if test="filter.searchText!=null">
  232. AND ( a.yhbh like '%${filter.searchText}%'
  233. OR a.yhxm like '%${filter.searchText}%'
  234. OR a.yhdz like '%${filter.searchText}%'
  235. OR a.lxdh like '%${filter.searchText}%')
  236. </if>
  237. <!--所属公司-->
  238. <if test="filter.ssgs!=null">
  239. AND a.ssgs=#{filter.ssgs}
  240. </if>
  241. <!--所属片区-->
  242. <if test="filter.sscbpq!=null">
  243. AND a.sscbpq=#{filter.sscbpq}
  244. </if>
  245. <if test="filter.sscbb!=null">
  246. <choose>
  247. <when test="filter.sscbb.indexOf(',')!=-1">
  248. AND a.sscbb in
  249. <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
  250. close=")">
  251. #{item}
  252. </foreach>
  253. </when>
  254. <otherwise>
  255. AND a.sscbb=#{filter.sscbb}
  256. </otherwise>
  257. </choose>
  258. </if>
  259. <if test="filter.cby!=null">
  260. AND c.cby=#{filter.cby}
  261. </if>
  262. <if test="filter.qyfzr!=null">
  263. AND c.qyfzr=#{filter.qyfzr}
  264. </if>
  265. order by a.yhbh asc
  266. </sql>
  267. <!-- yh_cbkxx b on a.yhbh=b.yhbh -->
  268. <sql id="querySql">
  269. SELECT
  270. a.yhbh,a.ykhbh, a.yhxm,a.yhdz,a.lxdh, a.ssgs,a.sscbpq,a.sscbb,a.xb,a.sj,a.zzdh,a.gzdw,a.bgdh,
  271. a.dzyx,a.zjlb,a.zjhm,a.sqrq,
  272. a.jdrq,a.yhzt,a.rks,a.hzgx,a.zsjb,a.tsbz,a.tsrq,a.htqd,a.htqdrq,a.htbh,a.bz,a.bz1,a.bz_gcbh,a.bz_pcxlh,a.czrybm,a.czryxm,
  273. a.czsj,a.psfz,a.pht,a.pgszz,a.pyyzz,a.pyxzj,a.xydj,a.zw,a.jdrybm,a.jdryxm,a.jdpcxlh,a.sfqz,a.cbryxm,a.xh,
  274. a.ssregion,a.xgrybm,a.jtzqljl,a.fplx,
  275. (case
  276. when a.fplx='1' then '普票'
  277. when a.fplx='2' then '专票'
  278. else ''
  279. end) fplxmc,
  280. a.fp_name,
  281. a.fp_nsrsbh,
  282. a.fp_dz,
  283. a.fp_lxdh,
  284. a.fp_bankname,
  285. a.fp_bankcode,
  286. a.fp_bz,
  287. a.fffs,h.name AS fffsmc,
  288. a.khlb,a.pyjm,a.yljl, g.mc AS ssgsmc, e.cbpqmc AS sscbpqmc, f.cbbmc AS sscbbmc,
  289. d.name AS sblbmc,b.sbqs, b.sbbh,b.sblb,b.sbsccj,b.sbxh,b.sbkj,b.sblc,b.jddj,b.cbpl,b.bjwz,b.sbccrq,c.name ||
  290. (select '|'||name from bm_sj where code=b.sjbm1)||(select '|'||name from bm_sj where code=b.sjbm2)
  291. sjmc,k.scds,k.bcds,k.cbxh,
  292. nvl(j.yfje,0) yfje, nvl(j.kjje,0) kjje,
  293. nvl(j.syje,0) syje, nvl(j.nbsyje,0) nbsyje,
  294. a.khbm,a.ysdz,a.wybz
  295. FROM
  296. yh_khjbxx a
  297. LEFT JOIN yh_cbkxx b ON a.yhbh = b.yhbh AND b.cbkh='1'
  298. LEFT JOIN bm_sj c on b.sjbm=c.code
  299. LEFT JOIN bm_sblb d on b.sblb=d.code
  300. LEFT JOIN bm_cbpq e on a.sscbpq=e.cbpqbm
  301. LEFT JOIN bm_cbb f on a.sscbb=f.cbbbm
  302. LEFT JOIN bm_gs g on a.ssgs=g.bm
  303. LEFT JOIN bm_fffs h on a.fffs=h.code
  304. LEFT JOIN yy_cblr k on a.yhbh=k.yhbh and b.cbkh=k.cbkh
  305. LEFT JOIN yy_zjzh j on a.yhbh=j.yhbh
  306. WHERE
  307. 1=1
  308. <!--模糊查询 -->
  309. <if test="filter.searchText != null and filter.searchText != ''">
  310. AND (
  311. a.yhbh like '%${filter.searchText}%'
  312. OR a.yhxm like '%${filter.searchText}%'
  313. OR a.yhdz like '%${filter.searchText}%'
  314. OR a.lxdh like '%${filter.searchText}%'
  315. OR a.zjhm like '%${filter.searchText}%'
  316. OR a.htbh like '%${filter.searchText}%'
  317. OR b.sbbh like '%${filter.searchText}%'
  318. OR lower(a.pyjm) like '%${filter.searchText}%'
  319. OR instr(a.cym, '${filter.searchText}') > 0
  320. )
  321. </if>
  322. <!--所属公司-->
  323. <if test="filter.ssgs!=null">
  324. AND a.ssgs=#{filter.ssgs}
  325. </if>
  326. <!--所属片区-->
  327. <if test="filter.sscbpq!=null">
  328. AND a.sscbpq=#{filter.sscbpq}
  329. </if>
  330. <!--所属抄表本-->
  331. <if test="filter.sscbb!=null">
  332. <choose>
  333. <when test="filter.sscbb.indexOf(',')!=-1">
  334. AND a.sscbb in
  335. <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
  336. close=")">
  337. #{item}
  338. </foreach>
  339. </when>
  340. <otherwise>
  341. AND a.sscbb=#{filter.sscbb}
  342. </otherwise>
  343. </choose>
  344. </if>
  345. <if test="filter.cby!=null">
  346. AND f.cby=#{filter.cby}
  347. </if>
  348. <if test="filter.qyfzr!=null">
  349. AND f.qyfzr=#{filter.qyfzr}
  350. </if>
  351. <!-- 用水类型-->
  352. <if test="filter.yslx!=null">
  353. AND c.yslx=#{filter.yslx}
  354. </if>
  355. <!-- 用户状态-->
  356. <if test="filter.yhzt!=null">
  357. AND a.yhzt=#{filter.yhzt}
  358. </if>
  359. <!-- 水表类别-->
  360. <if test="filter.sblb!=null">
  361. AND b.sblb=#{filter.sblb}
  362. </if>
  363. <!-- 垃圾费标志-->
  364. <if test="filter.ljfbz!=null">
  365. AND b.ljfbz=#{filter.ljfbz}
  366. </if>
  367. <if test="filter.sbbh!=null">
  368. AND b.sbbh=#{filter.sbbh}
  369. </if>
  370. <if test="filter.ybdjbz!=null">
  371. AND b.ybdjbz=#{filter.ybdjbz}
  372. </if>
  373. <if test="filter.sjbm != null and filter.sjbm != ''">
  374. AND b.sjbm = #{filter.sjbm}
  375. </if>
  376. <if test="filter.sbkj!=null">
  377. AND b.sbkj=#{filter.sbkj}
  378. </if>
  379. <!--建档日期-->
  380. <if test="filter.jdrqStart!=null and filter.jdrqEnd!=null">
  381. AND TRUNC(a.jdrq) BETWEEN #{filter.jdrqStart} AND
  382. #{filter.jdrqEnd}
  383. </if>
  384. <if test="filter.yhbhStart!=null">
  385. <![CDATA[ AND a.yhbh>=#{filter.yhbhStart} ]]>
  386. </if>
  387. <if test="filter.yhbhEnd!=null">
  388. <![CDATA[ AND a.yhbh<=#{filter.yhbhEnd} ]]>
  389. </if>
  390. <!-- 用户姓名-->
  391. <if test="filter.yhxm!=null">
  392. AND a.yhxm=#{filter.yhxm}
  393. </if>
  394. <!-- 用户编号-->
  395. <if test="filter.yhbh!=null">
  396. AND a.yhbh=#{filter.yhbh}
  397. </if>
  398. <!-- 用户地址-->
  399. <if test="filter.yhdz!=null">
  400. AND a.yhdz=#{filter.yhdz}
  401. </if>
  402. <!-- 联系电话-->
  403. <if test="filter.lxdh!=null">
  404. AND a.lxdh=#{filter.lxdh}
  405. </if>
  406. <!-- 是否分配抄表本(册)-->
  407. <if test="filter.sffpcbb!=null">
  408. <if test="filter.sffpcbb">
  409. AND a.sscbb IS NOT NULL
  410. </if>
  411. <if test="!filter.sffpcbb">
  412. AND a.sscbb IS NULL
  413. </if>
  414. </if>
  415. <if test="filter.ffgxzh!=null">
  416. AND a.yhbh in (select yhbh_fb from yh_ffgx where yhbh_zb=#{filter.ffgxzh})
  417. </if>
  418. <if test="filter.ffgxbz!=null and filter.ffgxbz==1">
  419. AND a.yhbh in (select yhbh_zb from yh_ffgx)
  420. </if>
  421. <if test="filter.htqdrqStart!=null and filter.htqdrqEnd!=null">
  422. AND TRUNC(a.htqdrq) BETWEEN #{filter.htqdrqStart} AND #{filter.htqdrqEnd}
  423. </if>
  424. <if test="filter.htbh!=null">
  425. AND a.htbh=#{filter.htbh}
  426. </if>
  427. <if test="filter.zjhm!=null">
  428. AND a.zjhm=#{filter.zjhm}
  429. </if>
  430. <if test="filter.sfqdht!=null">
  431. AND a.htqd=#{filter.sfqdht}
  432. </if>
  433. <if test="filter.khlb!=null">
  434. AND a.khlb=#{filter.khlb}
  435. </if>
  436. <if test='filter.khbm != null and filter.khbm != ""'>
  437. AND (a.khbm like '${filter.khbm}%' or a.yhxm like '%${filter.khbm}%' or LOWER(a.pyjm) like LOWER('%${filter.khbm}%'))
  438. AND a.ZHBZ='1'
  439. </if>
  440. <if test="filter.dxh != null">
  441. AND a.dxh = #{filter.dxh}
  442. </if>
  443. <!-- <if test="filter.userId != null">-->
  444. <!-- AND a.sscbb in(select cbbbm from yh_sjqx where user_id=#{filter.userId})-->
  445. <!-- </if>-->
  446. ORDER BY a.yhbh asc
  447. <!-- <if test="filter.jdrqdxpx != null and filter.jdrqdxpx == 1">-->
  448. <!-- ORDER BY jdrq DESC NULLS LAST-->
  449. <!-- </if>-->
  450. </sql>
  451. <select id="getUserInfoPage" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect2">
  452. SELECT a.yhbh, a.ykhbh, a.yhxm, a.yhdz, a.lxdh, a.ssgs,a.sscbpq,a.sscbb,a.xb, a.sj,a.zzdh,a.gzdw,a.bgdh,
  453. a.dzyx,a.zjlb,a.zjhm,a.sqrq,
  454. a.jdrq,a.yhzt,a.rks,a.hzgx,a.zsjb,a.tsbz,a.tsrq,a.htqd,a.htqdrq,a.htbh,a.bz,a.bz_gcbh,a.bz_pcxlh,a.czrybm,a.czryxm,
  455. a.czsj,a.psfz,a.pht,a.pgszz,a.pyyzz,a.pyxzj,a.xydj,a.zw,a.jdrybm,a.jdryxm,a.jdpcxlh,a.sfqz,a.cbryxm,a.xh,
  456. a.ssregion,a.xgrybm,a.jtzqljl,a.fplx,
  457. (case
  458. when a.fplx='0' then '普票'
  459. when a.fplx='1' then '专票'
  460. when a.fplx='2' then '收据'
  461. else '其它'
  462. end) fplxmc,
  463. a.fp_name,a.fp_nsrsbh,a.fp_dz,a.fp_lxdh,a.fp_bankname,a.fp_bankcode,a.fp_bz,
  464. a.fffs,h.name AS fffsmc,
  465. a.khlb,a.pyjm,a.yljl, g.mc AS ssgsmc, e.cbpqmc AS sscbpqmc, f.cbbmc AS sscbbmc,
  466. d.name AS sblbmc,b.sbqs, b.sbbh,b.sblb,b.sbsccj,b.sbxh,b.sbkj,b.sblc,b.jddj,b.cbpl,b.bjwz,b.sbccrq,c.name
  467. sjmc,k.scds,k.bcds,k.cbxh,
  468. nvl(j.yfje,0) yfje, nvl(j.kjje,0) kjje, nvl(j.syje,0) syje, nvl(j.nbsyje,0) nbsyje,a.khbm,
  469. (case
  470. when l.yhbh >' ' then '1'
  471. else '0'
  472. end
  473. ) qzhgxbz
  474. FROM yh_khjbxx a
  475. LEFT JOIN yh_cbkxx b on a.yhbh=b.yhbh
  476. LEFT JOIN bm_sj c on b.sjbm=c.code
  477. LEFT JOIN bm_sblb d on b.sblb=d.code
  478. LEFT JOIN bm_cbpq e on a.sscbpq=e.cbpqbm
  479. LEFT JOIN bm_cbb f on a.sscbb=f.cbbbm
  480. LEFT JOIN bm_gs g on a.ssgs=g.bm
  481. LEFT JOIN bm_fffs h on a.fffs=h.code
  482. LEFT JOIN yy_cblr k on a.yhbh=k.yhbh and b.cbkh=k.cbkh
  483. LEFT JOIN yy_zjzh j on a.yhbh=j.yhbh
  484. LEFT JOIN (select yhbh from (
  485. select yhbh from yh_group
  486. union
  487. select yhbh from yh_group_accounts))l on a.yhbh=l.yhbh
  488. WHERE 1=1
  489. <if test="filter.searchText != null and filter.searchText != ''">
  490. AND ( a.yhbh like '%${filter.searchText}%'
  491. OR a.yhxm like '%${filter.searchText}%'
  492. OR a.yhdz like '%${filter.searchText}%'
  493. OR a.lxdh like '%${filter.searchText}%'
  494. OR a.zjhm like '%${filter.searchText}%'
  495. OR a.htbh like '%${filter.searchText}%'
  496. OR b.sbbh like '%${filter.searchText}%'
  497. OR lower(a.pyjm) like '%${filter.searchText}%'
  498. OR instr(a.cym, '${filter.searchText}') > 0
  499. )
  500. </if>
  501. <!--所属公司-->
  502. <if test="filter.ssgs!=null">
  503. AND a.ssgs=#{filter.ssgs}
  504. </if>
  505. <!--所属片区-->
  506. <if test="filter.sscbpq!=null">
  507. AND a.sscbpq=#{filter.sscbpq}
  508. </if>
  509. <!--所属抄表本-->
  510. <if test="filter.sscbb!=null">
  511. <choose>
  512. <when test="filter.sscbb.indexOf(',')!=-1">
  513. AND a.sscbb in
  514. <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
  515. close=")">
  516. #{item}
  517. </foreach>
  518. </when>
  519. <otherwise>
  520. AND a.sscbb=#{filter.sscbb}
  521. </otherwise>
  522. </choose>
  523. </if>
  524. </select>
  525. <select id="getPage_cbbwfp" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect">
  526. <include refid="querySql_cbbwfp"></include>
  527. </select>
  528. <select id="getPage_cbbyfp" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect">
  529. <include refid="querySql_cbbyfp"></include>
  530. </select>
  531. <!--自定义用户档案分页查询 -->
  532. <select id="getPage" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect">
  533. <include refid="querySql"></include>
  534. </select>
  535. <select id="getPage2" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect2">
  536. <include refid="querySql"/>
  537. </select>
  538. <select id="getList" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect2">
  539. <include refid="querySql"></include>
  540. <if test="filter.orders!=null and filter.orders.size()>0">
  541. ORDER BY
  542. <foreach collection="filter.orders" item="o" separator=",">
  543. ${o.column}
  544. <if test="!o.asc">DESC</if>
  545. </foreach>
  546. </if>
  547. </select>
  548. <select id="getFfgxPage" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxFfgxzSelect">
  549. select
  550. g.mc AS ssgsmc, e.cbpqmc AS sscbpqmc, f.cbbmc AS sscbbmc,
  551. a.yhbh, a.yhxm, a.yhdz, a.lxdh,
  552. a.fp_name fpName, a.fp_nsrsbh fpNsrsbh, a.fp_dz fpDz,a.fp_lxdh fpLxdh,
  553. a.fp_bankname fpBankname, a.fp_bankcode fpBankcode, a.fp_bz fpBz,
  554. (select count(1) from yh_ffgx where yhbh_zb=a.yhbh_zb) yhsl,
  555. b.czryxm ,b.czsj
  556. from yh_ffgx b
  557. left join yh_khjbxx a on a.yhbh=b.yhbh_zb and b.yhbh_fb=b.yhbh_zb
  558. left join bm_cbpq e on a.sscbpq=e.cbpqbm
  559. left join bm_cbb f on a.sscbb=f.cbbbm
  560. left join bm_gs g on a.ssgs=g.bm
  561. <where>
  562. <if test="filter.searchText!=null">
  563. AND ( a.yhbh='${filter.searchText}'
  564. OR a.yhxm like '%${filter.searchText}%'
  565. OR a.yhdz like '%${filter.searchText}%'
  566. OR a.lxdh like '%${filter.searchText}%')
  567. </if>
  568. <!--所属公司-->
  569. <if test="filter.ssgs!=null">
  570. AND a.ssgs=#{filter.ssgs}
  571. </if>
  572. <!--所属片区-->
  573. <if test="filter.sscbpq!=null">
  574. AND a.sscbpq=#{filter.sscbpq}
  575. </if>
  576. <!--所属抄表本-->
  577. <if test="filter.sscbb!=null">
  578. <choose>
  579. <when test="filter.sscbb.indexOf(',')!=-1">
  580. AND a.sscbb in
  581. <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
  582. close=")">
  583. #{item}
  584. </foreach>
  585. </when>
  586. <otherwise>
  587. AND a.sscbb=#{filter.sscbb}
  588. </otherwise>
  589. </choose>
  590. </if>
  591. </where>
  592. </select>
  593. <!--自定义用户档案查询page -->
  594. <!-- //用户编号、用户姓名、用户地址、联系电话
  595. //片区、抄表本、水表型号、用水性质、用户状态、是否垃圾费、建档日期、抄表人员 -->
  596. <select id="selectDaCustomerPage" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect2">
  597. select distinct a.yhbh yhbh,a.ykhbh ykhbh ,a.ssgs ssgs,a.sscbpq sscbpq,a.sscbb sscbb, k.mc ssgsmc, c.cbpqmc
  598. sscbpqmc ,d.cbbmc sscbbmc, a.yhxm
  599. yhxm,a.yhdz yhdz,a.lxdh lxdh,a.sqrq sqrq,a.sj sj,a.zzdh zzdh,a.dzyx dzyx,a.xb xb
  600. ,a.jdrq jdrq,a.czryxm czryxm,b.sbbh sbbb, nvl(a.sbsl,0) sbsl
  601. ,a.yhzt yhzt,a.zjlb zjlb,a.zjhm zjhm, nvl(e.scds,0) scds,nvl(e.bcds,0) bcds,b.cbkid cbkid
  602. ,f.name sjmc,g.name sblbmc
  603. from yh_khjbxx a inner join yh_cbkxx b on a.yhbh=b.yhbh
  604. left join bm_gs k on a.ssgs =k.bm
  605. left join bm_cbpq c on a.sscbb=c.cbpqbm left join bm_cbb d on a.sscbb=d.cbbbm
  606. left join yy_cblr e on a.yhbh=e.yhbh and b.cbkh=e.cbkh
  607. left join bm_sj f on b.sjbm=f.code
  608. left join bm_sbxh g on b.sblb=g.code
  609. where 1=1
  610. <!--模糊查询 -->
  611. <if test="searchText != null and searchText != ''">
  612. and ( a.yhbh like '%${searchText}%' or a.yhxm like '%${searchText}%' or a.yhdz like
  613. '%${searchText}%' or a.lxdh like '%${searchText}%' )
  614. </if>
  615. <!--片区 -->
  616. <if test="sscbb !=null and sscbb!='' and sscbb!='all' ">
  617. and a.sscbb=#{sscbb}
  618. </if>
  619. <!--抄表本 -->
  620. <if test="sscbb !=null and sscbb!='' and sscbb!='all'">
  621. and a.sscbb=#{sscbb}
  622. </if>
  623. <!--水表型号 -->
  624. <if test="sblb !=null and sblb!='' and sblb!='all'">
  625. and b.sblb=#{sblb}
  626. </if>
  627. <!--用水性质-->
  628. <if test="sjbm !=null and sjbm!='' and sjbm!='all'">
  629. and b.sjbm=#{sjbm}
  630. </if>
  631. <!-- 用户状态-->
  632. <if test="yhzt!=null and yhzt!=''">
  633. and a.yhzt=#{yhzt}
  634. </if>
  635. <!-- 是否垃圾费-->
  636. <if test="ljfbz!=null and ljfbz!=''">
  637. and b.ljfbz=#{ljfbz}
  638. </if>
  639. <!--抄表人员> -->
  640. <if test="cbry!=null and cbry!='' and cbry!='all' ">
  641. and d.cby=#{cbry}
  642. </if>
  643. <!--建档日期-->
  644. <if test="ksrq!=null and ksrq!='' and jsrq!=null and jsrq!='' ">
  645. and Trunc(a.jdrq) BETWEEN to_date(#{ksrq},'yyyy-mm-dd hh24:mi:ss') and to_date(#{jsrq},'yyyy-mm-dd
  646. hh24:mi:ss')
  647. </if>
  648. <!--公司 -->
  649. <if test="ssgs!=null and ssgs!='' and ssgs!='all'">
  650. and a.ssgs=#{ssgs}
  651. </if>
  652. </select>
  653. <select id="getZnbDaPage" resultType="com.tofly.feesapi.znbgl.entity.vo.ZnbYhdaSelect">
  654. SELECT a.yhbh, a.yhxm, a.yhdz,a.lxdh,
  655. b.sbbh AS sbbh,
  656. (select NBSYJE from yy_zjzh where yhbh=a.yhbh) bjye,
  657. da.cl_cljg tbbz,
  658. decode(zl.cl_cljg, '0', '1', decode(zl.ZLVALUE,'true','0','2')) fmzt,
  659. f.cbbmc AS sscbbmc,
  660. g.cbpqmc AS sscbpqmc,
  661. d.name AS sblbmc,
  662. h.name AS bjcjmc
  663. FROM yh_khjbxx a
  664. LEFT JOIN yh_cbkxx b ON a.yhbh = b.yhbh and b.jfzt='1'
  665. LEFT JOIN bm_sblb d ON b.sblb = d.code
  666. LEFT JOIN bm_cbb f ON a.sscbb = f.cbbbm
  667. LEFT JOIN bm_cbpq g ON a.sscbpq = g.cbpqbm
  668. LEFT JOIN bm_sbsccj h on b.sbsccj=h.code
  669. LEFT JOIN (
  670. select * from(
  671. select a.*,row_number() over (partition by YHBH,CBKH order by CZSJ desc) as rn from
  672. znb_da_log a)
  673. where rn=1
  674. ) da ON b.yhbh=da.yhbh and b.cbkh=da.cbkh
  675. LEFT JOIN (
  676. select * from(
  677. select a.*,row_number() over (partition by YHBH,CBKH order by CZSJ desc) as rn from
  678. znb_zl_log a
  679. where a.zltype='1'
  680. )
  681. where rn=1
  682. ) zl ON b.yhbh=zl.yhbh and b.cbkh=zl.cbkh
  683. WHERE 1=1 AND b.sblb in ('2','3')
  684. <!--模糊查询 -->
  685. <if test="filter.searchText!=null">
  686. AND (a.yhbh like '%${filter.searchText}%'
  687. OR a.yhxm like '%${filter.searchText}%'
  688. OR a.yhdz like '%${filter.searchText}%'
  689. OR a.lxdh like '%${filter.searchText}%')
  690. </if>
  691. <!--所属公司-->
  692. <if test="filter.ssgs!=null">
  693. AND a.ssgs=#{filter.ssgs}
  694. </if>
  695. <!--所属片区-->
  696. <if test="filter.sscbpq!=null">
  697. AND a.sscbpq=#{filter.sscbpq}
  698. </if>
  699. <!--所属抄表本-->
  700. <if test="filter.sscbb!=null">
  701. <choose>
  702. <when test="filter.sscbb.indexOf(',')!=-1">
  703. AND a.sscbb in
  704. <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
  705. close=")">
  706. #{item}
  707. </foreach>
  708. </when>
  709. <otherwise>
  710. AND a.sscbb=#{filter.sscbb}
  711. </otherwise>
  712. </choose>
  713. </if>
  714. </select>
  715. <select id="getNdjtslxx" resultType="com.tofly.feesapi.mxcx.entity.vo.YhNdjtslSelect">
  716. select * from(
  717. select
  718. a.yhbh,
  719. a.yhxm,
  720. a.yhdz,
  721. to_char(sysdate,'yyyy') year,
  722. d.name ysxz,
  723. a.rks as rksl,
  724. c.jtxh,
  725. a.jtzqljl as ndljl,
  726. c.jtzs,
  727. c.jtrksl,
  728. c.jtrkjs
  729. from yh_khjbxx a,yh_cbkxx b
  730. left join (
  731. select code,'1' jtxh,jt1_zs as jtzs,jtrksl,jtrkjs,jtbz,jtjslx from bm_sj where jtbz='1' and jtjslx='2'
  732. union all
  733. select code,'2' jtxh,jt2_zs as jtzs,jtrksl,jtrkjs,jtbz,jtjslx from bm_sj where jtbz='1' and jtjslx='2'
  734. union all
  735. select code,'3' jtxh,jt3_zs as jtzs,jtrksl,jtrkjs,jtbz,jtjslx from bm_sj where jtbz='1' and jtjslx='2'
  736. ) c on c.code=b.sjbm
  737. left join bm_yslx d on b.yslx=d.code
  738. where a.yhbh=b.yhbh and c.jtbz='1' and c.jtjslx='2'
  739. <if test="yhbh!=null">
  740. and a.yhbh=#{yhbh}
  741. </if>
  742. )
  743. </select>
  744. <select id="getwjPage" resultType="com.tofly.feesapi.mxcx.entity.vo.YhwjSelect">
  745. select c.yhbh,
  746. c.yhxm,
  747. a.file_name as wjmc,
  748. a.file_type as wjlx,
  749. a.file_url as image,
  750. to_char(a.czsj,'yyyy-mm-dd hh24:mi:ss') as scsj,
  751. a.CZRYXM as scrymx
  752. from yh_doc_usb_files a
  753. left join yh_doc_files b on a.files_id=b.id
  754. left join yh_khjbxx c on b.yhbh=c.yhbh
  755. <where>
  756. <if test="filter.yhbh!=null">
  757. and c.yhbh=#{filter.yhbh}
  758. </if>
  759. <if test="filter.startczsj!=null and filter.endczsj!=null">
  760. AND a.czsj BETWEEN #{filter.startczsj} AND #{filter.endczsj}
  761. </if>
  762. <if test="filter.wjlx!=null">
  763. and a.file_type=#{filter.wjlx}
  764. </if>
  765. </where>
  766. </select>
  767. <select id="xzyhtj" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxXzyhSelect">
  768. select ysxzmc,
  769. ssgsmc,
  770. sum(sbkj15) sbkj15,
  771. sum(sbkj20) sbkj20,
  772. sum(sbkj25) sbkj25,
  773. sum(sbkj30) sbkj30,
  774. sum(sbkj32) sbkj32,
  775. sum(sbkj40) sbkj40,
  776. sum(sbkj50) sbkj50,
  777. sum(sbkj65) sbkj65,
  778. sum(sbkj75) sbkj75,
  779. sum(sbkj80) sbkj80,
  780. sum(sbkj90) sbkj90,
  781. sum(sbkj100) sbkj100,
  782. sum(sbkj110) sbkj110,
  783. sum(sbkj150) sbkj150,
  784. sum(sbkj160) sbkj160,
  785. sum(sbkj200) sbkj200,
  786. sum(sbkj300) sbkj300
  787. from (select a.name as ysxzmc,
  788. d.ssgs as ssgsmc,
  789. (case
  790. when e.cccode = '15' then 1
  791. else 0
  792. end) as sbkj15,
  793. (case
  794. when e.cccode = '20' then 1
  795. else 0
  796. end) as sbkj20,
  797. (case
  798. when e.cccode = '25' then 1
  799. else 0
  800. end) as sbkj25,
  801. (case
  802. when e.cccode = '30' then 1
  803. else 0
  804. end) as sbkj30,
  805. (case
  806. when e.cccode = '32' then 1
  807. else 0
  808. end) as sbkj32,
  809. (case
  810. when e.cccode = '40' then 1
  811. else 0
  812. end) as sbkj40,
  813. (case
  814. when e.cccode = '50' then 1
  815. else 0
  816. end) as sbkj50,
  817. (case
  818. when e.cccode = '65' then 1
  819. else 0
  820. end) as sbkj65,
  821. (case
  822. when e.cccode = '75' then 1
  823. else 0
  824. end) as sbkj75,
  825. (case
  826. when e.cccode = '80' then 1
  827. else 0
  828. end) as sbkj80,
  829. (case
  830. when e.cccode = '90' then 1
  831. else 0
  832. end) as sbkj90,
  833. (case
  834. when e.cccode = '100' then 1
  835. else 0
  836. end) as sbkj100,
  837. (case
  838. when e.cccode = '110' then 1
  839. else 0
  840. end) as sbkj110,
  841. (case
  842. when e.cccode = '150' then 1
  843. else 0
  844. end) as sbkj150,
  845. (case
  846. when e.cccode = '160' then 1
  847. else 0
  848. end) as sbkj160,
  849. (case
  850. when e.cccode = '200' then 1
  851. else 0
  852. end) as sbkj200,
  853. (case
  854. when e.cccode = '300' then 1
  855. else 0
  856. end) as sbkj300
  857. from bm_yslx a
  858. left join bm_sj b on a.code = b.yslx
  859. left join yh_cbkxx c on b.code = c.sjbm
  860. left join yh_khjbxx d on c.yhbh = d.yhbh
  861. left join sys_child_code e on c.sbkj = e.cccode and e.pcid = '12'
  862. <where>
  863. <if test="filter.ssgs!=null and filter.ssgs!=''">
  864. and d.ssgs=#{filter.ssgs}
  865. </if>
  866. <if test="filter.sscbpq!=null and filter.sscbpq!=''">
  867. and d.sscbpq=#{filter.sscbpq}
  868. </if>
  869. <if test="filter.sscbb!=null and filter.sscbb!=''">
  870. and d.sscbb=#{filter.sscbb}
  871. </if>
  872. <if test="filter.jdrqStart!=null and filter.jdrqStart!='' and filter.jdrqEnd!=null and filter.jdrqEnd!=''">
  873. AND to_char(d.jdrq,'yyyyMM') BETWEEN #{filter.jdrqStart} AND #{filter.jdrqEnd}
  874. </if>
  875. </where>
  876. ) a
  877. group by ysxzmc,ssgsmc
  878. </select>
  879. <select id="getYhxx" resultType="com.tofly.feesapi.yhgl.entity.vo.Yhkhqbxx">
  880. select a.*,
  881. b.*,
  882. gs.mc as gsmc,
  883. cbpq.cbpqmc as cbpqmc,
  884. cbb.cbbmc as cbbmc,
  885. sblb.name as sblbmc,
  886. sbsccj.name as cbsccjmc,
  887. sbkj.ccname as sbkjmc,
  888. sblc.ccname as sblcmc,
  889. jddj.ccname as jddjmc,
  890. bjwz.ccname as bjwzmc,
  891. sj.name as sjmc,
  892. sj1.name as sj1mc,
  893. yslx.name as ysxzmc
  894. from yh_khjbxx a
  895. left join yh_cbkxx b on a.yhbh = b.yhbh and chkh = '1'
  896. left join bm_gs gs on a.ssgs = gs.bm
  897. left join bm_cbpq cbpq on a.sscbpq = cbpq.cbpqbm
  898. left join bm_cbb cbb on a.sscbb = cbb.cbbbm
  899. left join bm_sblb sblb on b.sblb = sblb.code
  900. left join bm_sbsccj sbsccj on b.sbsccj = sbsccj.code
  901. left join sys_child_code sbkj on b.sbkj = sbkj.cccode and sbkj.pcid = '12'
  902. left join sys_child_code sblc on b.sbkj = sblc.cccode and sblc.pcid = '13'
  903. left join sys_child_code jddj on b.sbkj = jddj.cccode and jddj.pcid = '14'
  904. left join sys_child_code bjwz on b.sbkj = bjwz.cccode and bjwz.pcid = '15'
  905. left join bm_sj sj on b.sjbm = sj.code
  906. left join bm_sj sj1 on b.sjbm1 = sj1.code
  907. left join bm_yslx yslx on sj.yslx = yslx.code
  908. where a.yhbh = #{yhbh}
  909. </select>
  910. </mapper>