<?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="com.unis.base.server.dao.DRyxxsjyDao" >

	<resultMap id="BaseResultMap" type="com.unis.base.server.entity.DRyxxsjyDO" >
        <result column="rybh" property="rybh" jdbcType="VARCHAR" />
        <result column="ryxm" property="ryxm" jdbcType="VARCHAR" />
        <result column="kddm" property="kddm" jdbcType="VARCHAR" />

        <result column="kdmc" property="kdmc" jdbcType="VARCHAR" />
        <result column="sfzh" property="sfzh" jdbcType="VARCHAR" />
        <result column="xb" property="xb" jdbcType="VARCHAR" />
        <result column="jg" property="jg" jdbcType="VARCHAR" />
        <result column="mz" property="mz" jdbcType="VARCHAR" />
        <result column="cssj" property="cssj" jdbcType="VARCHAR" />
        <result column="cjgzsj" property="cjgzsj" jdbcType="VARCHAR" />
        <result column="whcd" property="whcd" jdbcType="VARCHAR" />
        <result column="xxzy" property="xxzy" jdbcType="VARCHAR" />
        <result column="zzmm" property="zzmm" jdbcType="VARCHAR" />
        <result column="zwdm" property="zwdm" jdbcType="VARCHAR" />
        <result column="zwmc" property="zwmc" jdbcType="VARCHAR" />
        <result column="bmdm" property="bmdm" jdbcType="VARCHAR" />
        <result column="bmbdm" property="bmbdm" jdbcType="VARCHAR" />
        <result column="bmzdm" property="bmzdm" jdbcType="VARCHAR" />
        <result column="zgqkdm" property="zgqkdm" jdbcType="VARCHAR" />
        <result column="gwdm" property="gwdm" jdbcType="VARCHAR" />
        <result column="jszcdm" property="jszcdm" jdbcType="VARCHAR" />
        <result column="jszcmc" property="jszcmc" jdbcType="VARCHAR" />

        <result column="lxdh" property="lxdh" jdbcType="VARCHAR" />

        <result column="jbzs" property="jbzs" jdbcType="VARCHAR" />

        <result column="fzdw" property="fzdw" jdbcType="VARCHAR" />
		<result column="sfba" property="sfba" jdbcType="DECIMAL" />
		<result column="gddh" property="gddh" jdbcType="VARCHAR" />
		<result column="dzyx" property="dzyx" jdbcType="VARCHAR" />
		<result column="jyxs" property="jyxs" jdbcType="DECIMAL" />
		<result column="byyx" property="byyx" jdbcType="VARCHAR" />
		<result column="xw" property="xw" jdbcType="VARCHAR" />
		<result column="zcdj" property="zcdj" jdbcType="DECIMAL" />
		<result column="bzsj" property="bzsj" jdbcType="DATE" />
		<result column="qtzy" property="qtzy" jdbcType="VARCHAR" />
		<result column="qtbzjg" property="qtbzjg" jdbcType="VARCHAR" />
		<result column="qtbzsj" property="qtbzsj" jdbcType="DATE" />
		<result column="tyshxydm" property="tyshxydm" jdbcType="VARCHAR" />
		<result column="qymc" property="qymc" jdbcType="VARCHAR" />
		<result column="qyzt" property="qyzt" jdbcType="DECIMAL" />
        <result column="status" property="status" jdbcType="VARCHAR" />
        <result column="creator" property="creator" jdbcType="VARCHAR" />
        <result column="creator_code" property="creatorCode" jdbcType="VARCHAR" />
        <result column="create_date" property="createDate" jdbcType="VARCHAR" />
        <result column="refresher" property="refresher" jdbcType="VARCHAR" />
        <result column="refresher_code" property="refresherCode" jdbcType="VARCHAR" />
        <result column="refresh_time" property="refreshTime" jdbcType="VARCHAR" />
        <result column="remark" property="remark" jdbcType="VARCHAR" />

        <result column="kdmc" property="kdmc" jdbcType="VARCHAR" />

        <result column="grjj" property="grjj" jdbcType="VARCHAR" />
        <result column="clfj" property="clfj" jdbcType="VARCHAR" />
        <result column="xzqhdm" property="xzqhdm" jdbcType="VARCHAR" />
        <result column="rylb" property="rylb" jdbcType="VARCHAR" />
        <result column="czbz" property="czbz" jdbcType="VARCHAR" />
        <result column="bmmc" property="bmmc" jdbcType="VARCHAR" />
        <result column="rzrq" property="rzrq" jdbcType="VARCHAR" />
        <result column="gwxz" property="gwxz" jdbcType="VARCHAR" />

        <result column="rych" property="rych" jdbcType="VARCHAR" />
        <result column="rysydwcj" property="rysydwcj" jdbcType="VARCHAR" />
        <result column="rysydwmc" property="rysydwmc" jdbcType="VARCHAR" />
        <result column="lsly" property="lsly" jdbcType="VARCHAR" />
        <result column="ryhqsj" property="ryhqsj" jdbcType="DATE" />
        <result column="ryfj" property="ryfj" jdbcType="VARCHAR" />
    </resultMap>

    <sql id="Base_Column_List_common">
        ry.rybh, ry.ryxm, ry.kddm, ry.sfzh, ry.xb, ry.jg, ry.mz, ry.cssj, ry.cjgzsj, ry.whcd, ry.xxzy, ry.zzmm,
    	ry.zwdm, ry.zwmc, ry.bmdm, ry.bmbdm, ry.bmzdm, ry.zgqkdm, ry.gwdm, ry.jszcdm, ry.jszcmc, ry.lxdh, ry.jbzs,
    	ry.fzdw, ry.sfba, ry.gddh, ry.dzyx, ry.jyxs, ry.byyx, ry.xw, ry.zcdj, ry.bzsj, ry.qtzy, ry.qtbzjg, ry.qtbzsj,
    	ry.tyshxydm, ry.qymc, ry.qyzt, ry.refresh_time, ry.remark,
        ry.grjj, ry.clfj, ry.xzqhdm, ry.rylb, ry.czbz, ry.rzrq, ry.bmmc, ry.gwxz,
        ry.rych, ry.rysydwcj, ry.rysydwmc, ry.lsly, ry.ryhqsj, ry.ryfj
    </sql>

    <!-- 根据条件查询人员信息 -->
    <select id="getDRyxxsjyList" parameterType="com.unis.base.server.entity.DRyxxsjyDO" resultMap="BaseResultMap">
        SELECT
		<include refid="Base_Column_List_common"></include>,kd.kdmc
 		from
			D_RYXXSJY ry, D_KDXXSJY kd
		<where>
			ry.KDDM = kd.KDDM
			<!-- 人员编号 -->
	    	<if test="rybh != null and rybh != ''" >
	         	and	ry.rybh LIKE concat(CONCAT('%',#{rybh,jdbcType=VARCHAR}) ,'%')
	      	</if>
	      	<!-- 人员名称 -->
	    	<if test="ryxm != null and ryxm != ''" >
	         	and	ry.ryxm LIKE concat(CONCAT('%',#{ryxm,jdbcType=VARCHAR}) ,'%')
	      	</if>
	      	<!-- 岗位类型 -->
	    	<if test="gwdm != null and gwdm != ''" >
	         	and	ry.gwdm LIKE concat(CONCAT('%',#{gwdm,jdbcType=VARCHAR}) ,'%')
	      	</if>
	      	<!-- 库点代码 -->
	    	<if test="kddm != null and kddm != ''" >
	         	and	ry.kddm LIKE concat(CONCAT('%',#{kddm,jdbcType=VARCHAR}) ,'%')
	      	</if>
	      	<!-- 库点名称 -->
	    	<if test="kdmc != null and kdmc != ''" >
	         	and	kd.kdmc LIKE concat(CONCAT('%',#{kdmc,jdbcType=VARCHAR}) ,'%')
	      	</if>
			<!-- 是否备案 -->
			<if test='sfba != null'>
				and ry.SFBA = #{sfba,jdbcType=DECIMAL}
			</if>
			<!-- 启用状态 -->
			<if test='qyzt != null'>
				and ry.qyzt = #{qyzt,jdbcType=DECIMAL}
			</if>

				<!-- 统一社会信用代码 -->
			<if test='tyshxydm != null'>
				and ry.tyshxydm = #{tyshxydm,jdbcType=VARCHAR}
			</if>
	      	and ry.status = 1
		</where>
		ORDER BY ry.RYBH  desc
    </select>

    <select id="getDRyxxsjyInfo" parameterType="java.lang.String" resultMap="BaseResultMap">
        SELECT
		<include refid="Base_Column_List_common"></include>
        from
        D_RYXXSJY ry
		<where>
			 ry.rybh = #{rybh,jdbcType=VARCHAR}
			and ry.status = 1
		</where>
    </select>

	<!--根据人员编号获取人员信息-任何状态-->
	<select id="getPersonnelInfo" parameterType="java.lang.String" resultMap="BaseResultMap">
		SELECT
		<include refid="Base_Column_List_common"></include>
		from
		D_RYXXSJY ry
		<where>
			ry.rybh = #{rybh,jdbcType=VARCHAR}
		</where>
	</select>

    <!-- 更新人员信息 -->
    <update id="update" parameterType="com.unis.base.server.entity.DRyxxsjyDO">
	  	update D_RYXXSJY
	  	<set>
	  		<if test="ryxm != null">
	  			ryxm = #{ryxm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="kddm != null">
	  			kddm = #{kddm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sfzh != null">
	  			sfzh = #{sfzh,jdbcType=VARCHAR},
	  		</if>
	  		<if test="xb != null">
	  			xb = #{xb,jdbcType=VARCHAR},
	  		</if>

	  		<if test="jg != null">
	  			jg = #{jg,jdbcType=VARCHAR},
	  		</if>
	  		<if test="mz != null">
	  			mz = #{mz,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cssj != null">
	  			cssj = #{cssj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cjgzsj != null">
	  			cjgzsj = #{cjgzsj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="whcd != null">
	  			whcd = #{whcd,jdbcType=VARCHAR},
	  		</if>
	  		<if test="xxzy != null">
	  			xxzy = #{xxzy,jdbcType=VARCHAR},
	  		</if>
	  		<if test="zzmm != null">
	  			zzmm = #{zzmm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="zwdm != null">
	  			zwdm = #{zwdm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="zwmc != null">
	  			zwmc = #{zwmc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="bmdm != null">
	  			bmdm = #{bmdm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="bmbdm != null">
	  			bmbdm = #{bmbdm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="bmzdm != null">
	  			bmzdm = #{bmzdm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="zgqkdm != null">
	  			zgqkdm = #{zgqkdm,jdbcType=VARCHAR},
	  		</if>

	  		<if test="jszcdm != null">
	  			jszcdm = #{jszcdm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="jszcmc != null">
	  			jszcmc = #{jszcmc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="lxdh != null">
	  			lxdh = #{lxdh,jdbcType=VARCHAR},
	  		</if>
	  		<if test="jbzs != null">
	  			jbzs = #{jbzs,jdbcType=VARCHAR},
	  		</if>
	  		<if test="fzdw != null">
	  			fzdw = #{fzdw,jdbcType=VARCHAR},
	  		</if>
			<if test="sfba != null">
				sfba = #{sfba,jdbcType=DECIMAL},
			</if>
			<if test="gddh != null">
				gddh = #{gddh,jdbcType=VARCHAR},
			</if>
			<if test="dzyx != null">
				dzyx = #{dzyx,jdbcType=VARCHAR},
			</if>
			<if test="jyxs != null">
				jyxs = #{jyxs,jdbcType=DECIMAL},
			</if>
			<if test="byyx != null">
				byyx = #{byyx,jdbcType=VARCHAR},
			</if>
			<if test="xw != null">
				xw = #{xw,jdbcType=VARCHAR},
			</if>
			<if test="zcdj != null">
				zcdj = #{zcdj,jdbcType=DECIMAL},
			</if>
			<if test="bzsj != null">
				bzsj = #{bzsj,jdbcType=DATE},
			</if>
			<if test="qtzy != null">
				qtzy = #{qtzy,jdbcType=VARCHAR},
			</if>
			<if test="qtbzjg != null">
				qtbzjg = #{qtbzjg,jdbcType=VARCHAR},
			</if>
			<if test="qtbzsj != null">
				qtbzsj = #{qtbzsj,jdbcType=DATE},
			</if>
			<if test="gwdm != null">
				gwdm = #{gwdm,jdbcType=DATE},
			</if>
			<if test="tyshxydm != null">
				tyshxydm = #{tyshxydm,jdbcType=VARCHAR},
			</if>
			<if test="qymc != null">
				qymc = #{qymc,jdbcType=VARCHAR},
			</if>
			<if test="qyzt != null">
				qyzt = #{qyzt,jdbcType=DECIMAL},
			</if>
	  		<if test="refresher != null">
	  			refresher = #{refresher,jdbcType=VARCHAR},
	  		</if>
	  		<if test="refresherCode != null">
	  			refresher_code = #{refresherCode,jdbcType=VARCHAR},
	  		</if>
	  		<if test="status != null">
	  			status = #{status,jdbcType=VARCHAR},
	  		</if>
            <if test="grjj != null">
                grjj = #{grjj, jdbcType=VARCHAR},
            </if>
            <if test="clfj != null">
                clfj = #{clfj, jdbcType=VARCHAR},
            </if>
            <if test="xzqhdm != null">
                xzqhdm = #{xzqhdm, jdbcType=VARCHAR},
            </if>
            <if test="rylb != null">
                rylb = #{rylb, jdbcType=VARCHAR},
            </if>
            <choose>
                <when test="czbz == null || czbz == ''">
                    czbz = 'u',
                </when>
                <otherwise>
                    czbz = #{czbz, jdbcType=VARCHAR},
                </otherwise>
            </choose>
            <if test="bmmc != null">
                bmmc = #{bmmc, jdbcType=VARCHAR},
            </if>
            <if test="rzrq != null">
                rzrq = #{rzrq, jdbcType=VARCHAR},
            </if>
            <if test="gwxz != null">
                gwxz = #{gwxz, jdbcType=VARCHAR},
            </if>
	  	    <if test="rych != null and rych != ''">
                rych = #{rych, jdbcType=VARCHAR},
            </if>
	  	    <if test="rysydwcj != null and rysydwcj != ''">
                rysydwcj = #{rysydwcj, jdbcType=VARCHAR},
            </if>
	  	    <if test="rysydwmc != null and rysydwmc != ''">
                rysydwmc = #{rysydwmc, jdbcType=VARCHAR},
            </if>
	  	    <if test="lsly != null and lsly != ''">
                lsly = #{lsly, jdbcType=VARCHAR},
            </if>
	  	    <if test="ryhqsj != null">
                ryhqsj = #{ryhqsj},
            </if>
	  	    <if test="ryfj != null and ryfj != ''">
                ryfj = #{ryfj, jdbcType=VARCHAR},
            </if>
	  		refresh_time = NOW()
	  	</set>
	  	<where>
	  		rybh = #{rybh,jdbcType=VARCHAR}
	  	</where>
  </update>

  <!-- 添加库点信息 -->
    <insert id="insert" parameterType="com.unis.base.server.entity.DRyxxsjyDO">
    	insert into D_RYXXSJY
	    <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="rybh != null">
                rybh,
            </if>
            <if test="ryxm != null">
                ryxm,
            </if>
            <if test="kddm != null">
                kddm,
            </if>
            <if test="sfzh != null">
                sfzh,
            </if>
            <if test="xb != null">
                xb,
            </if>
            <if test="jg != null">
                jg,
            </if>
            <if test="mz != null">
                mz,
            </if>
            <if test="cssj != null">
                cssj,
            </if>
            <if test="cjgzsj != null">
                cjgzsj,
            </if>
            <if test="whcd != null">
                whcd,
            </if>
            <if test="xxzy != null">
                xxzy,
            </if>
            <if test="zzmm != null">
                zzmm,
            </if>

            <if test="zwdm != null">
                zwdm,
            </if>
            <if test="zwmc != null">
                zwmc,
            </if>
            <if test="bmdm != null">
                bmdm,
            </if>
            <if test="bmbdm != null">
                bmbdm,
            </if>
            <if test="bmzdm != null">
                bmzdm,
            </if>
            <if test="zgqkdm != null">
                zgqkdm,
            </if>
            <if test="gwdm != null">
                gwdm,
            </if>
            <if test="jszcdm != null">
                jszcdm,
            </if>
            <if test="jszcmc != null">
                jszcmc,
            </if>
            <if test="lxdh != null">
                lxdh,
            </if>
            <if test="jbzs != null">
                jbzs,
            </if>
            <if test="fzdw != null">
                fzdw,
            </if>
            <if test="sfba != null">
                sfba,
            </if>
            <if test="gddh != null">
                gddh,
            </if>
            <if test="dzyx != null">
                dzyx,
            </if>
			<if test="jyxs != null" >
				jyxs,
			</if>
			<if test="byyx != null" >
				byyx,
			</if>
			<if test="xw != null" >
				xw,
			</if>
			<if test="zcdj != null" >
				zcdj,
			</if>
			<if test="bzsj != null" >
				bzsj,
			</if>
			<if test="qtzy != null" >
				qtzy,
			</if>
			<if test="qtbzjg != null" >
				qtbzjg,
			</if>
			<if test="qtbzsj != null" >
				qtbzsj,
			</if>
			<if test="tyshxydm != null" >
				tyshxydm,
			</if>
			<if test="qymc != null" >
				qymc,
			</if>
			<if test="qyzt != null" >
                qyzt,
            </if>
            <if test="creator != null">
                creator,
            </if>
            <if test="creatorCode != null">
                creator_code,
            </if>
            <if test="refresher != null">
                refresher,
            </if>
            <if test="remark != null">
                remark,
            </if>

            <if test="grjj != null">
                grjj,
            </if>
            <if test="clfj != null">
                clfj,
            </if>
    	    <if test="xzqhdm != null">
                xzqhdm,
            </if>
    	    <if test="rylb != null">
                rylb,
            </if>
    	    <if test="czbz != null">
                czbz,
            </if>
            <if test="bmmc != null">
                bmmc,
            </if>
            <if test="rzrq != null">
                rzrq,
            </if>
            <if test="gwxz != null">
                gwxz,
            </if>
            <if test="rych != null and rych != ''">
                rych,
            </if>
            <if test="rysydwcj != null and rysydwcj != ''">
                rysydwcj,
            </if>
            <if test="rysydwmc != null and rysydwmc != ''">
                rysydwmc,
            </if>
            <if test="lsly != null and lsly != ''">
                lsly,
            </if>
            <if test="ryhqsj != null">
                ryhqsj,
            </if>
            <if test="ryfj != null and ryfj != ''">
                ryfj,
            </if>
	    </trim>
	    <trim prefix="values (" suffix=")" suffixOverrides="," >
            <if test="rybh != null">
                #{rybh,jdbcType=VARCHAR},
            </if>
            <if test="ryxm != null">
                #{ryxm,jdbcType=VARCHAR},
            </if>
            <if test="kddm != null">
                #{kddm,jdbcType=VARCHAR},
            </if>
            <if test="sfzh != null">
                #{sfzh,jdbcType=VARCHAR},
            </if>
            <if test="xb != null">
                #{xb,jdbcType=VARCHAR},
            </if>
            <if test="jg != null">
                #{jg,jdbcType=VARCHAR},
            </if>
            <if test="mz != null">
                #{mz,jdbcType=VARCHAR},
            </if>
            <if test="cssj != null">
                #{cssj,jdbcType=VARCHAR},
            </if>
            <if test="cjgzsj != null">
                #{cjgzsj,jdbcType=VARCHAR},
            </if>
            <if test="whcd != null">
                #{whcd,jdbcType=VARCHAR},
            </if>
            <if test="xxzy != null">
                #{xxzy,jdbcType=VARCHAR},
            </if>
            <if test="zzmm != null">
                #{zzmm,jdbcType=VARCHAR},
            </if>
            <if test="zwdm != null">
                #{zwdm,jdbcType=VARCHAR},
            </if>
            <if test="zwmc != null">
                #{zwmc,jdbcType=VARCHAR},
            </if>
            <if test="bmdm != null">
                #{bmdm,jdbcType=VARCHAR},
            </if>
            <if test="bmbdm != null">
                #{bmbdm,jdbcType=VARCHAR},
            </if>

            <if test="bmzdm != null">
                #{bmzdm,jdbcType=VARCHAR},
            </if>
            <if test="zgqkdm != null">
                #{zgqkdm,jdbcType=VARCHAR},
            </if>
            <if test="gwdm != null">
                #{gwdm,jdbcType=VARCHAR},
            </if>
            <if test="jszcdm != null">
                #{jszcdm,jdbcType=VARCHAR},
            </if>
            <if test="jszcmc != null">
                #{jszcmc,jdbcType=VARCHAR},
            </if>
            <if test="lxdh != null">
                #{lxdh,jdbcType=VARCHAR},
            </if>
            <if test="jbzs != null">
                #{jbzs,jdbcType=VARCHAR},
            </if>
            <if test="fzdw != null">
                #{fzdw,jdbcType=VARCHAR},
            </if>
            <if test="sfba != null">
                #{sfba,jdbcType=DECIMAL},
            </if>
            <if test="gddh != null">
                #{gddh,jdbcType=VARCHAR},
            </if>
            <if test="dzyx != null">
                #{dzyx,jdbcType=VARCHAR},
            </if>
            <if test="jyxs != null">
                #{jyxs,jdbcType=DECIMAL},
            </if>
            <if test="byyx != null">
                #{byyx,jdbcType=VARCHAR},
            </if>
            <if test="xw != null">
                #{xw,jdbcType=VARCHAR},
            </if>
            <if test="zcdj != null">
                #{zcdj,jdbcType=DECIMAL},
            </if>
            <if test="bzsj != null">
                #{bzsj,jdbcType=DATE},
            </if>
            <if test="qtzy != null">
                #{qtzy,jdbcType=VARCHAR},
            </if>
            <if test="qtbzjg != null">
                #{qtbzjg,jdbcType=VARCHAR},
            </if>
            <if test="qtbzsj != null">
                #{qtbzsj,jdbcType=DATE},
            </if>
            <if test="tyshxydm != null">
                #{tyshxydm,jdbcType=VARCHAR},
            </if>
            <if test="qymc != null">
                #{qymc,jdbcType=VARCHAR},
            </if>
            <if test="qyzt != null">
                #{qyzt,jdbcType=DECIMAL},
            </if>
            <if test="creator != null">
                #{creator,jdbcType=VARCHAR},
            </if>
            <if test="creatorCode != null">
                #{creatorCode,jdbcType=VARCHAR},
            </if>
            <if test="refresher != null">
                #{refresher,jdbcType=VARCHAR},
            </if>
            <if test="remark != null">
                #{remark,jdbcType=VARCHAR},
            </if>
            <if test="grjj != null">
                #{grjj, jdbcType=VARCHAR},
            </if>
            <if test="clfj != null">
                #{clfj, jdbcType=VARCHAR},
            </if>
            <if test="xzqhdm != null">
                 #{xzqhdm, jdbcType=VARCHAR},
            </if>
            <if test="rylb != null">
                #{rylb, jdbcType=VARCHAR},
            </if>
            <if test="czbz != null">
                #{czbz, jdbcType=VARCHAR},
            </if>
            <if test="bmmc != null">
                #{bmmc, jdbcType=VARCHAR},
            </if>
            <if test="rzrq != null">
                #{rzrq, jdbcType=VARCHAR},
            </if>
            <if test="gwxz != null">
                #{gwxz, jdbcType=VARCHAR},
            </if>
            <if test="rych != null and rych != ''">
                #{rych, jdbcType=VARCHAR},
            </if>
            <if test="rysydwcj != null and rysydwcj != ''">
                #{rysydwcj, jdbcType=VARCHAR},
            </if>
            <if test="rysydwmc != null and rysydwmc != ''">
                #{rysydwmc, jdbcType=VARCHAR},
            </if>
            <if test="lsly != null and lsly != ''">
                #{lsly, jdbcType=VARCHAR},
            </if>
            <if test="ryhqsj != null">
                #{ryhqsj, jdbcType=DATE},
            </if>
            <if test="ryfj != null and ryfj != ''">
                #{ryfj, jdbcType=VARCHAR},
            </if>
	    </trim>
    </insert>

    <select id="getMaxCodeById" parameterType="java.lang.String" resultType="java.lang.String">
        SELECT max(ry.rybh)
        from D_RYXXSJY ry
    </select>

	<!--获取最大设备编号-->
    <select id="getMaxById" parameterType="java.lang.String" resultType="java.lang.String">
        SELECT
        max(ry.rybh)
        from
        D_RYXXSJY ry
        <where>
            ry.rybh like CONCAT(#{prefix,jdbcType=VARCHAR},'%')
        </where>
    </select>

	<!--根据库点代码删除人员列表-->
	<update id="deleteList" parameterType="java.lang.String">
		UPDATE
		D_RYXXSJY ry
		SET
		ry.status = 0,
		ry.czbz = 'd'
		<where>
			ry.kddm like CONCAT(#{kddm,jdbcType=VARCHAR},'%')
		</where>
	</update>

	<!-- 根据库点代码获取人员列表 -->
	<select id="getPersonnelListByKddm" parameterType="java.lang.String" resultMap="BaseResultMap">
		SELECT
		<include refid="Base_Column_List_common"></include>
		from
		D_RYXXSJY ry
		<where>
			ry.kddm like CONCAT(#{kddm,jdbcType=VARCHAR},'%')
			and ry.status = 1
		</where>
		ORDER BY ry.RYBH desc
	</select>



	<!-- 根据库点代码获取人员列表 -->
	<select id="personnelZHListByKddm" parameterType="java.lang.String" resultMap="BaseResultMap">
		SELECT
		<include refid="Base_Column_List_common"></include>
		from
		D_RYXXSJY ry
		<where>
			ry.kddm like CONCAT(#{kddm,jdbcType=VARCHAR},'%')
			and ry.status = 1
			and ry.gwdm in ('15','16')
		</where>
		ORDER BY ry.RYBH desc
	</select>

	<!--	更改备案状态-->
	<update id="updateFiling" parameterType="com.unis.base.common.vo.DRyxxsjyVO">
		UPDATE D_RYXXSJY
		SET SFBA = #{sfba,jdbcType=DECIMAL}
		WHERE rybh = #{rybh,jdbcType=VARCHAR}
	</update>

	<!--	更改启用状态-->
	<update id="updateEnabled" parameterType="com.unis.base.common.vo.DRyxxsjyVO">
		UPDATE D_RYXXSJY
		SET qyzt = #{qyzt,jdbcType=DECIMAL}
		WHERE rybh = #{rybh,jdbcType=VARCHAR}
	</update>
</mapper>
