<?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.TzYjqyDao" >

<resultMap id="BaseResultMap" type="com.unis.base.server.entity.TzYjqyDO" >
		<result column="id" property="id" />
		<result column="qyid" property="qyid" />
        <result column="qylxmc" property="qylxmc" jdbcType="VARCHAR" />
        <result column="rjgnl_mf" property="rjgnlMf" jdbcType="INTEGER" />
        <result column="rjgnl_dm" property="rjgnlDm" jdbcType="INTEGER" />
        <result column="rjgnl_syy" property="rjgnlSyy" jdbcType="INTEGER" />
        <result column="rjgnl_qt" property="rjgnlQt" jdbcType="INTEGER" />
        <result column="fsqxs" property="fsqxs" jdbcType="VARCHAR" />
        <result column="fsgywdsl" property="fsgywdsl" jdbcType="VARCHAR" />
        <result column="rpsnl" property="rpsnl" jdbcType="VARCHAR" />
        <result column="rysnl" property="rysnl" jdbcType="VARCHAR" />
        <result column="ysclsl" property="ysclsl" jdbcType="VARCHAR" />
        
        
        <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="cyhltqy" property="cyhltqy" jdbcType="VARCHAR" />
		<result column="fxlysfgc" property="fxlysfgc" jdbcType="DECIMAL" />
		<result column="qggycpscxkzpz" property="qggycpscxkzpz" jdbcType="DECIMAL" />
		<result column="sfzsjgzycf" property="sfzsjgzycf" jdbcType="DECIMAL" />
		<result column="yfzxjb" property="yfzxjb" jdbcType="VARCHAR" />
		
		<result column="rgynl_mf" property="rgynlMf" jdbcType="INTEGER" />
        <result column="rgynl_dm" property="rgynlDm" jdbcType="INTEGER" />
        <result column="rgynl_syy" property="rgynlSyy" jdbcType="INTEGER" />
        <result column="rgynl_qt" property="rgynlQt" jdbcType="INTEGER" />
    </resultMap>

    <sql id="Column_List_common">
    	tz.qylxmc, tz.rjgnl_mf, tz.rjgnl_dm, tz.rjgnl_syy, tz.rjgnl_qt, tz.fsqxs, tz.fsgywdsl, tz.rpsnl, tz.rysnl, tz.ysclsl,
    	tz.status, tz.creator, tz.creator_code, tz.create_date, tz.refresher, tz.refresher_code, tz.refresh_time, tz.remark,
    	tz.cyhltqy, tz.fxlysfgc, tz.qggycpscxkzpz, tz.sfzsjgzycf, tz.yfzxjb, tz.rgynl_mf, tz.rgynl_dm, tz.rgynl_syy, tz.rgynl_qt,tz.id,tz.qyid
     </sql>
     

    <!-- 新增应急企业信息 -->
    <insert id="insertTzYjqy" parameterType="com.unis.base.server.entity.TzYjqyDO">
    	insert into TZ_YJQY
	    <trim prefix="(" suffix=")" suffixOverrides="," >
	      <if test="id != null" >
	        id,
	      </if>
	      <if test="qyid != null" >
	        qyid,
	      </if>
	      <if test="rjgnlMf != null">
	  			rjgnl_mf ,
	  		</if>
	  		<if test="rjgnlDm != null">
	  			rjgnl_dm ,
	  		</if>
	  		<if test="rjgnlSyy != null">
	  			rjgnl_syy,
	  		</if>
	  		<if test="rjgnlQt != null">
	  			rjgnl_qt ,
	  		</if>
	  		<if test="fsqxs != null">
	  			fsqxs ,
	  		</if>
	  		<if test="fsgywdsl != null">
	  			fsgywdsl ,
	  		</if>
	  		<if test="rpsnl != null">
	  			rpsnl ,
	  		</if>
	  		<if test="rysnl != null">
	  			rysnl,
	  		</if>
	  		<if test="ysclsl != null">
	  			ysclsl ,
	  		</if>

			<if test="status != null" >
				STATUS,
			</if>
			<if test="creator != null" >
				CREATOR,
			</if>
			<if test="creatorCode != null" >
				CREATOR_CODE,
			</if>
			<if test="createDate != null" >
				CREATE_DATE,
			</if>
			<if test="refresher != null" >
				REFRESHER,
			</if>
			<if test="refresherCode != null" >
				REFRESHER_CODE,
			</if>
			<if test="refreshTime != null" >
				REFRESH_TIME,
			</if>
			<if test="remark != null" >
				REMARK,
			</if>
			<if test="cyhltqy != null" >
				CYHLTQY,
			</if>
			<if test="fxlysfgc != null" >
				FXLYSFGC,
			</if>
			<if test="qggycpscxkzpz != null" >
				QGGYCPSCXKZPZ,
			</if>
			<if test="sfzsjgzycf != null" >
				SFZSJGZYCF,
			</if>
			<if test="yfzxjb != null" >
				YFZXJB,
			</if>
			
			<if test="rgynlMf != null">
	  			rgynl_mf ,
	  		</if>
	  		<if test="rgynlDm != null">
	  			rgynl_dm ,
	  		</if>
	  		<if test="rgynlSyy != null">
	  			rgynl_syy,
	  		</if>
	  		<if test="rgynlQt != null">
	  			rgynl_qt ,
	  		</if>
	    </trim>
	    <trim prefix="values (" suffix=")" suffixOverrides="," >
	      <if test="id != null" >
	        #{id,jdbcType=VARCHAR},
	      </if>
	      <if test="qyid != null" >
	        #{qyid,jdbcType=VARCHAR},
	      </if>
	      <if test="rjgnlMf != null">
	  			 #{rjgnlMf,jdbcType=INTEGER},
	  		</if>
	  		<if test="rjgnlDm != null">
	  			 #{rjgnlDm,jdbcType=INTEGER},
	  		</if>
	  		<if test="rjgnlSyy != null">
	  			 #{rjgnlSyy,jdbcType=INTEGER},
	  		</if>
	  		<if test="rjgnlQt != null">
	  			 #{rjgnlQt,jdbcType=INTEGER},
	  		</if>
	  		<if test="fsqxs != null">
	  			 #{fsqxs,jdbcType=VARCHAR},
	  		</if>
	  		<if test="fsgywdsl != null">
	  			#{fsgywdsl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="rpsnl != null">
	  			 #{rpsnl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="rysnl != null">
	  			#{rysnl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ysclsl != null">
	  			 #{ysclsl,jdbcType=VARCHAR},
	  		</if>
			<if test="status != null" >
				#{status,jdbcType=DECIMAL},
			</if>
			<if test="creator != null" >
				#{creator,jdbcType=VARCHAR},
			</if>
			<if test="creatorCode != null" >
				#{creatorCode,jdbcType=VARCHAR},
			</if>
			<if test="createDate != null" >
				#{createDate,jdbcType=TIMESTAMP},
			</if>
			<if test="refresher != null" >
				#{refresher,jdbcType=VARCHAR},
			</if>
			<if test="refresherCode != null" >
				#{refresherCode,jdbcType=VARCHAR},
			</if>
			<if test="refreshTime != null" >
				#{refreshTime,jdbcType=TIMESTAMP},
			</if>
			<if test="remark != null" >
				#{remark,jdbcType=VARCHAR},
			</if>
			<if test="cyhltqy != null" >
				#{cyhltqy,jdbcType=VARCHAR},
			</if>
			<if test="fxlysfgc != null" >
				#{fxlysfgc,jdbcType=DECIMAL},
			</if>
			<if test="qggycpscxkzpz != null" >
				#{qggycpscxkzpz,jdbcType=DECIMAL},
			</if>
			<if test="sfzsjgzycf != null" >
				#{sfzsjgzycf,jdbcType=DECIMAL},
			</if>
			<if test="yfzxjb != null" >
				#{yfzxjb,jdbcType=VARCHAR},
			</if>
			
			<if test="rgynlMf != null">
	  			 #{rgynlMf,jdbcType=INTEGER},
	  		</if>
	  		<if test="rgynlDm != null">
	  			 #{rgynlDm,jdbcType=INTEGER},
	  		</if>
	  		<if test="rgynlSyy != null">
	  			 #{rgynlSyy,jdbcType=INTEGER},
	  		</if>
	  		<if test="rgynlQt != null">
	  			 #{rgynlQt,jdbcType=INTEGER},
	  		</if>
	    </trim>
    </insert>

   <select id="getTzSlqyInfoBytQyid" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  	SELECT 
		<include refid="Column_List_common"></include>
 		from
			TZ_YJQY tz
		<where>
			tz.qyid = #{qyid}
			and tz.status=1
		</where>
  </select>

  <update id="update" parameterType="com.unis.base.server.entity.TzYjqyDO">
  		update TZ_YJQY
	  	<set>
	  		<if test="qylxmc != null">
	  			qylxmc = #{qylxmc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="rjgnlMf != null">
	  			rjgnl_mf = #{rjgnlMf,jdbcType=INTEGER},
	  		</if>
	  		<if test="rjgnlDm != null">
	  			rjgnl_dm = #{rjgnlDm,jdbcType=INTEGER},
	  		</if>
	  		<if test="rjgnlSyy != null">
	  			rjgnl_syy = #{rjgnlSyy,jdbcType=INTEGER},
	  		</if>
	  		<if test="rjgnlQt != null">
	  			rjgnl_qt = #{rjgnlQt,jdbcType=INTEGER},
	  		</if>
	  		<if test="fsqxs != null">
	  			fsqxs = #{fsqxs,jdbcType=VARCHAR},
	  		</if>
	  		<if test="fsgywdsl != null">
	  			fsgywdsl = #{fsgywdsl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="rpsnl != null">
	  			rpsnl = #{rpsnl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="rysnl != null">
	  			rysnl = #{rysnl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ysclsl != null">
	  			ysclsl = #{ysclsl,jdbcType=VARCHAR},
	  		</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="cyhltqy != null" >
				CYHLTQY = #{cyhltqy,jdbcType=VARCHAR},
			</if>
			<if test="fxlysfgc != null" >
				FXLYSFGC = #{fxlysfgc,jdbcType=DECIMAL},
			</if>
			<if test="qggycpscxkzpz != null" >
				QGGYCPSCXKZPZ = #{qggycpscxkzpz,jdbcType=DECIMAL},
			</if>
			<if test="sfzsjgzycf != null" >
				SFZSJGZYCF = #{sfzsjgzycf,jdbcType=DECIMAL},
			</if>
			<if test="yfzxjb != null" >
				YFZXJB = #{yfzxjb,jdbcType=VARCHAR},
			</if>
			
			<if test="rgynlMf != null">
	  			rgynl_mf = #{rgynlMf,jdbcType=INTEGER},
	  		</if>
	  		<if test="rgynlDm != null">
	  			rgynl_dm = #{rgynlDm,jdbcType=INTEGER},
	  		</if>
	  		<if test="rgynlSyy != null">
	  			rgynl_syy = #{rgynlSyy,jdbcType=INTEGER},
	  		</if>
	  		<if test="rgynlQt != null">
	  			rgynl_qt = #{rgynlQt,jdbcType=INTEGER},
	  		</if>
	  		refresh_time = NOW()
	  	</set>
	  	<where>
	  		QYID = #{qyid,jdbcType=VARCHAR}
	  	</where>
  </update>
  
  <select id="selectMaxId" resultType="java.lang.Integer">
  	select max(id) 
    from TZ_SLQY
  </select>
</mapper>
