| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <?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.AttOrgBaseDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.AttOrgBase" id="attOrgBaseResultMap">
- <result property="guid" column="GUID"/>
- <result property="pguid" column="PGUID"/>
- <result property="orgCode" column="ORG_CODE"/>
- <result property="orgName" column="ORG_NAME"/>
- <result property="orgLevel" column="ORG_LEVEL"/>
- <result property="orgGrad" column="ORG_GRAD"/>
- <result property="orgType" column="ORG_TYPE"/>
- <result property="ordernum" column="ORDERNUM"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="status" column="STATUS"/>
- <result property="modifier" column="MODIFIER"/>
- <result property="fromDate" column="FROM_DATE"/>
- <result property="toDate" column="TO_DATE"/>
- <result property="note" column="NOTE"/>
- <result property="jurd" column="JURD"/>
- <result property="areaType" column="AREA_TYPE"/>
- <result property="nodeCode" column="NODE_CODE"/>
- </resultMap>
- <sql id="table_columns">
- GUID,
- PGUID,
- ORG_CODE,
- ORG_NAME,
- ORG_LEVEL,
- ORG_GRAD,
- ORG_TYPE,
- ORDERNUM,
- AD_CODE,
- STATUS,
- MODIFIER,
- FROM_DATE,
- TO_DATE,
- NOTE,
- JURD,
- AREA_TYPE,
- NODE_CODE
- </sql>
- <sql id="entity_properties">
- #{guid},
- #{pguid},
- #{orgCode},
- #{orgName},
- #{orgLevel},
- #{orgGrad},
- #{orgType},
- #{ordernum},
- #{adCode},
- #{status},
- #{modifier},
- #{fromDate},
- #{toDate},
- #{note},
- #{jurd},
- #{areaType},
- #{nodeCode}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="pguid != null and pguid != ''">and PGUID = #{pguid}</if>
- <if test="orgCode != null and orgCode != ''">and ORG_CODE = #{orgCode}</if>
- <if test="orgName != null and orgName != ''">and ORG_NAME = #{orgName}</if>
- <if test="orgLevel != null and orgLevel != ''">and ORG_LEVEL = #{orgLevel}</if>
- <if test="orgGrad != null and orgGrad != ''">and ORG_GRAD = #{orgGrad}</if>
- <if test="orgType != null and orgType != ''">and ORG_TYPE = #{orgType}</if>
- <if test="ordernum != null and ordernum != ''">and ORDERNUM = #{ordernum}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE LIKE #{adCode}</if>
- <if test="status != null and status != ''">and STATUS = #{status}</if>
- <if test="modifier != null and modifier != ''">and MODIFIER = #{modifier}</if>
- <if test="fromDate != null">and FROM_DATE = #{fromDate}</if>
- <if test="toDate != null">and TO_DATE = #{toDate}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="jurd != null and jurd != ''">and JURD = #{jurd}</if>
- <if test="areaType != null and areaType != ''">and AREA_TYPE = #{areaType}</if>
- <if test="nodeCode != null and nodeCode != ''">and NODE_CODE = #{nodeCode}</if>
- </trim>
- </sql>
- <select id="get" resultMap="attOrgBaseResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from att_org_base where GUID = #{id}
- </select>
- <select id="getBy" resultMap="attOrgBaseResultMap">
- select
- <include refid="table_columns"/>
- from att_org_base
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="attOrgBaseResultMap">
- select
- <include refid="table_columns"/>
- from att_org_base
- </select>
- <select id="findList" resultMap="attOrgBaseResultMap">
- select
- <include refid="table_columns"/>
- from att_org_base
- <include refid="page_where"/>
- ORDER BY ORDERNUM ASC
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from att_org_base
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttOrgBase">
- insert into att_org_base(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from att_org_base where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttOrgBase">
- delete from att_org_base
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update att_org_base set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttOrgBase">
- update att_org_base
- <trim prefix="set" suffixOverrides=",">
- <if test="pguid != null and pguid != ''">PGUID = #{pguid},</if>
- <if test="orgCode != null and orgCode != ''">ORG_CODE = #{orgCode},</if>
- <if test="orgName != null and orgName != ''">ORG_NAME = #{orgName},</if>
- <if test="orgLevel != null and orgLevel != ''">ORG_LEVEL = #{orgLevel},</if>
- <if test="orgGrad != null and orgGrad != ''">ORG_GRAD = #{orgGrad},</if>
- <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
- <if test="ordernum != null and ordernum != ''">ORDERNUM = #{ordernum},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="status != null and status != ''">STATUS = #{status},</if>
- <if test="modifier != null and modifier != ''">MODIFIER = #{modifier},</if>
- <if test="fromDate != null">FROM_DATE = #{fromDate},</if>
- <if test="toDate != null">TO_DATE = #{toDate},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="jurd != null and jurd != ''">JURD = #{jurd},</if>
- <if test="areaType != null and areaType != ''">AREA_TYPE = #{areaType},</if>
- <if test="nodeCode != null and nodeCode != ''">NODE_CODE = #{nodeCode},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttOrgBase">
- update att_org_base
- <trim prefix="set" suffixOverrides=",">
- <if test="pguid != null and pguid != ''">PGUID = #{pguid},</if>
- <if test="orgCode != null and orgCode != ''">ORG_CODE = #{orgCode},</if>
- <if test="orgName != null and orgName != ''">ORG_NAME = #{orgName},</if>
- <if test="orgLevel != null and orgLevel != ''">ORG_LEVEL = #{orgLevel},</if>
- <if test="orgGrad != null and orgGrad != ''">ORG_GRAD = #{orgGrad},</if>
- <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
- <if test="ordernum != null and ordernum != ''">ORDERNUM = #{ordernum},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="status != null and status != ''">STATUS = #{status},</if>
- <if test="modifier != null and modifier != ''">MODIFIER = #{modifier},</if>
- <if test="fromDate != null">FROM_DATE = #{fromDate},</if>
- <if test="toDate != null">TO_DATE = #{toDate},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="jurd != null and jurd != ''">JURD = #{jurd},</if>
- <if test="areaType != null and areaType != ''">AREA_TYPE = #{areaType},</if>
- <if test="nodeCode != null and nodeCode != ''">NODE_CODE = #{nodeCode},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <select id="getOrgListBySchmId" resultType="cn.com.goldenwater.dcproj.model.AttOrgBase">
- select t1.*
- from BIS_INSP_DVDWK t
- left join ATT_ORG_BASE t1
- on TRIM (t.org_dp) = TRIM (t1.guid)
- where TRIM (t.schm_id) = TRIM (#{schmId})
- </select>
- <!--查所有关联流域及行政区划-->
- <select id="getFirstOrgOrAdByCodeAndType" resultType="cn.com.goldenwater.dcproj.model.AdOrOrg">
- select *
- from ((select t1.ad_code as code, t1.ad_name as name, 2 as type
- from ATT_AD_BASE t1
- where t1.ad_code like '__0000000000'
- and t1.ad_code != '000000000000') union all
- (select t.guid as code, t.org_name as name, 1 as type
- from ATT_ORG_BASE t
- where t.pguid = 'F55E8EE21E084FA28EF47DB52BABE505'
- and t.area_type = '4')) temp
- order by temp.type desc, temp.code asc
- </select>
- <select id="getOrgByCodeAndType" resultType="cn.com.goldenwater.dcproj.model.AdOrOrg">
- select t.guid as code, t.org_name as name, 1 as type
- from ATT_ORG_BASE t
- where t.status = '1'
- and t.pguid = #{code}
- </select>
- <!--根据方案id和行政区划id查询关联的行政区及机构,参数示例1和4355A1641209412DA5534DE05A941BCC -->
- <select id="getOrgOrAdBySchmIdAndGuid" resultType="cn.com.goldenwater.dcproj.model.AdOrOrg">
- select *
- from ((select t1.ad_code as code, t1.ad_name as name, 2 as type
- from ATT_AD_BASE t1
- where TRIM (t1.guid) in (select d.vst_dp
- from BIS_INSP_DVDWK d
- where TRIM(d.schm_id) = TRIM(#{schmId})
- and TRIM(d.org_dp) = TRIM(#{guid})
- and TRIM (d.dptype) = '2')) union all
- (select t.guid as code, t.org_name as name, 1 as type
- from ATT_ORG_BASE t
- where TRIM (t.guid) in (select d.vst_dp
- from BIS_INSP_DVDWK d
- where TRIM(d.schm_id) = TRIM(#{schmId})
- and TRIM(d.org_dp) = TRIM(#{guid})
- and TRIM (d.dptype) = '1'))) temp
- order by temp.type desc, temp.code asc
- </select>
- <select id="getListByPid" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.AttOrgBase">
- SELECT GUID,
- PGUID,
- ORG_CODE,
- ORG_NAME,
- ORG_LEVEL,
- ORG_GRAD,
- ORG_TYPE,
- ORDERNUM,
- AD_CODE,
- STATUS,
- MODIFIER,
- NOTE,
- JURD,
- AREA_TYPE,
- NODE_CODE FROM ATT_ORG_BASE WHERE pguid = #{pid}
- </select>
- </mapper>
|