<?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.DCfztsjyDao" >
	
	<resultMap id="BaseResultMap" type="com.unis.base.server.entity.DCfztsjyDO" >
        <result column="cfbh" property="cfbh" jdbcType="VARCHAR" />
        <result column="cfmc" property="cfmc" jdbcType="VARCHAR" />
        <result column="kddm" property="kddm" jdbcType="VARCHAR" />
        <result column="xcsjcbl" property="xcsjcbl" jdbcType="VARCHAR" />
        <result column="sfgz" property="sfgz" jdbcType="VARCHAR" />
        <result column="gzsj" property="gzsj" jdbcType="VARCHAR" />
        <result column="sflkznhsjxm" property="sflkznhsjxm" jdbcType="VARCHAR" />
        <result column="cdnffl" property="cdnffl" jdbcType="VARCHAR" />
        <result column="cqnffs" property="cqnffs" jdbcType="VARCHAR" />
        <result column="cdnffc" property="cdnffc" jdbcType="VARCHAR" />
        <result column="mcsfym" property="mcsfym" jdbcType="VARCHAR" />
        <result column="cfnfgrbl" property="cfnfgrbl" jdbcType="VARCHAR" />
        <result column="cfnfszcc" property="cfnfszcc" jdbcType="VARCHAR" />
        <result column="ywfsfqzz" property="ywfsfqzz" jdbcType="VARCHAR" />
        <result column="ywfhfdcs" property="ywfhfdcs" jdbcType="VARCHAR" />
        <result column="ywjxtfss" property="ywjxtfss" jdbcType="VARCHAR" />
        <result column="nfmbxzsc" property="nfmbxzsc" jdbcType="VARCHAR" />
        <result column="ywlqjcsb" property="ywlqjcsb" jdbcType="VARCHAR" />
        <result column="ywlszncrkxt" property="ywlszncrkxt" jdbcType="VARCHAR" />
        <result column="ywznlqckxt" property="ywznlqckxt" jdbcType="VARCHAR" />
        <result column="ywznafjkxt" property="ywznafjkxt" jdbcType="VARCHAR" />
        <result column="ywlkzhywglxt" property="ywlkzhywglxt" 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="kdmc" property="kdmc" jdbcType="VARCHAR" />
    </resultMap>
    
    <sql id="Base_Column_List_common">
    	zt.cfbh, zt.cfmc, zt.kddm, zt.xcsjcbl, zt.sfgz, zt.gzsj, zt.sflkznhsjxm, zt.cdnffl,
    	zt.cqnffs, zt.cdnffc, zt.mcsfym, zt.cfnfgrbl, zt.cfnfszcc, zt.ywfsfqzz, zt.ywfhfdcs,
    	zt.ywjxtfss, zt.nfmbxzsc, zt.ywlqjcsb, zt.ywlszncrkxt, zt.ywznlqckxt, zt.ywznafjkxt, zt.ywlkzhywglxt,
    	zt.refresh_time, zt.remark
    </sql>
    
    <!-- 根据条件查询仓房信息 -->
    <select id="getDCfztsjyList" parameterType="com.unis.base.server.entity.DCfztsjyDO" resultMap="BaseResultMap">
        SELECT 
		<include refid="Base_Column_List_common"></include>,kd.kdmc
 		from
			D_Cfztsjy zt, D_KDXXSJY kd
		<where>
			zt.KDDM = kd.KDDM
			<!-- 仓房编号 -->
	    	<if test="cfbh != null and cfbh != ''" >
	         	and	zt.cfbh LIKE concat(CONCAT('%',#{cfbh,jdbcType=VARCHAR}) ,'%') 
	      	</if>
		</where>
		ORDER BY zt.CFBH,kd.kddm asc
    </select>
    
    <select id="getDCfztsjyInfo" parameterType="java.lang.String" resultMap="BaseResultMap">
        SELECT 
		<include refid="Base_Column_List_common"></include>
 		from
			D_Cfztsjy zt
		<where>
			zt.cfbh = #{cfbh,jdbcType=VARCHAR}
			and zt.status = 1
		</where>
    </select>
    
    <!-- 更新企业信息 -->
    <update id="update" parameterType="com.unis.base.server.entity.DCfztsjyDO">
	  	update D_CFZTSJY
	  	<set>
	  		<if test="cfmc != null">
	  			cfmc = #{cfmc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="kddm != null">
	  			kddm = #{kddm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="xcsjcbl != null">
	  			xcsjcbl = #{xcsjcbl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sfgz != null">
	  			sfgz = #{sfgz,jdbcType=VARCHAR},
	  		</if>
	  		<if test="gzsj != null">
	  			gzsj = #{gzsj,jdbcType=VARCHAR},
	  		</if>
	  		
	  		<if test="sflkznhsjxm != null">
	  			sflkznhsjxm = #{sflkznhsjxm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cdnffl != null">
	  			cdnffl = #{cdnffl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cqnffs != null">
	  			cqnffs = #{cqnffs,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cdnffc != null">
	  			cdnffc = #{cdnffc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="mcsfym != null">
	  			mcsfym = #{mcsfym,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cfnfgrbl != null">
	  			cfnfgrbl = #{cfnfgrbl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cfnfszcc != null">
	  			cfnfszcc = #{cfnfszcc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywfsfqzz != null">
	  			ywfsfqzz = #{ywfsfqzz,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywfhfdcs != null">
	  			ywfhfdcs = #{ywfhfdcs,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywjxtfss != null">
	  			ywjxtfss = #{ywjxtfss,jdbcType=VARCHAR},
	  		</if>
	  		<if test="nfmbxzsc != null">
	  			nfmbxzsc = #{nfmbxzsc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywlqjcsb != null">
	  			ywlqjcsb = #{ywlqjcsb,jdbcType=VARCHAR},
	  		</if>
	  		
	  		<if test="ywlszncrkxt != null">
	  			ywlszncrkxt = #{ywlszncrkxt,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywznlqckxt != null">
	  			ywznlqckxt = #{ywznlqckxt,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywznafjkxt != null">
	  			ywznafjkxt = #{ywznafjkxt,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywlkzhywglxt != null">
	  			ywlkzhywglxt = #{ywlkzhywglxt,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>
	  		refresh_time = NOW()
	  	</set>
	  	<where>
	  		cfbh = #{cfbh,jdbcType=VARCHAR}
	  	</where>
  </update>
  
  <insert id="insert" parameterType="com.unis.base.server.entity.DCfztsjyDO">
    	insert into D_CFZTSJY
	    <trim prefix="(" suffix=")" suffixOverrides="," >
	      <if test="cfbh != null" >
	        cfbh,
	      </if>
	      <if test="cfmc != null" >
	        cfmc,
	      </if>
	      <if test="kddm != null" >
	        kddm,
	      </if>
	      <if test="xcsjcbl != null" >
	        xcsjcbl,
	      </if>
	      <if test="sfgz != null" >
	        sfgz,
	      </if>
	      <if test="gzsj != null" >
	        gzsj,
	      </if>
	      <if test="sflkznhsjxm != null" >
	        sflkznhsjxm,
	      </if>
	      <if test="cdnffl != null" >
	        cdnffl,
	      </if>
	      <if test="cqnffs != null" >
	        cqnffs,
	      </if>
	      <if test="cdnffc != null" >
	        cdnffc,
	      </if>
	      <if test="mcsfym != null" >
	        mcsfym,
	      </if>
	      <if test="cfnfgrbl != null" >
	        cfnfgrbl,
	      </if>
	      
	      <if test="cfnfszcc != null" >
	        cfnfszcc,
	      </if>
	      <if test="ywfsfqzz != null" >
	        ywfsfqzz,
	      </if>
	      <if test="ywfhfdcs != null" >
	        ywfhfdcs,
	      </if>
	      <if test="ywjxtfss != null" >
	        ywjxtfss,
	      </if>
	      <if test="nfmbxzsc != null" >
	        nfmbxzsc,
	      </if>
	      <if test="ywlqjcsb != null" >
	        ywlqjcsb,
	      </if>
	      
	      <if test="ywlszncrkxt != null" >
	        ywlszncrkxt,
	      </if>
	      <if test="ywznlqckxt != null" >
	        ywznlqckxt,
	      </if>
	      <if test="ywznafjkxt != null" >
	        ywznafjkxt,
	      </if>
	      <if test="ywlkzhywglxt != null" >
	        ywlkzhywglxt,
	      </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>
	    </trim>
	    <trim prefix="values (" suffix=")" suffixOverrides="," >
	      <if test="cfbh != null" >
	        #{cfbh,jdbcType=VARCHAR},
	      </if>
	      <if test="cfmc != null">
	  			#{cfmc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="kddm != null">
	  			#{kddm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="xcsjcbl != null">
	  			#{xcsjcbl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sfgz != null">
	  			#{sfgz,jdbcType=VARCHAR},
	  		</if>
	  		<if test="gzsj != null">
	  			#{gzsj,jdbcType=VARCHAR},
	  		</if>
	  		
	  		<if test="sflkznhsjxm != null">
	  			#{sflkznhsjxm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cdnffl != null">
	  			#{cdnffl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cqnffs != null">
	  			#{cqnffs,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cdnffc != null">
	  			#{cdnffc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="mcsfym != null">
	  			#{mcsfym,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cfnfgrbl != null">
	  			#{cfnfgrbl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cfnfszcc != null">
	  			#{cfnfszcc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywfsfqzz != null">
	  			#{ywfsfqzz,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywfhfdcs != null">
	  			#{ywfhfdcs,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywjxtfss != null">
	  			#{ywjxtfss,jdbcType=VARCHAR},
	  		</if>
	  		<if test="nfmbxzsc != null">
	  			#{nfmbxzsc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywlqjcsb != null">
	  			#{ywlqjcsb,jdbcType=VARCHAR},
	  		</if>
	  		
	  		<if test="ywlszncrkxt != null">
	  			#{ywlszncrkxt,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywznlqckxt != null">
	  			#{ywznlqckxt,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywznafjkxt != null">
	  			#{ywznafjkxt,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ywlkzhywglxt != null">
	  			#{ywlkzhywglxt,jdbcType=VARCHAR},
	  		</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>
	    </trim>
    </insert>
</mapper>
