| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- <?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.BisInspMfdpRgstrDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr" id="bisInspMfdpRgstrResultMap">
- <result property="id" column="ID"/>
- <result property="objId" column="OBJ_ID"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="adName" column="AD_NAME"/>
- <result property="poorCountry" column="POOR_COUNTRY"/>
- <result property="inspType" column="INSP_TYPE"/>
- <result property="sitroTownNum" column="SITRO_TOWN_NUM"/>
- <result property="sitroVlgNum" column="SITRO_VLG_NUM"/>
- <result property="sitroRxNum" column="SITRO_RX_NUM"/>
- <result property="sitroMsNum" column="SITRO_MS_NUM"/>
- <result property="state" column="STATE"/>
- <result property="groupLeader" column="GROUP_LEADER"/>
- <result property="groupLeaderTel" column="GROUP_LEADER_TEL"/>
- <result property="recPersId" column="REC_PERS_ID"/>
- <result property="recPers" column="REC_PERS"/>
- <result property="recPersTel" column="REC_PERS_TEL"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- <result property="note" column="NOTE"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- OBJ_ID,
- AD_CODE,
- AD_NAME,
- POOR_COUNTRY,
- INSP_TYPE,
- SITRO_TOWN_NUM,
- SITRO_VLG_NUM,
- SITRO_RX_NUM,
- SITRO_MS_NUM,
- STATE,
- GROUP_LEADER,
- GROUP_LEADER_TEL,
- REC_PERS_ID,
- REC_PERS,
- REC_PERS_TEL,
- INTM,
- UPTM,
- NOTE
- </sql>
- <sql id="entity_properties">
- #{id},
- #{objId},
- #{adCode},
- #{adName},
- #{poorCountry},
- #{inspType},
- #{sitroTownNum},
- #{sitroVlgNum},
- #{sitroRxNum},
- #{sitroMsNum},
- #{state},
- #{groupLeader},
- #{groupLeaderTel},
- #{recPersId},
- #{recPers},
- #{recPersTel},
- #{intm},
- #{uptm},
- #{note}
- </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>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
- <if test="poorCountry != null and poorCountry != ''">and POOR_COUNTRY = #{poorCountry}</if>
- <if test="inspType != null and inspType != ''">and INSP_TYPE = #{inspType}</if>
- <if test="sitroTownNum != null and sitroTownNum != ''">and SITRO_TOWN_NUM = #{sitroTownNum}</if>
- <if test="sitroVlgNum != null and sitroVlgNum != ''">and SITRO_VLG_NUM = #{sitroVlgNum}</if>
- <if test="sitroRxNum != null and sitroRxNum != ''">and SITRO_RX_NUM = #{sitroRxNum}</if>
- <if test="sitroMsNum != null and sitroMsNum != ''">and SITRO_MS_NUM = #{sitroMsNum}</if>
- <if test="state != null and state != ''">and STATE = #{state}</if>
- <if test="groupLeader != null and groupLeader != ''">and GROUP_LEADER = #{groupLeader}</if>
- <if test="groupLeaderTel != null and groupLeaderTel != ''">and GROUP_LEADER_TEL = #{groupLeaderTel}</if>
- <if test="recPersId != null and recPersId != ''">and REC_PERS_ID = #{recPersId}</if>
- <if test="recPers != null and recPers != ''">and REC_PERS = #{recPers}</if>
- <if test="recPersTel != null and recPersTel != ''">and REC_PERS_TEL = #{recPersTel}</if>
- <if test="intm != null">and INTM = #{intm}</if>
- <if test="uptm != null">and UPTM = #{uptm}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- </trim>
- </sql>
- <select id="get" resultMap="bisInspMfdpRgstrResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from BIS_INSP_MFDP_RGSTR where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspMfdpRgstrResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_MFDP_RGSTR
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="bisInspMfdpRgstrResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_MFDP_RGSTR
- </select>
- <select id="findList" resultMap="bisInspMfdpRgstrResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_MFDP_RGSTR
- <include refid="page_where"/>
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from BIS_INSP_MFDP_RGSTR
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr">
- insert into BIS_INSP_MFDP_RGSTR(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from BIS_INSP_MFDP_RGSTR where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr">
- delete from BIS_INSP_MFDP_RGSTR
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_MFDP_RGSTR set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr">
- update BIS_INSP_MFDP_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="poorCountry != null and poorCountry != ''">POOR_COUNTRY = #{poorCountry},</if>
- <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
- <if test="sitroTownNum != null and sitroTownNum != ''">SITRO_TOWN_NUM = #{sitroTownNum},</if>
- <if test="sitroVlgNum != null and sitroVlgNum != ''">SITRO_VLG_NUM = #{sitroVlgNum},</if>
- <if test="sitroRxNum != null and sitroRxNum != ''">SITRO_RX_NUM = #{sitroRxNum},</if>
- <if test="sitroMsNum != null and sitroMsNum != ''">SITRO_MS_NUM = #{sitroMsNum},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER = #{groupLeader},</if>
- <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL = #{groupLeaderTel},</if>
- <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
- <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
- <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspMfdpRgstr">
- update BIS_INSP_MFDP_RGSTR
- <trim prefix="set" suffixOverrides=",">
- <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="poorCountry != null and poorCountry != ''">POOR_COUNTRY = #{poorCountry},</if>
- <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
- <if test="sitroTownNum != null and sitroTownNum != ''">SITRO_TOWN_NUM = #{sitroTownNum},</if>
- <if test="sitroVlgNum != null and sitroVlgNum != ''">SITRO_VLG_NUM = #{sitroVlgNum},</if>
- <if test="sitroRxNum != null and sitroRxNum != ''">SITRO_RX_NUM = #{sitroRxNum},</if>
- <if test="sitroMsNum != null and sitroMsNum != ''">SITRO_MS_NUM = #{sitroMsNum},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER = #{groupLeader},</if>
- <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL = #{groupLeaderTel},</if>
- <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
- <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
- <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <select id="findMfdpList" parameterType="cn.com.goldenwater.dcproj.param.TypeParam"
- resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
- SELECT * FROM (
- SELECT
- A.CODE, A.ID nodeId, A.NM, A.PTYPE pType, A.OBJ_ID,B.ID ID,b.id as rgstrId,
- b.SITRO_TOWN_NUM, b.SITRO_VLG_NUM, b.SITRO_RX_NUM, b.SITRO_MS_NUM, B.INTM,
- b.ad_code,(case when b.State is null then '0' else b.state end)STATE,
- C.LGTDPC pc_x, c.LTTDPC pc_y, C.LGTD GD_X, C.LTTD GD_y,
- c.ad_full_name as adName, ia.pnm groupName
- FROM BIS_INSP_ALL_OBJ A
- LEFT JOIN BIS_INSP_MFDP_RGSTR B ON A.OBJ_ID=B.OBJ_ID
- LEFT JOIN ATT_AD_X_BASE C ON B.AD_CODE=C.AD_CODE
- LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
- <where>
- <if test="pType != null and pType != '' ">
- A.PTYPE= #{pType}
- </if>
- <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="adCodes ==null or adCodes =='' ">
- <if test="inIdsSql != null and inIdsSql !=''">
- and A.id in (${inIdsSql})
- </if>
- </if>
- <if test="poorCountry != null and poorCountry != ''">
- and (case when b.POOR_COUNTRY is null then c.IS_REPORT else b.POOR_COUNTRY end ) = #{poorCountry}
- </if>
- <if test="adCode != null and adCode != ''">
- and b.ad_code like '${adCode}%'
- </if>
- <choose>
- <when test="province !=null and province !=''">
- and A.AD_CODE like '${province}%'
- </when>
- <otherwise>
- and A.AD_CODE is null
- </otherwise>
- </choose>
- </where>
- ) A
- <where>
- <if test="plnaId !=null and plnaId !=''">
- and a.nodeId like '${plnaId}%'
- </if>
- <if test="state !=null and state !=''">
- and STATE in (${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>
- <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
- <if test="adCodes !=null and adCodes !=''">
- and
- <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
- ad_code like concat('${item}','%')
- </foreach>
- </if>
- </where>
- order by nodeId asc
- <if test="orderBy != null and orderBy != ''">
- ,CONVERT(nm using GBK)
- </if>
- </select>
- <select id="findPblmList" resultType="cn.com.goldenwater.dcproj.model.BisInspPblm"
- parameterType="cn.com.goldenwater.dcproj.param.PlbmParam">
- select w.* from (
- select j.id as oid,j.obj_id,m.pblm_id,m.obj_type,m.insp_pblm_name
- ,m.insp_pblm_desc,m.pblm_long,m.pblm_lat,s.check_point,m.INSP_PBLM_CATE,
- m.new_vill_name,j.nm,m.vill_type,m.has_vedio,m.quote,m.rec_pers,
- m.regid,j.code as ad_code,ba.ad_full_name,s.sn_num,p.pers_name,al.sttm,al.entm,
- m.insp_add_desc,m.coll_time,(select l.pnm from bis_insp_all l where l.id=substr(al.id,0,6)) as pnm,
- (select org_nm from bis_insp_org where org_id=substr(al.id,4,3)) as org_nm
- from (select m.* from BIS_INSP_PBLM m where m.obj_type='27'
- ) m
- join (select * from BIS_INSP_ALL_OBJ j where j.pType='27') j on m.obj_id=j.obj_id
- join obj_insp_pblms s on m.pblms_type_id=s.guid
- left join bis_insp_all al on al.id=j.id
- left join bis_insp_all_rlation_pers p on m.rec_pers=p.guid
- left join att_ad_x_base ba on j.code=ba.ad_code
- ) w
- where 1=1
- <if test="tabType =='2'.toString()">
- and w.entm <DATE_FORMAT(#{nowTime},'%Y-%m-%d')
- </if>
- <if test="tabType =='1'.toString()">
- and w.entm >=DATE_FORMAT(#{nowTime},'%Y-%m-%d')
- </if>
- and
- w.oid in (${inIdsSql})
- <if test="inspPblmName !=null and inspPblmName !=''">
- and w.insp_pblm_name in (${inspPblmName})
- </if>
- <if test="checkPoint !=null and checkPoint !=''">
- and w.check_point in (${checkPoint})
- </if>
- <if test="inspPblmCate !=null and inspPblmCate !=''">
- and w.INSP_PBLM_CATE in (${inspPblmCate})
- </if>
- <if test="pblmName != null and pblmName != ''">
- and INSP_PBLM_NAME like concat(concat('%',#{pblmName}),'%')
- </if>
- <if test="startTime != null and startTime != ''">and COLL_TIME >= DATE_FORMAT(#{startTime},'%Y-%m-%d')</if>
- <if test="findTime != null and findTime != ''">and COLL_TIME=DATE_FORMAT(#{findTime},'%Y-%m-%d')</if>
- <if test="endTime != null and endTime != ''">and COLL_TIME < DATE_FORMAT(#{endTime},'%Y-%m-%d')</if>
- <if test="oides != null and oides != ''">and oid in (${oides})</if>
- <if test="regid !=null and regid !=''">
- and w.regid=#{regid}
- </if>
- <if test="recPers !=null and recPers !=''">
- and w.rec_Pers=#{recPers}
- </if>
- <if test="objId !=null and objId !=''">
- and w.obj_id=#{objId}
- </if>
- <if test="groupId !=null and groupId !=''">
- and oid like '${groupId}%'
- </if>
- <if test="adFullName !=null and adFullName !=''">
- and w.AD_FULL_NAMe like '%${adFullName}%'
- </if>
- <if test="persName !=null and persName !=''">
- and w.PERS_NAME like '%${persName}%'
- </if>
- <if test="nm !=null and nm !=''">
- and w.NM like '%${nm}%'
- </if>
- <if test="orgNm !=null and orgNm !=''">
- and w.ORG_NM like '%${orgNm}%'
- </if>
- <if test="hasVedio !=null and hasVedio !=''">
- and w.HAS_VEDIO=#{hasVedio}
- </if>
- <if test="adCode !=null and adCode !=''">
- and w.AD_CODE like '${adCode}%'
- </if>
- order by w.AD_CODE
- <if test="orderBy !=null and orderBy !=''">
- ,${orderBy}
- </if>
- </select>
- </mapper>
|