| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382 |
- <?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.BisInspFscPblmDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspFscPblm" id="bisInspFscPblmResultMap">
- <result property="name" column="NAME"/>
- <result property="type" column="TYPE"/>
- <result property="admOrg" column="ADM_ORG"/>
- <result property="basName" column="BAS_NAME"/>
- <result property="province" column="PROVINCE"/>
- <result property="city" column="CITY"/>
- <result property="country" column="COUNTRY"/>
- <result property="groupName" column="GROUP_NAME"/>
- <result property="persName" column="PERS_NAME"/>
- <result property="id" column="ID"/>
- <result property="rgstrId" column="RGSTR_ID"/>
- <result property="aUnit" column="A_UNIT"/>
- <result property="pblmDesc" column="PBLM_DESC"/>
- <result property="pblmImgSum" column="PBLM_IMG_SUM"/>
- <result property="pblmImgNum" column="PBLM_IMG_NUM"/>
- <result property="rectConc" column="RECT_CONC"/>
- <result property="rectMeas" column="RECT_MEAS"/>
- <result property="rectImgSum" column="RECT_IMG_SUM"/>
- <result property="rectImgNum" column="RECT_IMG_NUM"/>
- <result property="fdTm" column="FD_TM"/>
- <result property="rectLead" column="RECT_LEAD"/>
- <result property="rectMemb" column="RECT_MEMB"/>
- <result property="rectTm" column="RECT_TM"/>
- <result property="note" column="NOTE"/>
- <result property="dataStat" column="DATA_STAT"/>
- <result property="persId" column="PERS_ID"/>
- <result property="groupId" column="GROUP_ID"/>
- <result property="inTm" column="IN_TM"/>
- <result property="upTm" column="UP_TM"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- RGSTR_ID,
- A_UNIT,
- PBLM_DESC,
- PBLM_IMG_SUM,
- PBLM_IMG_NUM,
- RECT_CONC,
- RECT_MEAS,
- RECT_IMG_SUM,
- RECT_IMG_NUM,
- FD_TM,
- RECT_LEAD,
- RECT_MEMB,
- RECT_TM,
- NOTE,
- DATA_STAT,
- PERS_ID,
- GROUP_ID,
- IN_TM,
- UP_TM
- </sql>
- <sql id="entity_properties">
- #{id},
- #{rgstrId},
- #{aUnit},
- #{pblmDesc},
- #{pblmImgSum},
- #{pblmImgNum},
- #{rectConc},
- #{rectMeas},
- #{rectImgSum},
- #{rectImgNum},
- #{fdTm},
- #{rectLead},
- #{rectMemb},
- #{rectTm},
- #{note},
- #{dataStat},
- #{persId},
- #{groupId},
- #{inTm},
- #{upTm}
- </sql>
- <sql id="entity_properties_item">
- #{item.id},
- #{item.rgstrId},
- #{item.aUnit},
- #{item.pblmDesc},
- #{item.pblmImgSum},
- #{item.pblmImgNum},
- #{item.rectConc},
- #{item.rectMeas},
- #{item.rectImgSum},
- #{item.rectImgNum},
- #{item.fdTm},
- #{item.rectLead},
- #{item.rectMemb},
- #{item.rectTm},
- #{item.note},
- #{item.dataStat},
- #{item.persId},
- #{item.groupId},
- #{item.inTm},
- #{item.upTm}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="rgstrId != null and rgstrId != ''">and RGSTR_ID = #{rgstrId}</if>
- <if test="aUnit != null and aUnit != ''">and A_UNIT = #{aUnit}</if>
- <if test="pblmDesc != null and pblmDesc != ''">and PBLM_DESC = #{pblmDesc}</if>
- <if test="pblmImgSum != null and pblmImgSum != ''">and PBLM_IMG_SUM = #{pblmImgSum}</if>
- <if test="pblmImgNum != null and pblmImgNum != ''">and PBLM_IMG_NUM = #{pblmImgNum}</if>
- <if test="rectConc != null and rectConc != ''">and RECT_CONC = #{rectConc}</if>
- <if test="rectMeas != null and rectMeas != ''">and RECT_MEAS = #{rectMeas}</if>
- <if test="rectImgSum != null and rectImgSum != ''">and RECT_IMG_SUM = #{rectImgSum}</if>
- <if test="rectImgNum != null and rectImgNum != ''">and RECT_IMG_NUM = #{rectImgNum}</if>
- <if test="fdTm != null">and FD_TM = #{fdTm}</if>
- <if test="rectLead != null and rectLead != ''">and RECT_LEAD = #{rectLead}</if>
- <if test="rectMemb != null and rectMemb != ''">and RECT_MEMB = #{rectMemb}</if>
- <if test="rectTm != null">and RECT_TM = #{rectTm}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
- <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
- <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
- <if test="inTm != null">and IN_TM = #{inTm}</if>
- <if test="upTm != null">and UP_TM = #{upTm}</if>
- </trim>
- </sql>
- <select id="get" resultMap="bisInspFscPblmResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from BIS_INSP_FSC_PBLM where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspFscPblmResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_FSC_PBLM
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="bisInspFscPblmResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_FSC_PBLM
- </select>
- <select id="findList" resultMap="bisInspFscPblmResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_FSC_PBLM
- <include refid="page_where"/>
- </select>
- <select id="findPageList" resultMap="bisInspFscPblmResultMap">
- SELECT B.NAME,
- B.TYPE,
- B.ADM_ORG,
- H.BAS_NAME,
- G.AD_NAME AS PROVINCE,
- F.AD_NAME AS CITY,
- E.AD_NAME AS COUNTRY,
- D.ID AS GROUP_ID,
- D.PNM AS GROUP_NAME,
- A.ID,
- A.RGSTR_ID,
- A.A_UNIT,
- A.PBLM_DESC,
- A.PBLM_IMG_SUM,
- A.PBLM_IMG_NUM,
- A.RECT_CONC,
- A.RECT_MEAS,
- A.RECT_IMG_SUM,
- A.RECT_IMG_NUM,
- A.FD_TM,
- A.RECT_LEAD,
- A.RECT_MEMB,
- A.RECT_TM,
- A.NOTE,
- A.DATA_STAT,
- A.PERS_ID,
- A.IN_TM,
- A.UP_TM
- FROM BIS_INSP_FSC_PBLM A
- LEFT JOIN BIS_INSP_FSC_RGSTR B
- ON A.RGSTR_ID = B.ID
- LEFT JOIN BIS_INSP_ALL_OBJ C
- ON B.OBJ_ID = C.OBJ_ID
- LEFT JOIN BIS_INSP_ALL D
- ON C.ID = D.ID
- LEFT JOIN ATT_AD_X_BASE E
- ON B.AD_CODE = E.AD_CODE
- AND E.AD_GRAD = '4'
- LEFT JOIN ATT_AD_X_BASE F
- ON CONCAT(SUBSTR(B.AD_CODE, 1, 4), '00000000') = F.AD_CODE
- AND F.AD_GRAD = '3'
- LEFT JOIN ATT_AD_X_BASE G
- ON CONCAT(SUBSTR(B.AD_CODE, 1, 2), '0000000000') = G.AD_CODE
- AND G.AD_GRAD = '2'
- LEFT JOIN ATT_BAS_BASE H
- ON B.ADM_ORG = H.BAS_CODE
- <trim prefix="where" prefixOverrides="and | or ">
- 1=1
- <if test="rgstrId != null and rgstrId != ''">and A.RGSTR_ID = #{rgstrId}</if>
- <if test="aUnit != null and aUnit != ''">and A.A_UNIT LIKE CONCAT('%',CONCAT(#{aUnit},'%'))</if>
- <if test="pblmDesc != null and pblmDesc != ''">and A.PBLM_DESC LIKE CONCAT('%',CONCAT(#{pblmDesc},'%'))</if>
- <if test="pblmImgSum != null and pblmImgSum != ''">and A.PBLM_IMG_SUM = #{pblmImgSum}</if>
- <if test="pblmImgNum != null and pblmImgNum != ''">and A.PBLM_IMG_NUM = #{pblmImgNum}</if>
- <if test="rectConc != null and rectConc != ''">and A.RECT_CONC = #{rectConc}</if>
- <if test="rectMeas != null and rectMeas != ''">and A.RECT_MEAS LIKE CONCAT('%',CONCAT(#{rectMeas},'%'))</if>
- <if test="rectImgSum != null and rectImgSum != ''">and A.RECT_IMG_SUM = #{rectImgSum}</if>
- <if test="rectImgNum != null and rectImgNum != ''">and A.RECT_IMG_NUM = #{rectImgNum}</if>
- <if test="fdTm != null">and A.FD_TM = #{fdTm}</if>
- <if test="rectLead != null and rectLead != ''">and A.RECT_LEAD LIKE CONCAT('%',CONCAT(#{rectLead},'%'))</if>
- <if test="rectMemb != null and rectMemb != ''">and A.RECT_MEMB LIKE CONCAT('%',CONCAT(#{rectMemb},'%'))</if>
- <if test="rectTm != null">and A.RECT_TM = #{rectTm}</if>
- <if test="note != null and note != ''">and A.NOTE = #{note}</if>
- <if test="dataStat != null and dataStat != ''">and A.DATA_STAT = #{dataStat}</if>
- <if test="groupId != null and groupId != ''">and D.ID = #{groupId}</if>
- <if test="orgIds != null and orgIds != ''">and D.ID IN
- <foreach item="item" index="index" collection="orgIds.split(',')" open="(" separator="," close=")">
- '${item}'
- </foreach>
- </if>
- <if test="adCode != null and adCode != ''">and B.AD_CODE LIKE CONCAT(#{adCode},'%')</if>
- <if test="adName != null and adName != ''">and E.AD_FULL_NAME LIKE CONCAT('%',CONCAT(#{adName},'%'))</if>
- <if test="startTime != null">
- <if test='tmType =="1" or tmType =="" or tmType ==null'>
- and A.FD_TM >= #{startTime}
- </if>
- <if test='tmType =="2"'>
- and A.RECT_TM >= #{startTime}
- </if>
- </if>
- <if test="endTime != null">
- <if test='tmType =="1" or tmType =="" or tmType ==null'>
- and A.FD_TM <= #{endTime}
- </if>
- <if test='tmType =="2"'>
- and A.RECT_TM <= #{endTime}
- </if>
- </if>
- <if test="inTm != null">and A.IN_TM = #{inTm}</if>
- <if test="upTm != null">and A.UP_TM = #{upTm}</if>
- <if test="persId != null and persId != '' and inIdsSql != null and inIdsSql != '' ">
- and D.id in (${inIdsSql})
- </if>
- <if test="persName != null and persName != ''">
- AND J.PERS_NAME LIKE CONCAT('%',CONCAT(#{persName},'%'))
- </if>
- <if test="name != null and name != ''">and B.NAME LIKE CONCAT('%',CONCAT(#{name},'%'))</if>
- <if test="groupName != null and groupName != ''">and D.PNM LIKE CONCAT('%',CONCAT(#{groupName},'%'))</if>
- </trim>
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from BIS_INSP_FSC_PBLM
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspFscPblm">
- insert into BIS_INSP_FSC_PBLM(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_INSP_FSC_PBLM where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspFscPblm">
- delete from BIS_INSP_FSC_PBLM
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_FSC_PBLM set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspFscPblm">
- update BIS_INSP_FSC_PBLM
- <trim prefix="set" suffixOverrides=",">
- <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
- <if test="aUnit != null and aUnit != ''">A_UNIT = #{aUnit},</if>
- <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
- <if test="pblmImgSum != null and pblmImgSum != ''">PBLM_IMG_SUM = #{pblmImgSum},</if>
- <if test="pblmImgNum != null and pblmImgNum != ''">PBLM_IMG_NUM = #{pblmImgNum},</if>
- <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
- <if test="rectMeas != null and rectMeas != ''">RECT_MEAS = #{rectMeas},</if>
- <if test="rectImgSum != null and rectImgSum != ''">RECT_IMG_SUM = #{rectImgSum},</if>
- <if test="rectImgNum != null and rectImgNum != ''">RECT_IMG_NUM = #{rectImgNum},</if>
- <if test="fdTm != null">FD_TM = #{fdTm},</if>
- <if test="rectLead != null and rectLead != ''">RECT_LEAD = #{rectLead},</if>
- <if test="rectMemb != null and rectMemb != ''">RECT_MEMB = #{rectMemb},</if>
- <if test="rectTm != null">RECT_TM = #{rectTm},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspFscPblm">
- update BIS_INSP_FSC_PBLM
- <trim prefix="set" suffixOverrides=",">
- <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
- <if test="aUnit != null and aUnit != ''">A_UNIT = #{aUnit},</if>
- <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
- <if test="pblmImgSum != null and pblmImgSum != ''">PBLM_IMG_SUM = #{pblmImgSum},</if>
- <if test="pblmImgNum != null and pblmImgNum != ''">PBLM_IMG_NUM = #{pblmImgNum},</if>
- <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
- <if test="rectMeas != null and rectMeas != ''">RECT_MEAS = #{rectMeas},</if>
- <if test="rectImgSum != null and rectImgSum != ''">RECT_IMG_SUM = #{rectImgSum},</if>
- <if test="rectImgNum != null and rectImgNum != ''">RECT_IMG_NUM = #{rectImgNum},</if>
- <if test="fdTm != null">FD_TM = #{fdTm},</if>
- <if test="rectLead != null and rectLead != ''">RECT_LEAD = #{rectLead},</if>
- <if test="rectMemb != null and rectMemb != ''">RECT_MEMB = #{rectMemb},</if>
- <if test="rectTm != null">RECT_TM = #{rectTm},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <insert id="insertList" parameterType="java.util.List" useGeneratedKeys="false">
- insert into BIS_INSP_FSC_PBLM(
- <include refid="table_columns"/>
- )
- <foreach collection="list" item="item" index="index" open="values " separator=",">
- (
- <include refid="entity_properties_item"/>
- )
- </foreach>
- </insert>
- <select id="findPblmList" parameterType="cn.com.goldenwater.dcproj.param.FileParam"
- resultType="cn.com.goldenwater.dcproj.dto.BisInspFscPblmDto">
- select x.id as groupObjId,x.name,x.ad_full_name,x.riverName,x.type,x.adm_org org,p.* from (
- select * from (
- select A.*,b.id as rgstrId,CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS fscState,(case when b.name is
- null then cast(c.name as char) else b.name end) as name,b.type,b.IN_TM,b.UP_TM,
- c.id as baseId,b.adm_org,
- (case when b.location is null then c.location else b.location end) as location,ia.pnm groupName,ria.pnm
- riverName,ad.ad_full_name from BIS_INSP_ALL_OBJ A join BIS_INSP_FSC_RGSTR B on A.Obj_Id = B.Obj_Id left join
- att_fsc_base c on a.code = c.id
- left join ATT_AD_X_BASE ad on b.ad_code = ad.ad_code LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
- left join BIS_INSP_ALL ria on substr(A.ID,1,6) = ria.id
- where 1 = 1
- <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
- <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND B.IN_TM >= STR_TO_DATE(#{sttm},'%Y-%m-%d') AND B.UP_TM < STR_TO_DATE(#{entm},'%Y-%m-%d')
- </if>
- and
- A.id in (${inIdsSql})
- ) where 1 = 1
- <if test="state != null and state != ''">
- and fscState in (${state})
- </if>
- <if test="name != null and name != ''">
- and name like '%${name}%'
- </if>
- ) x left join BIS_INSP_FSC_PBLM p on x.rgstrId = p.rgstr_id
- </select>
- </mapper>
|