| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- <?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="cn.com.goldenwater.dcproj.dao.ImportExcelDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspAll" id="ImportExcelResultMap">
- <result property="id" column="ID"/>
- <result property="pid" column="PID"/>
- <result property="pnm" column="PNM"/>
- <result property="sttm" column="STTM"/>
- <result property="entm" column="ENTM"/>
- <result property="inspYear" column="INSP_YEAR"/>
- <result property="inspMnth" column="INSP_MNTH"/>
- <result property="inspTask" column="INSP_TASK"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- PID,
- PNM,
- STTM,
- ENTM,INSP_YEAR,INSP_MNTH,INSP_TASK
- </sql>
- <sql id="entity_properties">
- #{id},
- #{pid},
- #{pnm},
- #{sttm},
- #{entm},#{inspYear},#{inspMnth},#{inspTask}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="id != null and id != ''">and ID LIKE concat(#{id},'%')</if>
- <if test="pid != null and pid != ''">and PID = #{pid}</if>
- <if test="pnm != null and pnm != ''">and PNM like concat('%',concat(#{pnm},'%'))</if>
- <if test="sttm != null">and STTM = #{sttm}</if>
- <if test="entm != null">and ENTM = #{entm}</if>
- <if test="inspMnth != null and inspMnth != ''">and INSP_MNTH = #{inspMnth}</if>
- <if test="inspYear != null and inspYear != ''">and INSP_YEAR = #{inspYear}</if>
- </trim>
- </sql>
- <select id="getOne" resultMap="ImportExcelResultMap">
- select * from BIS_INSP_ALL a where a.id in (select ID from bis_insp_all_obj j where j.nm like '%${nm}%')
- <if test="id != null and id != ''">and ID LIKE concat(#{id},'%')</if>
- <if test="pid != null and pid != ''">and PID = #{pid}</if>
- <if test="pnm != null and pnm != ''">and PNM like concat('%',concat(#{pnm},'%'))</if>
- <if test="sttm != null">and STTM = #{sttm}</if>
- <if test="entm != null">and ENTM = #{entm}</if>
- <if test="inspMnth != null and inspMnth != ''">and INSP_MNTH = #{inspMnth}</if>
- <if test="inspYear != null and inspYear != ''">and INSP_YEAR = #{inspYear}</if>
- </select>
- <select id="get" resultMap="ImportExcelResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from BIS_INSP_ALL where ID = #{id}
- </select>
- <select id="getBy" resultMap="ImportExcelResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_ALL
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="ImportExcelResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_ALL
- </select>
- <select id="findAreas" resultMap="ImportExcelResultMap">
- select bas_code as id,bas_name as pnm from ATT_BAS_BASE order by bas_code
- </select>
- <select id="findList" resultMap="ImportExcelResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_ALL
- <include refid="page_where"/>
- </select>
- <select id="findBasinList" resultMap="ImportExcelResultMap">
- select distinct substr(t.id,4,3) id,t.pnm from bis_insp_all t
- <include refid="page_where"/>
- </select>
- <select id="findNodeByPersId" resultMap="ImportExcelResultMap">
- select DISTINCT t2.ID,t2.PID,t2.PNM,t2.STTM,t2.ENTM
- from bis_insp_all t2
- start with t2.id in
- (select t.id
- from bis_insp_all_rlation t
- where t.persid =#{persId})
- connect by t2.pid = prior t2.id
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from BIS_INSP_ALL
- <include refid="page_where"/>
- </select>
- <select id="selectMax" resultType="String">
- select Max(ID) as id from BIS_INSP_ALL
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspAll">
- insert into BIS_INSP_ALL(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_INSP_ALL where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAll">
- delete from BIS_INSP_ALL
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_ALL set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspAll">
- update BIS_INSP_ALL
- <trim prefix="set" suffixOverrides=",">
- <if test="pid != null and pid != ''">PID = #{pid},</if>
- <if test="pnm != null and pnm != ''">PNM = #{pnm},</if>
- <if test="sttm != null">STTM = #{sttm},</if>
- <if test="entm != null">ENTM = #{entm},</if>
- <if test="inspMnth != null">INSP_MNTH = #{inspMnth},</if>
- <if test="inspYear != null">INSP_YEAR = #{inspYear},</if>
- <if test="inspTask != null">INSP_TASK = #{inspTask},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspAll">
- update BIS_INSP_ALL
- <trim prefix="set" suffixOverrides=",">
- <if test="pid != null and pid != ''">PID = #{pid},</if>
- <if test="pnm != null and pnm != ''">PNM = #{pnm},</if>
- <if test="sttm != null">STTM = #{sttm},</if>
- <if test="entm != null">ENTM = #{entm},</if>
- <if test="inspMnth != null">INSP_MNTH = #{inspMnth},</if>
- <if test="inspYear != null">INSP_YEAR = #{inspYear},</if>
- <if test="inspTask != null">INSP_TASK = #{inspTask},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <sql id="orgIdSql">
- <choose>
- <when test="orgId !=null and orgId !=''">
- and ORG_ID=#{orgId}
- </when>
- <otherwise>
- and ORG_ID is null
- </otherwise>
- </choose>
- </sql>
- <!--查询子id最大的对象 参数 001-->
- <select id="getMaxOne" resultMap="ImportExcelResultMap">
- select Max(id) as id from BIS_INSP_ALL t where t.pid = #{pid}
- </select>
- <select id="getAllNode" resultType="cn.com.goldenwater.dcproj.model.BisInspAll">
- select id,pid,pnm,sttm,entm from
- BIS_INSP_ALL t where
- REGEXP_LIKE(
- Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} <include refid="orgIdSql"/> )>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{userid} <include refid="orgIdSql"/> GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- <if test="orgType !=null and orgType != ''">
- and ID LIKE concat(#{orgType},'%')
- </if>
- <if test="orgType !=null and orgType != ''">
- and ID LIKE concat(#{orgType},'%')
- </if>
- order by id
- </select>
- <select id="getAllNodeByLevel" resultType="cn.com.goldenwater.dcproj.model.BisInspAll">
- select id,pid,pnm,sttm,entm from
- BIS_INSP_ALL t where
- REGEXP_LIKE(
- Id,'^('||
- ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId} <include refid="orgIdSql"/>)>0 then
- (SELECT LISTAGG(id, '|') as
- id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId} <include refid="orgIdSql"/> GROUP BY PERSID)
- else (select 'non' from dual) end)
- ||')')
- <if test="objType !=null and objType != ''">
- and ID LIKE concat(#{objType},'%')
- </if>
- <if test="level !=null and level != ''">
- and length(ID) >= #{level}
- </if>
- order by ID
- </select>
- <select id="BisInspAllObjById" resultType="cn.com.goldenwater.dcproj.model.BisInspAllNode">
- select RGSTR_ID as id,ID as pid,OBJ_NM AS pnm,OBJ_ID from
- VIEW_REG_BASE t
- where
- 1 = 1
- <if test="id !=null and id != ''">
- and ID = #{id}
- </if>
- order by OBJ_NM
- </select>
- <delete id="deleteAll" parameterType="String">
- DELETE FROM BIS_INSP_ALL WHERE ID LIKE '${id}%'
- </delete>
- <select id="getUserByOrg" resultType="java.util.HashMap">
- SELECT
- a.ID,
- a.PID,
- a.PNM,
- d.PNM AS pidnm,
- b.PERTYPE,
- c.GUID,
- c.ORG_ID,
- c.PERS_NAME,
- c.BORN_DATE,
- c.PLST,
- c.SCHOOL,
- c.SPECIALTY,
- c.TELNUMB,
- c.FAXNUMB,
- c.ADM_DUTY,
- c.ORG_NM,
- c.MOBILENUMB,
- c.IDNM,
- c.DPNM,
- c.DPPOST,
- c.EMAIL,
- c.REMARK,
- c.IMGURL
- FROM
- (
- SELECT
- ID,
- PID,
- PNM,
- STTM,
- ENTM
- FROM
- BIS_INSP_ALL a START WITH a.id = #{objType} connect BY prior a.ID = a.PID
- ) a
- LEFT JOIN BIS_INSP_ALL_RLATION b ON a.ID = b.id
- LEFT JOIN BIS_INSP_ALL_RLATION_PERS c ON b.PERSID = c.GUID
- LEFT JOIN BIS_INSP_ALL d ON a.PID = d.ID
- WHERE length(a.ID) = 12
- ORDER BY
- a.ID,b.PERTYPE desc
- </select>
- <!--导出模块获取流域树 水库1,人饮2,水毁3 三棵树-->
- <select id="getNodeByPidAndCode" resultType="java.util.LinkedHashMap">
- <choose>
- <when test="pid.length() >= 12">
- select distinct '' "id", obj.nm "pnm",
- obj.code "code", obj.nm "nm",obj.ptype "pType",obj.obj_id "objId",rgstr.eng_id "engId"
- from BIS_INSP_ALL_OBJ obj left join BIS_INSP_VILL_RGSTR rgstr
- on obj.obj_id = rgstr.obj_id
- where
- obj.id = #{pid}
- <!--instr((select LISTAGG(code, ',') WITHIN GROUP(ORDER BY id) from BIS_INSP_ALL_OBJ where id = #{pid}),obj.code) > 0-->
- <if test="type !=null and type == '2'.toString()">
- and rgstr.eng_id is not null
- </if>
- <if test="type !=null and type == '1'.toString()">
- and rgstr.eng_id = 'non'
- </if>
- <if test="type !=null and type == '3'.toString()">
- and rgstr.eng_id = 'non'
- </if>
- </when>
- <otherwise>
- SELECT distinct
- ia.id "id", ia.pnm "pnm"
- FROM BIS_INSP_ALL ia
- LEFT JOIN BIS_INSP_ALL_OBJ ar ON ia.id = ar.id
- WHERE ia.pid LIKE #{pid}||'%'
- AND length(ia.id) = length(#{pid})+3
- <if test="pid !=null and pid.length() >= 9 and code !=null and code !=''">
- <choose>
- <when test="type !=null and type=='3'.toString()">
- AND instr(#{code},substr((select loc_ad from BIS_INSP_WTDST where wtdst_id = ar.code),0,2))
- > 0
- </when>
- <otherwise>
- AND instr(#{code},substr(code,0,2)) > 0
- </otherwise>
- </choose>
- </if>
- ORDER BY ia.id
- </otherwise>
- </choose>
- </select>
- <select id="getOldGroupInfo" resultType="java.util.Map" parameterType="java.util.Map">
- select c.id,c.pnm,c.sttm,c.entm,c.intm,c.insp_year,c.insp_mnth,b.obj_id,b.code,b.nm,b.obj_intm,a.intm,a.uptm
- from BIS_INSP_RSVR_RGSTR a
- left join bis_insp_all_obj b on a.obj_id = b.obj_id
- left join bis_insp_all c on b.id = c.id
- where a.intm > c.entm and c.insp_mnth = #{inspMnth}
- order by c.id,b.code
- </select>
- </mapper>
|