| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?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.BisInspOrgDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspOrg" id="bisInspOrgResultMap">
- <result property="norgId" column="NORG_ID"/>
- <result property="norgPid" column="NORG_PID"/>
- <result property="orgId" column="ORG_ID"/>
- <result property="orgPid" column="ORG_PID"/>
- <result property="orgNm" column="ORG_NM"/>
- <result property="rlcode" column="RLCODE"/>
- <result property="orgType" column="ORG_TYPE"/>
- </resultMap>
- <sql id="table_columns">
- NORG_ID,
- NORG_PID,
- ORG_ID,
- ORG_PID,
- ORG_NM,
- RLCODE,
- ORG_TYPE
- </sql>
- <sql id="entity_properties">
- #{norgId},
- #{norgPid},
- #{orgId},
- #{orgPid},
- #{orgNm},
- #{rlcode},
- #{orgType}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="norgPid != null and norgPid != ''">and NORG_PID = #{norgPid}</if>
- <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
- <if test="orgPid != null and orgPid != ''">and ORG_PID = #{orgPid}</if>
- <if test="orgNm != null and orgNm != ''">and ORG_NM = #{orgNm}</if>
- <if test="rlcode != null and rlcode != ''">and RLCODE = #{rlcode}</if>
- <if test="orgType != null and orgType != ''">and ORG_TYPE = #{orgType}</if>
- </trim>
- </sql>
- <select id="get" resultMap="bisInspOrgResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from bis_insp_org where ORG_ID = #{orgId}
- </select>
- <select id="getBy" resultMap="bisInspOrgResultMap">
- select
- <include refid="table_columns"/>
- from bis_insp_org
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="bisInspOrgResultMap">
- select
- <include refid="table_columns"/>
- from bis_insp_org
- </select>
- <select id="findPersOrgList" resultMap="bisInspOrgResultMap">
- SELECT O.ORG_ID,O.ORG_PID,O.ORG_NM,O.AD_CODE,O.RLCODE
- FROM BIS_INSP_ORG O,BIS_INSP_PERS_ORG G
- WHERE O.ORG_ID=G.ORG_ID
- <if test="persId != null and persId != ''">and g.PERS_ID = #{persId}</if>
- ORDER BY O.RLCODE
- </select>
- <select id="findList" resultMap="bisInspOrgResultMap">
- select
- <include refid="table_columns"/>
- from bis_insp_org
- <include refid="page_where"/>
- </select>
- <select id="selectCount" resultType="int">
- select count(ORG_ID) from bis_insp_org
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspOrg">
- insert into bis_insp_org(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from bis_insp_org where ORG_ID = #{orgId}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspOrg">
- delete from bis_insp_org
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update bis_insp_org set flag_valid = 0 where ORG_ID = #{orgId}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspOrg">
- update bis_insp_org
- <trim prefix="set" suffixOverrides=",">
- <if test="norgPid != null and norgPid != ''">NORG_PID = #{norgPid},</if>
- <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
- <if test="orgPid != null and orgPid != ''">ORG_PID = #{orgPid},</if>
- <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
- <if test="rlcode != null and rlcode != ''">RLCODE = #{rlcode},</if>
- <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
- </trim>
- <where>ORG_ID = #{orgId}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspOrg">
- update bis_insp_org
- <trim prefix="set" suffixOverrides=",">
- <if test="norgPid != null and norgPid != ''">NORG_PID = #{norgPid},</if>
- <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
- <if test="orgPid != null and orgPid != ''">ORG_PID = #{orgPid},</if>
- <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
- <if test="rlcode != null and rlcode != ''">RLCODE = #{rlcode},</if>
- <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <!--根据年份和批次获取要下发的省级信息-->
- <select id="getOrgByTac" resultType="cn.com.goldenwater.dcproj.model.BisInspOrg">
- SELECT * FROM BIS_INSP_ORG WHERE ORG_ID IN (
- select concat('034',substr(AD_CODE,1,#{adLength}) ) from TAC_INSP_YEAR_BATCH_OBJ A
- JOIN TAC_PAWP_RGSTR B ON A.ID=B.OBJ_ID
- WHERE B.STATE=#{state} and a.year=#{year} and A.BATCH=#{batch})
- </select>
- </mapper>
|