| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.tofly.feesapi.yhgl.mapper.YhKhjbxxMapper">
- <!--自定义获取用户最大yhbh -->
- <select id="selectMaxYhbh_jk" resultType="int">
- SELECT nvl(max(yhbh), 0)
- from yh_khjbxx
- where yhbh like '3%'
- </select>
- <select id="selectMaxYhbh_fjk" resultType="int">
- SELECT nvl(max(yhbh), 0)
- from yh_khjbxx
- where yhbh like '2%'
- </select>
- <!--自定义获取用户是否存在 -->
- <select id="selectExistYhbh" resultType="int">
- SELECT COUNT(0) sl
- FROM yh_khjbxx
- WHERE yhbh = #{yhbh}
- </select>
- <!--查询当前财务日期cwrq -->
- <select id="selectCwrq" resultType="java.util.Map">
- select cwrq
- from sys_gdcsb
- where gdbz = '0'
- </select>
- <!--查询用户余额 -->
- <select id="selectUserBalance" resultType="java.util.Map">
- SELECT yhbh, nvl(yfje, 0) yfje, nvl(kjje, 0) kjje, nvl(syje, 0) syje, nvl(nbsyje, 0) nbsyje
- FROM yy_zjzh
- WHERE yhbh = #{yhbh}
- </select>
- <!-- 查询当前用户是否存在多只表 -->
- <select id="selectCbkh" resultType="com.tofly.feesapi.yhgl.entity.dto.CbkxxDto">
- SELECT cbkh,
- cbkid,
- jfzt
- FROM yh_cbkxx
- WHERE yhbh = #{yhbh}
- </select>
- <!-- 水表档案是否存在-->
- <select id="selectExistCbkxx" resultType="int">
- SELECT COUNT(0) sl
- FROM yh_cbkxx
- WHERE yhbh = #{yhbh}
- </select>
- <select id="selectYhDa" resultType="com.tofly.feesapi.yhgl.entity.Yhkhjbxx2">
- select a.*, e.cbpqmc AS sscbpqmc, f.cbbmc AS sscbbmc
- FROM yh_khjbxx a
- LEFT JOIN bm_cbpq e on a.sscbpq = e.cbpqbm
- LEFT JOIN bm_cbb f on a.sscbb = f.cbbbm
- WHERE a.yhbh = #{yhbh}
- </select>
- <select id="getYhDbhxxPage" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxDbhSelect">
- <include refid="yhkhjbxx_dbhsql"></include>
- union all
- <include refid="dbhsql"></include>
- </select>
- <sql id="yhkhjbxx_dbhsql">
- select
- a.yhbh,
- a.yhxm,
- a.yhdz,
- a.lxdh,
- a.dbhndljl,
- b.sdsl as dbhyhsdsl,
- b.sdys as dbhyhsdyf,
- to_char(sysdate,'yyyyMM')as yhyear,
- e.cbpqmc as sscbpqmc,
- f.cbbmc as sscbbmc
- from yh_khjbxx a
- left join bm_cbpq e on a.sscbpq = e.cbpqbm
- left join bm_cbb f on a.sscbb = f.cbbbm
- left join bm_dbhysyh b on b.year= to_char(sysdate,'yyyy')
- where 1=1 and khlb='2'
- <!--模糊查询 -->
- <if test="filter.searchText!=null">
- AND ( a.yhbh like '%${filter.searchText}%'
- OR a.yhxm like '%${filter.searchText}%'
- OR a.yhdz like '%${filter.searchText}%'
- OR a.lxdh like '%${filter.searchText}%')
- </if>
- <!--所属公司-->
- <if test="filter.ssgs!=null">
- AND a.ssgs=#{filter.ssgs}
- </if>
- <!--所属片区-->
- <if test="filter.sscbpq!=null">
- AND a.sscbpq=#{filter.sscbpq}
- </if>
- <if test="filter.sscbb!=null">
- <choose>
- <when test="filter.sscbb.indexOf(',')!=-1">
- AND a.sscbb in
- <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
- close=")">
- #{item}
- </foreach>
- </when>
- <otherwise>
- AND a.sscbb=#{filter.sscbb}
- </otherwise>
- </choose>
- </if>
- <if test="filter.yhbhStart!=null">
- <![CDATA[ AND a.yhbh>=#{filter.yhbhStart} ]]>
- </if>
- <if test="filter.yhbhEnd!=null">
- <![CDATA[ AND a.yhbh<=#{filter.yhbhEnd} ]]>
- </if>
- <if test="filter.year!=null">
- AND to_char(sysdate,'yyyyMM')=#{filter.year}
- </if>
- </sql>
- <sql id="dbhsql">
- select
- a.yhbh,
- a.yhxm,
- a.yhdz,
- a.lxdh,
- a.dbhndljl,
- a.dbhyhsdsl,
- a.dbhyhsdyf,
- a.yhyear,
- e.cbpqmc AS sscbpqmc,
- f.cbbmc AS sscbbmc
- FROM yh_khjbxx_dbhls a
- LEFT JOIN bm_cbpq e on a.sscbpq = e.cbpqbm
- LEFT JOIN bm_cbb f on a.sscbb = f.cbbbm
- where 1=1
- <!--模糊查询 -->
- <if test="filter.searchText!=null">
- AND ( a.yhbh like '%${filter.searchText}%'
- OR a.yhxm like '%${filter.searchText}%'
- OR a.yhdz like '%${filter.searchText}%'
- OR a.lxdh like '%${filter.searchText}%')
- </if>
- <!--所属公司-->
- <if test="filter.ssgs!=null">
- AND a.ssgs=#{filter.ssgs}
- </if>
- <!--所属片区-->
- <if test="filter.sscbpq!=null">
- AND a.sscbpq=#{filter.sscbpq}
- </if>
- <if test="filter.sscbb!=null">
- <choose>
- <when test="filter.sscbb.indexOf(',')!=-1">
- AND a.sscbb in
- <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
- close=")">
- #{item}
- </foreach>
- </when>
- <otherwise>
- AND a.sscbb=#{filter.sscbb}
- </otherwise>
- </choose>
- </if>
- <if test="filter.yhbhStart!=null">
- <![CDATA[ AND a.yhbh>=#{filter.yhbhStart} ]]>
- </if>
- <if test="filter.yhbhEnd!=null">
- <![CDATA[ AND a.yhbh<=#{filter.yhbhEnd} ]]>
- </if>
- <if test="filter.year!=null">
- AND a.yhyear=#{filter.year}
- </if>
- </sql>
- <!--查询未分配抄表本用户-->
- <sql id="querySql_cbbwfp">
- select
- a.*,
- b.cbpqmc sscbpqmc,
- c.cbbmc sscbbmc
- from
- yh_khjbxx a
- left join
- bm_cbpq b on a.sscbpq=b.cbpqbm
- left join
- bm_cbb c on a.sscbb = c.cbbbm
- where
- 1=1
- and
- a.sscbb is null
- <!--模糊查询 -->
- <if test="filter.searchText!=null">
- AND ( a.yhbh like '%${filter.searchText}%'
- OR a.yhxm like '%${filter.searchText}%'
- OR a.yhdz like '%${filter.searchText}%'
- OR a.lxdh like '%${filter.searchText}%')
- </if>
- <!--所属公司-->
- <if test="filter.ssgs!=null">
- AND a.ssgs=#{filter.ssgs}
- </if>
- <!--所属片区-->
- <if test="filter.sscbpq!=null">
- AND a.sscbpq=#{filter.sscbpq}
- </if>
- <if test="filter.sscbb!=null">
- <choose>
- <when test="filter.sscbb.indexOf(',')!=-1">
- AND a.sscbb in
- <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
- close=")">
- #{item}
- </foreach>
- </when>
- <otherwise>
- AND a.sscbb=#{filter.sscbb}
- </otherwise>
- </choose>
- </if>
- <if test="filter.cby!=null">
- AND c.cby=#{filter.cby}
- </if>
- <if test="filter.qyfzr!=null">
- AND c.qyfzr=#{filter.qyfzr}
- </if>
- order by
- a.yhbh asc
- </sql>
- <!--查询已分配抄表本用户-->
- <sql id="querySql_cbbyfp">
- select a.*,b.cbpqmc sscbpqmc,c.cbbmc sscbbmc from yh_khjbxx a
- left join bm_cbpq b on a.sscbpq=b.cbpqbm
- left join bm_cbb c on a.sscbb = c.cbbbm
- where 1=1 and sscbb is not null
- <!--模糊查询 -->
- <if test="filter.searchText!=null">
- AND ( a.yhbh like '%${filter.searchText}%'
- OR a.yhxm like '%${filter.searchText}%'
- OR a.yhdz like '%${filter.searchText}%'
- OR a.lxdh like '%${filter.searchText}%')
- </if>
- <!--所属公司-->
- <if test="filter.ssgs!=null">
- AND a.ssgs=#{filter.ssgs}
- </if>
- <!--所属片区-->
- <if test="filter.sscbpq!=null">
- AND a.sscbpq=#{filter.sscbpq}
- </if>
- <if test="filter.sscbb!=null">
- <choose>
- <when test="filter.sscbb.indexOf(',')!=-1">
- AND a.sscbb in
- <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
- close=")">
- #{item}
- </foreach>
- </when>
- <otherwise>
- AND a.sscbb=#{filter.sscbb}
- </otherwise>
- </choose>
- </if>
- <if test="filter.cby!=null">
- AND c.cby=#{filter.cby}
- </if>
- <if test="filter.qyfzr!=null">
- AND c.qyfzr=#{filter.qyfzr}
- </if>
- order by a.yhbh asc
- </sql>
- <!-- yh_cbkxx b on a.yhbh=b.yhbh -->
- <sql id="querySql">
- 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,
- a.dzyx,a.zjlb,a.zjhm,a.sqrq,
- 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,
- 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,
- a.ssregion,a.xgrybm,a.jtzqljl,a.fplx,
- (case
- when a.fplx='1' then '普票'
- when a.fplx='2' then '专票'
- else ''
- end) fplxmc,
- a.fp_name,
- a.fp_nsrsbh,
- a.fp_dz,
- a.fp_lxdh,
- a.fp_bankname,
- a.fp_bankcode,
- a.fp_bz,
- a.fffs,h.name AS fffsmc,
- a.khlb,a.pyjm,a.yljl, g.mc AS ssgsmc, e.cbpqmc AS sscbpqmc, f.cbbmc AS sscbbmc,
- 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 ||
- (select '|'||name from bm_sj where code=b.sjbm1)||(select '|'||name from bm_sj where code=b.sjbm2)
- sjmc,k.scds,k.bcds,k.cbxh,
- nvl(j.yfje,0) yfje, nvl(j.kjje,0) kjje,
- nvl(j.syje,0) syje, nvl(j.nbsyje,0) nbsyje,
- a.khbm,a.ysdz,a.wybz
- FROM
- yh_khjbxx a
- LEFT JOIN yh_cbkxx b ON a.yhbh = b.yhbh AND b.cbkh='1'
- LEFT JOIN bm_sj c on b.sjbm=c.code
- LEFT JOIN bm_sblb d on b.sblb=d.code
- LEFT JOIN bm_cbpq e on a.sscbpq=e.cbpqbm
- LEFT JOIN bm_cbb f on a.sscbb=f.cbbbm
- LEFT JOIN bm_gs g on a.ssgs=g.bm
- LEFT JOIN bm_fffs h on a.fffs=h.code
- LEFT JOIN yy_cblr k on a.yhbh=k.yhbh and b.cbkh=k.cbkh
- LEFT JOIN yy_zjzh j on a.yhbh=j.yhbh
- WHERE
- 1=1
- <!--模糊查询 -->
- <if test="filter.searchText != null and filter.searchText != ''">
- AND (
- a.yhbh like '%${filter.searchText}%'
- OR a.yhxm like '%${filter.searchText}%'
- OR a.yhdz like '%${filter.searchText}%'
- OR a.lxdh like '%${filter.searchText}%'
- OR a.zjhm like '%${filter.searchText}%'
- OR a.htbh like '%${filter.searchText}%'
- OR b.sbbh like '%${filter.searchText}%'
- OR lower(a.pyjm) like '%${filter.searchText}%'
- OR instr(a.cym, '${filter.searchText}') > 0
- )
- </if>
- <!--所属公司-->
- <if test="filter.ssgs!=null">
- AND a.ssgs=#{filter.ssgs}
- </if>
- <!--所属片区-->
- <if test="filter.sscbpq!=null">
- AND a.sscbpq=#{filter.sscbpq}
- </if>
- <!--所属抄表本-->
- <if test="filter.sscbb!=null">
- <choose>
- <when test="filter.sscbb.indexOf(',')!=-1">
- AND a.sscbb in
- <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
- close=")">
- #{item}
- </foreach>
- </when>
- <otherwise>
- AND a.sscbb=#{filter.sscbb}
- </otherwise>
- </choose>
- </if>
- <if test="filter.cby!=null">
- AND f.cby=#{filter.cby}
- </if>
- <if test="filter.qyfzr!=null">
- AND f.qyfzr=#{filter.qyfzr}
- </if>
- <!-- 用水类型-->
- <if test="filter.yslx!=null">
- AND c.yslx=#{filter.yslx}
- </if>
- <!-- 用户状态-->
- <if test="filter.yhzt!=null">
- AND a.yhzt=#{filter.yhzt}
- </if>
- <!-- 水表类别-->
- <if test="filter.sblb!=null">
- AND b.sblb=#{filter.sblb}
- </if>
- <!-- 垃圾费标志-->
- <if test="filter.ljfbz!=null">
- AND b.ljfbz=#{filter.ljfbz}
- </if>
- <if test="filter.sbbh!=null">
- AND b.sbbh=#{filter.sbbh}
- </if>
- <if test="filter.ybdjbz!=null">
- AND b.ybdjbz=#{filter.ybdjbz}
- </if>
- <if test="filter.sjbm != null and filter.sjbm != ''">
- AND b.sjbm = #{filter.sjbm}
- </if>
- <if test="filter.sbkj!=null">
- AND b.sbkj=#{filter.sbkj}
- </if>
- <!--建档日期-->
- <if test="filter.jdrqStart!=null and filter.jdrqEnd!=null">
- AND TRUNC(a.jdrq) BETWEEN #{filter.jdrqStart} AND
- #{filter.jdrqEnd}
- </if>
- <if test="filter.yhbhStart!=null">
- <![CDATA[ AND a.yhbh>=#{filter.yhbhStart} ]]>
- </if>
- <if test="filter.yhbhEnd!=null">
- <![CDATA[ AND a.yhbh<=#{filter.yhbhEnd} ]]>
- </if>
- <!-- 用户姓名-->
- <if test="filter.yhxm!=null">
- AND a.yhxm=#{filter.yhxm}
- </if>
- <!-- 用户编号-->
- <if test="filter.yhbh!=null">
- AND a.yhbh=#{filter.yhbh}
- </if>
- <!-- 用户地址-->
- <if test="filter.yhdz!=null">
- AND a.yhdz=#{filter.yhdz}
- </if>
- <!-- 联系电话-->
- <if test="filter.lxdh!=null">
- AND a.lxdh=#{filter.lxdh}
- </if>
- <!-- 是否分配抄表本(册)-->
- <if test="filter.sffpcbb!=null">
- <if test="filter.sffpcbb">
- AND a.sscbb IS NOT NULL
- </if>
- <if test="!filter.sffpcbb">
- AND a.sscbb IS NULL
- </if>
- </if>
- <if test="filter.ffgxzh!=null">
- AND a.yhbh in (select yhbh_fb from yh_ffgx where yhbh_zb=#{filter.ffgxzh})
- </if>
- <if test="filter.ffgxbz!=null and filter.ffgxbz==1">
- AND a.yhbh in (select yhbh_zb from yh_ffgx)
- </if>
- <if test="filter.htqdrqStart!=null and filter.htqdrqEnd!=null">
- AND TRUNC(a.htqdrq) BETWEEN #{filter.htqdrqStart} AND #{filter.htqdrqEnd}
- </if>
- <if test="filter.htbh!=null">
- AND a.htbh=#{filter.htbh}
- </if>
- <if test="filter.zjhm!=null">
- AND a.zjhm=#{filter.zjhm}
- </if>
- <if test="filter.sfqdht!=null">
- AND a.htqd=#{filter.sfqdht}
- </if>
- <if test="filter.khlb!=null">
- AND a.khlb=#{filter.khlb}
- </if>
- <if test='filter.khbm != null and filter.khbm != ""'>
- AND (a.khbm like '${filter.khbm}%' or a.yhxm like '%${filter.khbm}%' or LOWER(a.pyjm) like LOWER('%${filter.khbm}%'))
- AND a.ZHBZ='1'
- </if>
- <if test="filter.dxh != null">
- AND a.dxh = #{filter.dxh}
- </if>
- <!-- <if test="filter.userId != null">-->
- <!-- AND a.sscbb in(select cbbbm from yh_sjqx where user_id=#{filter.userId})-->
- <!-- </if>-->
- ORDER BY a.yhbh asc
- <!-- <if test="filter.jdrqdxpx != null and filter.jdrqdxpx == 1">-->
- <!-- ORDER BY jdrq DESC NULLS LAST-->
- <!-- </if>-->
- </sql>
- <select id="getUserInfoPage" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect2">
- 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,
- a.dzyx,a.zjlb,a.zjhm,a.sqrq,
- 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,
- 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,
- a.ssregion,a.xgrybm,a.jtzqljl,a.fplx,
- (case
- when a.fplx='0' then '普票'
- when a.fplx='1' then '专票'
- when a.fplx='2' then '收据'
- else '其它'
- end) fplxmc,
- a.fp_name,a.fp_nsrsbh,a.fp_dz,a.fp_lxdh,a.fp_bankname,a.fp_bankcode,a.fp_bz,
- a.fffs,h.name AS fffsmc,
- a.khlb,a.pyjm,a.yljl, g.mc AS ssgsmc, e.cbpqmc AS sscbpqmc, f.cbbmc AS sscbbmc,
- 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
- sjmc,k.scds,k.bcds,k.cbxh,
- nvl(j.yfje,0) yfje, nvl(j.kjje,0) kjje, nvl(j.syje,0) syje, nvl(j.nbsyje,0) nbsyje,a.khbm,
- (case
- when l.yhbh >' ' then '1'
- else '0'
- end
- ) qzhgxbz
- FROM yh_khjbxx a
- LEFT JOIN yh_cbkxx b on a.yhbh=b.yhbh
- LEFT JOIN bm_sj c on b.sjbm=c.code
- LEFT JOIN bm_sblb d on b.sblb=d.code
- LEFT JOIN bm_cbpq e on a.sscbpq=e.cbpqbm
- LEFT JOIN bm_cbb f on a.sscbb=f.cbbbm
- LEFT JOIN bm_gs g on a.ssgs=g.bm
- LEFT JOIN bm_fffs h on a.fffs=h.code
- LEFT JOIN yy_cblr k on a.yhbh=k.yhbh and b.cbkh=k.cbkh
- LEFT JOIN yy_zjzh j on a.yhbh=j.yhbh
- LEFT JOIN (select yhbh from (
- select yhbh from yh_group
- union
- select yhbh from yh_group_accounts))l on a.yhbh=l.yhbh
- WHERE 1=1
- <if test="filter.searchText != null and filter.searchText != ''">
- AND ( a.yhbh like '%${filter.searchText}%'
- OR a.yhxm like '%${filter.searchText}%'
- OR a.yhdz like '%${filter.searchText}%'
- OR a.lxdh like '%${filter.searchText}%'
- OR a.zjhm like '%${filter.searchText}%'
- OR a.htbh like '%${filter.searchText}%'
- OR b.sbbh like '%${filter.searchText}%'
- OR lower(a.pyjm) like '%${filter.searchText}%'
- OR instr(a.cym, '${filter.searchText}') > 0
- )
- </if>
- <!--所属公司-->
- <if test="filter.ssgs!=null">
- AND a.ssgs=#{filter.ssgs}
- </if>
- <!--所属片区-->
- <if test="filter.sscbpq!=null">
- AND a.sscbpq=#{filter.sscbpq}
- </if>
- <!--所属抄表本-->
- <if test="filter.sscbb!=null">
- <choose>
- <when test="filter.sscbb.indexOf(',')!=-1">
- AND a.sscbb in
- <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
- close=")">
- #{item}
- </foreach>
- </when>
- <otherwise>
- AND a.sscbb=#{filter.sscbb}
- </otherwise>
- </choose>
- </if>
- </select>
- <select id="getPage_cbbwfp" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect">
- <include refid="querySql_cbbwfp"></include>
- </select>
- <select id="getPage_cbbyfp" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect">
- <include refid="querySql_cbbyfp"></include>
- </select>
- <!--自定义用户档案分页查询 -->
- <select id="getPage" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect">
- <include refid="querySql"></include>
- </select>
- <select id="getPage2" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect2">
- <include refid="querySql"/>
- </select>
- <select id="getList" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect2">
- <include refid="querySql"></include>
- <if test="filter.orders!=null and filter.orders.size()>0">
- ORDER BY
- <foreach collection="filter.orders" item="o" separator=",">
- ${o.column}
- <if test="!o.asc">DESC</if>
- </foreach>
- </if>
- </select>
- <select id="getFfgxPage" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxFfgxzSelect">
- select
- g.mc AS ssgsmc, e.cbpqmc AS sscbpqmc, f.cbbmc AS sscbbmc,
- a.yhbh, a.yhxm, a.yhdz, a.lxdh,
- a.fp_name fpName, a.fp_nsrsbh fpNsrsbh, a.fp_dz fpDz,a.fp_lxdh fpLxdh,
- a.fp_bankname fpBankname, a.fp_bankcode fpBankcode, a.fp_bz fpBz,
- (select count(1) from yh_ffgx where yhbh_zb=a.yhbh_zb) yhsl,
- b.czryxm ,b.czsj
- from yh_ffgx b
- left join yh_khjbxx a on a.yhbh=b.yhbh_zb and b.yhbh_fb=b.yhbh_zb
- left join bm_cbpq e on a.sscbpq=e.cbpqbm
- left join bm_cbb f on a.sscbb=f.cbbbm
- left join bm_gs g on a.ssgs=g.bm
- <where>
- <if test="filter.searchText!=null">
- AND ( a.yhbh='${filter.searchText}'
- OR a.yhxm like '%${filter.searchText}%'
- OR a.yhdz like '%${filter.searchText}%'
- OR a.lxdh like '%${filter.searchText}%')
- </if>
- <!--所属公司-->
- <if test="filter.ssgs!=null">
- AND a.ssgs=#{filter.ssgs}
- </if>
- <!--所属片区-->
- <if test="filter.sscbpq!=null">
- AND a.sscbpq=#{filter.sscbpq}
- </if>
- <!--所属抄表本-->
- <if test="filter.sscbb!=null">
- <choose>
- <when test="filter.sscbb.indexOf(',')!=-1">
- AND a.sscbb in
- <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
- close=")">
- #{item}
- </foreach>
- </when>
- <otherwise>
- AND a.sscbb=#{filter.sscbb}
- </otherwise>
- </choose>
- </if>
- </where>
- </select>
- <!--自定义用户档案查询page -->
- <!-- //用户编号、用户姓名、用户地址、联系电话
- //片区、抄表本、水表型号、用水性质、用户状态、是否垃圾费、建档日期、抄表人员 -->
- <select id="selectDaCustomerPage" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxSelect2">
- select distinct a.yhbh yhbh,a.ykhbh ykhbh ,a.ssgs ssgs,a.sscbpq sscbpq,a.sscbb sscbb, k.mc ssgsmc, c.cbpqmc
- sscbpqmc ,d.cbbmc sscbbmc, a.yhxm
- yhxm,a.yhdz yhdz,a.lxdh lxdh,a.sqrq sqrq,a.sj sj,a.zzdh zzdh,a.dzyx dzyx,a.xb xb
- ,a.jdrq jdrq,a.czryxm czryxm,b.sbbh sbbb, nvl(a.sbsl,0) sbsl
- ,a.yhzt yhzt,a.zjlb zjlb,a.zjhm zjhm, nvl(e.scds,0) scds,nvl(e.bcds,0) bcds,b.cbkid cbkid
- ,f.name sjmc,g.name sblbmc
- from yh_khjbxx a inner join yh_cbkxx b on a.yhbh=b.yhbh
- left join bm_gs k on a.ssgs =k.bm
- left join bm_cbpq c on a.sscbb=c.cbpqbm left join bm_cbb d on a.sscbb=d.cbbbm
- left join yy_cblr e on a.yhbh=e.yhbh and b.cbkh=e.cbkh
- left join bm_sj f on b.sjbm=f.code
- left join bm_sbxh g on b.sblb=g.code
- where 1=1
- <!--模糊查询 -->
- <if test="searchText != null and searchText != ''">
- and ( a.yhbh like '%${searchText}%' or a.yhxm like '%${searchText}%' or a.yhdz like
- '%${searchText}%' or a.lxdh like '%${searchText}%' )
- </if>
- <!--片区 -->
- <if test="sscbb !=null and sscbb!='' and sscbb!='all' ">
- and a.sscbb=#{sscbb}
- </if>
- <!--抄表本 -->
- <if test="sscbb !=null and sscbb!='' and sscbb!='all'">
- and a.sscbb=#{sscbb}
- </if>
- <!--水表型号 -->
- <if test="sblb !=null and sblb!='' and sblb!='all'">
- and b.sblb=#{sblb}
- </if>
- <!--用水性质-->
- <if test="sjbm !=null and sjbm!='' and sjbm!='all'">
- and b.sjbm=#{sjbm}
- </if>
- <!-- 用户状态-->
- <if test="yhzt!=null and yhzt!=''">
- and a.yhzt=#{yhzt}
- </if>
- <!-- 是否垃圾费-->
- <if test="ljfbz!=null and ljfbz!=''">
- and b.ljfbz=#{ljfbz}
- </if>
- <!--抄表人员> -->
- <if test="cbry!=null and cbry!='' and cbry!='all' ">
- and d.cby=#{cbry}
- </if>
- <!--建档日期-->
- <if test="ksrq!=null and ksrq!='' and jsrq!=null and jsrq!='' ">
- and Trunc(a.jdrq) BETWEEN to_date(#{ksrq},'yyyy-mm-dd hh24:mi:ss') and to_date(#{jsrq},'yyyy-mm-dd
- hh24:mi:ss')
- </if>
- <!--公司 -->
- <if test="ssgs!=null and ssgs!='' and ssgs!='all'">
- and a.ssgs=#{ssgs}
- </if>
- </select>
- <select id="getZnbDaPage" resultType="com.tofly.feesapi.znbgl.entity.vo.ZnbYhdaSelect">
- SELECT a.yhbh, a.yhxm, a.yhdz,a.lxdh,
- b.sbbh AS sbbh,
- (select NBSYJE from yy_zjzh where yhbh=a.yhbh) bjye,
- da.cl_cljg tbbz,
- decode(zl.cl_cljg, '0', '1', decode(zl.ZLVALUE,'true','0','2')) fmzt,
- f.cbbmc AS sscbbmc,
- g.cbpqmc AS sscbpqmc,
- d.name AS sblbmc,
- h.name AS bjcjmc
- FROM yh_khjbxx a
- LEFT JOIN yh_cbkxx b ON a.yhbh = b.yhbh and b.jfzt='1'
- LEFT JOIN bm_sblb d ON b.sblb = d.code
- LEFT JOIN bm_cbb f ON a.sscbb = f.cbbbm
- LEFT JOIN bm_cbpq g ON a.sscbpq = g.cbpqbm
- LEFT JOIN bm_sbsccj h on b.sbsccj=h.code
- LEFT JOIN (
- select * from(
- select a.*,row_number() over (partition by YHBH,CBKH order by CZSJ desc) as rn from
- znb_da_log a)
- where rn=1
- ) da ON b.yhbh=da.yhbh and b.cbkh=da.cbkh
- LEFT JOIN (
- select * from(
- select a.*,row_number() over (partition by YHBH,CBKH order by CZSJ desc) as rn from
- znb_zl_log a
- where a.zltype='1'
- )
- where rn=1
- ) zl ON b.yhbh=zl.yhbh and b.cbkh=zl.cbkh
- WHERE 1=1 AND b.sblb in ('2','3')
- <!--模糊查询 -->
- <if test="filter.searchText!=null">
- AND (a.yhbh like '%${filter.searchText}%'
- OR a.yhxm like '%${filter.searchText}%'
- OR a.yhdz like '%${filter.searchText}%'
- OR a.lxdh like '%${filter.searchText}%')
- </if>
- <!--所属公司-->
- <if test="filter.ssgs!=null">
- AND a.ssgs=#{filter.ssgs}
- </if>
- <!--所属片区-->
- <if test="filter.sscbpq!=null">
- AND a.sscbpq=#{filter.sscbpq}
- </if>
- <!--所属抄表本-->
- <if test="filter.sscbb!=null">
- <choose>
- <when test="filter.sscbb.indexOf(',')!=-1">
- AND a.sscbb in
- <foreach item="item" index="index" collection="filter.sscbb.split(',')" open="(" separator=","
- close=")">
- #{item}
- </foreach>
- </when>
- <otherwise>
- AND a.sscbb=#{filter.sscbb}
- </otherwise>
- </choose>
- </if>
- </select>
- <select id="getNdjtslxx" resultType="com.tofly.feesapi.mxcx.entity.vo.YhNdjtslSelect">
- select * from(
- select
- a.yhbh,
- a.yhxm,
- a.yhdz,
- to_char(sysdate,'yyyy') year,
- d.name ysxz,
- a.rks as rksl,
- c.jtxh,
- a.jtzqljl as ndljl,
- c.jtzs,
- c.jtrksl,
- c.jtrkjs
- from yh_khjbxx a,yh_cbkxx b
- left join (
- select code,'1' jtxh,jt1_zs as jtzs,jtrksl,jtrkjs,jtbz,jtjslx from bm_sj where jtbz='1' and jtjslx='2'
- union all
- select code,'2' jtxh,jt2_zs as jtzs,jtrksl,jtrkjs,jtbz,jtjslx from bm_sj where jtbz='1' and jtjslx='2'
- union all
- select code,'3' jtxh,jt3_zs as jtzs,jtrksl,jtrkjs,jtbz,jtjslx from bm_sj where jtbz='1' and jtjslx='2'
- ) c on c.code=b.sjbm
- left join bm_yslx d on b.yslx=d.code
- where a.yhbh=b.yhbh and c.jtbz='1' and c.jtjslx='2'
- <if test="yhbh!=null">
- and a.yhbh=#{yhbh}
- </if>
- )
- </select>
- <select id="getwjPage" resultType="com.tofly.feesapi.mxcx.entity.vo.YhwjSelect">
- select c.yhbh,
- c.yhxm,
- a.file_name as wjmc,
- a.file_type as wjlx,
- a.file_url as image,
- to_char(a.czsj,'yyyy-mm-dd hh24:mi:ss') as scsj,
- a.CZRYXM as scrymx
- from yh_doc_usb_files a
- left join yh_doc_files b on a.files_id=b.id
- left join yh_khjbxx c on b.yhbh=c.yhbh
- <where>
- <if test="filter.yhbh!=null">
- and c.yhbh=#{filter.yhbh}
- </if>
- <if test="filter.startczsj!=null and filter.endczsj!=null">
- AND a.czsj BETWEEN #{filter.startczsj} AND #{filter.endczsj}
- </if>
- <if test="filter.wjlx!=null">
- and a.file_type=#{filter.wjlx}
- </if>
- </where>
- </select>
- <select id="xzyhtj" resultType="com.tofly.feesapi.yhgl.entity.vo.YhkhjbxxXzyhSelect">
- select ysxzmc,
- ssgsmc,
- sum(sbkj15) sbkj15,
- sum(sbkj20) sbkj20,
- sum(sbkj25) sbkj25,
- sum(sbkj30) sbkj30,
- sum(sbkj32) sbkj32,
- sum(sbkj40) sbkj40,
- sum(sbkj50) sbkj50,
- sum(sbkj65) sbkj65,
- sum(sbkj75) sbkj75,
- sum(sbkj80) sbkj80,
- sum(sbkj90) sbkj90,
- sum(sbkj100) sbkj100,
- sum(sbkj110) sbkj110,
- sum(sbkj150) sbkj150,
- sum(sbkj160) sbkj160,
- sum(sbkj200) sbkj200,
- sum(sbkj300) sbkj300
- from (select a.name as ysxzmc,
- d.ssgs as ssgsmc,
- (case
- when e.cccode = '15' then 1
- else 0
- end) as sbkj15,
- (case
- when e.cccode = '20' then 1
- else 0
- end) as sbkj20,
- (case
- when e.cccode = '25' then 1
- else 0
- end) as sbkj25,
- (case
- when e.cccode = '30' then 1
- else 0
- end) as sbkj30,
- (case
- when e.cccode = '32' then 1
- else 0
- end) as sbkj32,
- (case
- when e.cccode = '40' then 1
- else 0
- end) as sbkj40,
- (case
- when e.cccode = '50' then 1
- else 0
- end) as sbkj50,
- (case
- when e.cccode = '65' then 1
- else 0
- end) as sbkj65,
- (case
- when e.cccode = '75' then 1
- else 0
- end) as sbkj75,
- (case
- when e.cccode = '80' then 1
- else 0
- end) as sbkj80,
- (case
- when e.cccode = '90' then 1
- else 0
- end) as sbkj90,
- (case
- when e.cccode = '100' then 1
- else 0
- end) as sbkj100,
- (case
- when e.cccode = '110' then 1
- else 0
- end) as sbkj110,
- (case
- when e.cccode = '150' then 1
- else 0
- end) as sbkj150,
- (case
- when e.cccode = '160' then 1
- else 0
- end) as sbkj160,
- (case
- when e.cccode = '200' then 1
- else 0
- end) as sbkj200,
- (case
- when e.cccode = '300' then 1
- else 0
- end) as sbkj300
- from bm_yslx a
- left join bm_sj b on a.code = b.yslx
- left join yh_cbkxx c on b.code = c.sjbm
- left join yh_khjbxx d on c.yhbh = d.yhbh
- left join sys_child_code e on c.sbkj = e.cccode and e.pcid = '12'
- <where>
- <if test="filter.ssgs!=null and filter.ssgs!=''">
- and d.ssgs=#{filter.ssgs}
- </if>
- <if test="filter.sscbpq!=null and filter.sscbpq!=''">
- and d.sscbpq=#{filter.sscbpq}
- </if>
- <if test="filter.sscbb!=null and filter.sscbb!=''">
- and d.sscbb=#{filter.sscbb}
- </if>
- <if test="filter.jdrqStart!=null and filter.jdrqStart!='' and filter.jdrqEnd!=null and filter.jdrqEnd!=''">
- AND to_char(d.jdrq,'yyyyMM') BETWEEN #{filter.jdrqStart} AND #{filter.jdrqEnd}
- </if>
- </where>
- ) a
- group by ysxzmc,ssgsmc
- </select>
- <select id="getYhxx" resultType="com.tofly.feesapi.yhgl.entity.vo.Yhkhqbxx">
- select a.*,
- b.*,
- gs.mc as gsmc,
- cbpq.cbpqmc as cbpqmc,
- cbb.cbbmc as cbbmc,
- sblb.name as sblbmc,
- sbsccj.name as cbsccjmc,
- sbkj.ccname as sbkjmc,
- sblc.ccname as sblcmc,
- jddj.ccname as jddjmc,
- bjwz.ccname as bjwzmc,
- sj.name as sjmc,
- sj1.name as sj1mc,
- yslx.name as ysxzmc
- from yh_khjbxx a
- left join yh_cbkxx b on a.yhbh = b.yhbh and chkh = '1'
- left join bm_gs gs on a.ssgs = gs.bm
- left join bm_cbpq cbpq on a.sscbpq = cbpq.cbpqbm
- left join bm_cbb cbb on a.sscbb = cbb.cbbbm
- left join bm_sblb sblb on b.sblb = sblb.code
- left join bm_sbsccj sbsccj on b.sbsccj = sbsccj.code
- left join sys_child_code sbkj on b.sbkj = sbkj.cccode and sbkj.pcid = '12'
- left join sys_child_code sblc on b.sbkj = sblc.cccode and sblc.pcid = '13'
- left join sys_child_code jddj on b.sbkj = jddj.cccode and jddj.pcid = '14'
- left join sys_child_code bjwz on b.sbkj = bjwz.cccode and bjwz.pcid = '15'
- left join bm_sj sj on b.sjbm = sj.code
- left join bm_sj sj1 on b.sjbm1 = sj1.code
- left join bm_yslx yslx on sj.yslx = yslx.code
- where a.yhbh = #{yhbh}
- </select>
- </mapper>
|