| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- <?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.BisInspWintRgstrDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspWintRgstr" id="bisInspWintRgstrResultMap">
- <result property="id" column="ID"/>
- <result property="objId" column="OBJ_ID"/>
- <result property="province" column="PROVINCE"/>
- <result property="adName" column="AD_NAME"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="loc" column="LOC"/>
- <result property="pcX" column="PC_X"/>
- <result property="pcY" column="PC_Y"/>
- <result property="gdX" column="GD_X"/>
- <result property="gdY" column="GD_Y"/>
- <result property="bChkUnit" column="B_CHK_UNIT"/>
- <result property="contact" column="CONTACT"/>
- <result property="contactTel" column="CONTACT_TEL"/>
- <result property="principal" column="PRINCIPAL"/>
- <result property="principalTel" column="PRINCIPAL_TEL"/>
- <result property="note" column="NOTE"/>
- <result property="state" column="STATE"/>
- <result property="dataStat" column="DATA_STAT"/>
- <result property="chkUnit" column="CHK_UNIT"/>
- <result property="chkPers" column="CHK_PERS"/>
- <result property="chkTm" column="CHK_TM"/>
- <result property="intInfoStat" column="INT_INFO_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,
- OBJ_ID,
- AD_NAME,
- AD_CODE,
- LOC,
- PC_X,
- PC_Y,
- GD_X,
- GD_Y,
- B_CHK_UNIT,
- CONTACT,
- CONTACT_TEL,
- PRINCIPAL,
- PRINCIPAL_TEL,
- NOTE,
- STATE,
- DATA_STAT,
- CHK_UNIT,
- CHK_PERS,
- CHK_TM,
- INT_INFO_STAT,
- PERS_ID,
- GROUP_ID,
- IN_TM,
- UP_TM,PROVINCE
- </sql>
- <sql id="entity_properties">
- #{id},
- #{objId},
- #{adName},
- #{adCode},
- #{loc},
- #{pcX},
- #{pcY},
- #{gdX},
- #{gdY},
- #{bChkUnit},
- #{contact},
- #{contactTel},
- #{principal},
- #{principalTel},
- #{note},
- #{state},
- #{dataStat},
- #{chkUnit},
- #{chkPers},
- #{chkTm},
- #{intInfoStat},
- #{persId},
- #{groupId},
- #{inTm},
- #{upTm},#{province}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
- <choose>
- <when test="province !=null and province !=''">
- and province =#{province}
- </when>
- <otherwise>
- and province is null
- </otherwise>
- </choose>
- <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <if test="loc != null and loc != ''">and LOC = #{loc}</if>
- <if test="pcX != null and pcX != ''">and PC_X = #{pcX}</if>
- <if test="pcY != null and pcY != ''">and PC_Y = #{pcY}</if>
- <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
- <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
- <if test="bChkUnit != null and bChkUnit != ''">and B_CHK_UNIT = #{bChkUnit}</if>
- <if test="contact != null and contact != ''">and CONTACT = #{contact}</if>
- <if test="contactTel != null and contactTel != ''">and CONTACT_TEL = #{contactTel}</if>
- <if test="principal != null and principal != ''">and PRINCIPAL = #{principal}</if>
- <if test="principalTel != null and principalTel != ''">and PRINCIPAL_TEL = #{principalTel}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="state != null and state != ''">and STATE = #{state}</if>
- <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
- <if test="chkUnit != null and chkUnit != ''">and CHK_UNIT = #{chkUnit}</if>
- <if test="chkPers != null and chkPers != ''">and CHK_PERS = #{chkPers}</if>
- <if test="chkTm != null">and CHK_TM = #{chkTm}</if>
- <if test="intInfoStat != null and intInfoStat != ''">and INT_INFO_STAT = #{intInfoStat}</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="bisInspWintRgstrResultMap" parameterType="String" >
- select <include refid="table_columns" /> from BIS_INSP_WINT_RGSTR where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspWintRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_WINT_RGSTR <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="bisInspWintRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_WINT_RGSTR
- </select>
- <select id="findList" resultMap="bisInspWintRgstrResultMap">
- select <include refid="table_columns" /> from BIS_INSP_WINT_RGSTR <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from BIS_INSP_WINT_RGSTR <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspWintRgstr">
- insert into BIS_INSP_WINT_RGSTR( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_INSP_WINT_RGSTR where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWintRgstr">
- delete from BIS_INSP_WINT_RGSTR <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_WINT_RGSTR set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspWintRgstr">
- update BIS_INSP_WINT_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="province != null and province != ''">PROVINCE = #{province},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- LOC = #{loc},
- PC_X = #{pcX},
- PC_Y = #{pcY},
- GD_X = #{gdX},
- GD_Y = #{gdY},
- B_CHK_UNIT = #{bChkUnit},
- CONTACT = #{contact},
- CONTACT_TEL = #{contactTel},
- PRINCIPAL = #{principal},
- PRINCIPAL_TEL = #{principalTel},
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- CHK_UNIT = #{chkUnit},
- CHK_PERS = #{chkPers},
- CHK_TM = #{chkTm},
- <if test="intInfoStat != null and intInfoStat != ''">INT_INFO_STAT = #{intInfoStat},</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.BisInspWintRgstr">
- update BIS_INSP_WINT_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="province != null and province != ''">PROVINCE = #{province},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- LOC = #{loc},
- PC_X = #{pcX},
- PC_Y = #{pcY},
- GD_X = #{gdX},
- GD_Y = #{gdY},
- B_CHK_UNIT = #{bChkUnit},
- CONTACT = #{contact},
- CONTACT_TEL = #{contactTel},
- PRINCIPAL = #{principal},
- PRINCIPAL_TEL = #{principalTel},
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- CHK_UNIT = #{chkUnit},
- CHK_PERS = #{chkPers},
- CHK_TM = #{chkTm},
- <if test="intInfoStat != null and intInfoStat != ''">INT_INFO_STAT = #{intInfoStat},</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 id="choseSql">
- <choose>
- <when test="province !=null and province !=''">
- and B.province like '${province}%'
- </when>
- <otherwise>
- and B.province is null
- </otherwise>
- </choose>
- </sql>
- <select id="getListByInspGroupIdObjType" parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam"
- resultType="cn.com.goldenwater.dcproj.model.BisInspWintRgstr" >
- select t.*,C.id groupId,C.PNM groupName,B.obj_id,r.loc
- from att_ad_x_base t
- left join BIS_INSP_ALL_OBJ B
- on B.CODE = t.ad_code
- LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
- and B.ptype = #{objType}
- left join BIS_INSP_WINT_RGSTR r on b.obj_id=r.obj_id
- where 1 = 1
- <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
- <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
- <if test="adCode != null and adCode != ''">
- and t.AD_CODE like '${adCode}%'
- </if>
- <choose>
- <when test="province != null and province != ''">
- and B.AD_CODE LIKE '${province}%'
- </when>
- <otherwise>
- and B.AD_CODE is null
- </otherwise>
- </choose>
- </select>
- <sql id="orgIdSql">
- <choose>
- <when test="orgId !=null and orgId !=''">
- and ORG_ID=#{orgId}
- </when>
- <otherwise>
- and ORG_ID is null
- </otherwise>
- </choose>
- </sql>
- <!-- 其他自定义SQL -->
- <select id="findCityPage" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto" parameterType="cn.com.goldenwater.dcproj.param.TypeParam">
- SELECT * FROM (
- select A.CODE,A.ID nodeId,
- A.NM,
- #{pType} PTYPE,
- B.pc_x,
- B.pc_y,
- B.GD_X,
- B.GD_y,
- A.OBJ_ID,B.ID ID,
- (case when b.loc is null then c.ad_full_name else b.loc end) as location,
- (case when b.State is null then '0' else b.state end)STATE
- ,B.IN_TM,
- B.INT_INFO_STAT,
- c.ad_full_name as adName,
- ia.pnm groupName
- from BIS_INSP_ALL_OBJ
- A LEFT JOIN BIS_INSP_WINT_RGSTR B ON A.OBJ_ID=B.OBJ_ID
- LEFT JOIN ATT_AD_X_BASE C ON A.CODE=C.AD_CODE
- LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
- where A.ptype= #{pType}
- <if test="tabType =='2'.toString()">
- and ia.entm <DATE_FORMAT(#{nowTime},'%Y-%m-%d')
- </if>
- <if test="tabType =='1'.toString()">
- and ia.entm >=DATE_FORMAT(#{nowTime},'%Y-%m-%d')
- </if>
- <if test="inIdsSql != null and inIdsSql != '' ">
- and A.id in (${inIdsSql})
- </if>
- <include refid="choseSql"/>
- ) A
- WHERE a.PTYPE=#{pType}
- <if test="plnaId !=null and plnaId !=''">
- and a.nodeId like '${plnaId}%'
- </if>
- <if test="state !=null and state !=''">
- and STATE=#{state}
- </if>
- <if test="rsName !=null and rsName !=''">
- and a.nm like '%${rsName}%'
- </if>
- <if test="code !=null and code !=''">
- and a.code = #{code}
- </if>
- <if test="adName != null and adName != ''">and a.adName like '%${adName}%'</if>
- <if test="sttm != null and sttm != ''">and a.IN_TM>= DATE_FORMAT(#{sttm},'%Y-%m-%d')</if>
- <if test="entm != null and entm != ''">and a.IN_TM < DATE_FORMAT(#{entm},'%Y-%m-%d')</if>
- order by nodeId asc
- <if test="orderBy != null and orderBy != ''">
- , CONVERT(nm USING gbk)
- </if>
- </select>
- <update id="updateWintRgstrState" parameterType="java.lang.String">
- update BIS_INSP_WINT_RGSTR t set t.STATE = '2' where t.id = #{id}
- </update>
- </mapper>
|