<?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.DSbxxsjyDao" >
	
	<resultMap id="BaseResultMap" type="com.unis.base.server.entity.DSbxxsjyDO" >
        <result column="sbbh" property="sbbh" jdbcType="VARCHAR" />
        <result column="sbyqmc" property="sbyqmc" jdbcType="VARCHAR" />
        <result column="kddm" property="kddm" jdbcType="VARCHAR" />
        <result column="kdmc" property="kdmc" jdbcType="VARCHAR" />
        <result column="sbggxh" property="sbggxh" jdbcType="VARCHAR" />
        <result column="sbms" property="sbms" jdbcType="VARCHAR" />
        <result column="sbzt" property="sbzt" jdbcType="VARCHAR" />
        <result column="sbfl" property="sbfl" jdbcType="VARCHAR" />
        <result column="sccj" property="sccj" jdbcType="VARCHAR" />
        <result column="cgjg" property="cgjg" jdbcType="VARCHAR" />
        <result column="sbglz" property="sbglz" jdbcType="VARCHAR" />
        <result column="edgzsj" property="edgzsj" jdbcType="VARCHAR" />
        <result column="dcgzsj" property="dcgzsj" jdbcType="VARCHAR" />
        <result column="cgsj" property="cgsj" jdbcType="VARCHAR" />
        <result column="yjjdrq" property="yjjdrq" jdbcType="VARCHAR" />
        <result column="ljgzsj" property="ljgzsj" jdbcType="VARCHAR" />
        <result column="sysm" property="sysm" jdbcType="VARCHAR" />
        <result column="yjbfrq" property="yjbfrq" jdbcType="VARCHAR" />
        <result column="sbzp" property="sbzp" jdbcType="VARCHAR" />
        <result column="rybh" property="rybh" jdbcType="VARCHAR" />
        <result column="ryxm" property="ryxm" jdbcType="VARCHAR" />
        <result column="djr" property="djr" jdbcType="VARCHAR" />
        <result column="whyy" property="whyy" jdbcType="VARCHAR" />
        <result column="whsj" property="whsj" jdbcType="VARCHAR" />
		<result column="sfba" property="sfba" jdbcType="DECIMAL" />
		<result column="szdwmc" property="szdwmc" jdbcType="VARCHAR" />
		<result column="szdwdm" property="szdwdm" jdbcType="VARCHAR" />
		<result column="jszt" property="jszt" jdbcType="VARCHAR" />
		<result column="sbsl" property="sbsl" jdbcType="DECIMAL" />
		<result column="jscs" property="jscs" jdbcType="VARCHAR" />
		<result column="sblx" property="sblx" jdbcType="DECIMAL" />
		<result column="mqzt" property="mqzt" jdbcType="DECIMAL" />
		<result column="sfzc" property="sfzc" jdbcType="DECIMAL" />
		<result column="ccbm" property="ccbm" jdbcType="VARCHAR" />
		<result column="sbbm" property="sbbm" jdbcType="VARCHAR" />
		<result column="qyrq" property="qyrq" jdbcType="DATE" />
		<result column="ssfl" property="ssfl" jdbcType="DECIMAL" />
		<result column="jg_id" property="jgId" jdbcType="VARCHAR" />
        <result column="fzd" property="fzd" jdbcType="VARCHAR" />
		<result column="sbdwmc" property="sbdwmc" jdbcType="VARCHAR" />
		<result column="zcbh" property="zcbh" jdbcType="VARCHAR" />
		<result column="scrq" property="scrq" jdbcType="DATE" />
		<result column="rkrq" property="rkrq" jdbcType="DATE" />
		<result column="sbflbh" property="sbflbh" jdbcType="VARCHAR" />
		<result column="sblxbh" property="sblxbh" jdbcType="VARCHAR" />
		<result column="pzr" property="pzr" jdbcType="VARCHAR" />
		<result column="cgr" property="cgr" jdbcType="VARCHAR" />
		<result column="wxdh" property="wxdh" jdbcType="VARCHAR" />
		<result column="bxqx" property="bxqx" jdbcType="VARCHAR" />
		<result column="sbazr" property="sbazr" jdbcType="VARCHAR"/>
		<result column="shrmc" property="shrmc" jdbcType="VARCHAR"/>
		<result column="shyj" property="shyj" />
		<result column="shsj" property="shsj" jdbcType="DATE"/>
		
		


        <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" />
    </resultMap>
    
    <sql id="Base_Column_List_common">
    	sb.sbbh, sb.sbyqmc, sb.kddm, sb.sbggxh, sb.sbms, sb.sbzt, sb.sbfl, sb.sccj, sb.cgjg,sb.sbglz, sb.edgzsj,
    	sb.dcgzsj, sb.cgsj, sb.yjjdrq, sb.ljgzsj, sb.sysm, sb.yjbfrq,sb.sbzp, sb.rybh, sb.ryxm, sb.djr, sb.whyy,
    	sb.whsj, sb.sfba, sb.szdwmc, sb.szdwdm, sb.jszt,sb.sbsl, sb.jscs,sb.sblx,sb.mqzt, sb.sfzc,sb.ccbm, sb.sbbm,
    	sb.qyrq, sb.ssfl,sb.jg_id,sb.fzd,sb.sbdwmc,sb.zcbh,sb.scrq,sb.rkrq,sb.sbflbh,sb.sblxbh, sb.refresh_time, sb.remark,
    	sb.pzr,sb.cgr,sb.wxdh,sb.bxqx,sb.sbazr,sb.shrmc,sb.shyj,sb.shsj
    </sql>

    <!--[D_Sbxxsjy]表 order by 条件-->
    <sql id='Order_By_Clause'>
    ORDER BY sb.sbbh DESC
    </sql>
    
    <!-- 根据条件查询仓房信息 -->
    <select id="getDSbxxsjyList" parameterType="com.unis.base.server.entity.DSbxxsjyDO" resultMap="BaseResultMap">
        SELECT 
		<include refid="Base_Column_List_common"></include>,kd.kdmc
 		from
			D_Sbxxsjy sb
		left join D_KDXXSJY kd on sb.KDDM = kd.KDDM
		left join D_SBLXSJY LX on SB.SBLXBH = LX.SBLXBH
		<where>
			<!-- 设备编号 -->
	    	<if test="sbbh != null and sbbh != ''" >
	         	and	sb.sbbh LIKE concat(CONCAT('%',#{sbbh,jdbcType=VARCHAR}) ,'%') 
	      	</if>
	      	<!-- 设备名称 -->
	    	<if test="sbyqmc != null and sbyqmc != ''" >
	         	and	sb.sbyqmc LIKE concat(CONCAT('%',#{sbyqmc,jdbcType=VARCHAR}) ,'%') 
	      	</if>
	      	<!-- 设备类型 -->
	    	<if test="sbfl != null and sbfl != ''" >
	         	and	sb.sbfl LIKE concat(CONCAT('%',#{sbfl,jdbcType=VARCHAR}) ,'%') 
	      	</if>
	      	<!-- 设备状态 -->
	    	<if test="sbzt != null and sbzt != ''" >
	         	and	sb.sbzt LIKE concat(CONCAT('%',#{sbzt,jdbcType=VARCHAR}) ,'%') 
	      	</if>
	      	<!-- 库点代码 -->
	    	<if test="kddm != null and kddm != ''" >
	         	and	sb.kddm LIKE concat(CONCAT('%',#{kddm,jdbcType=VARCHAR}) ,'%') 
	      	</if>
	      	<!-- 库点名称 -->
	    	<if test="kdmc != null and kdmc != ''" >
	         	and	kd.kdmc LIKE concat(CONCAT('%',#{kdmc,jdbcType=VARCHAR}) ,'%')
			</if>
			<!-- 机构ID -->
			<if test="jgId != null and jgId != ''" >
				and	sb.jg_id LIKE concat(CONCAT('%',#{jgId,jdbcType=VARCHAR}) ,'%')
			</if>
            <!-- 设施分类 -->
            <if test='ssfl != null'>
                and sb.SSFL = #{ssfl,jdbcType=DECIMAL}
            </if>
			<!-- 是否备案 -->
			<if test='sfba != null'>
				and sb.SFBA = #{sfba,jdbcType=DECIMAL}
			</if>
			<!-- 设备类型编号 -->
			<if test="sblxbh != null and sblxbh != ''" >
				and	sb.sblxbh LIKE concat(CONCAT('%',#{sblxbh,jdbcType=VARCHAR}) ,'%')
			</if>
			<!-- 设备类型名称编号 -->
			<if test="sblxmcbh != null and sblxmcbh != ''" >
				and	lx.sblxmcbh =#{sblxmcbh,jdbcType=VARCHAR}
			</if>
			<if test='zts !=null'>
			     and sb.SFBA in
			<foreach collection="zts" item="zt" open="(" close=")" separator=",">
		                #{zt}
		   </foreach>
		   </if>
			
			
            and sb.status = 1
		</where>
        <include refid='Order_By_Clause' />
    </select>

	<!-- 根据机构ID获取设备列表 -->
	<select id="getDSbxxsjyListByJgId" parameterType="java.lang.String" resultMap="BaseResultMap">
		SELECT
		<include refid="Base_Column_List_common"></include>
		from
		D_Sbxxsjy sb
		<where>
			sb.jg_id = #{jgId,jdbcType=VARCHAR}
			and sb.status = 1
		</where>
        <include refid='Order_By_Clause' />
	</select>

    <!-- 根据库点获取设备信息列表 -->
    <select id="getEquipmentListByKddm" parameterType="java.lang.String" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List_common"></include>
        from
        D_Sbxxsjy sb
        <where>
            sb.kddm like CONCAT(#{kddm,jdbcType=VARCHAR},'%')
            and sb.status = 1
        </where>
        <include refid='Order_By_Clause' />
    </select>

<!--			ORDER BY sb.sbbh,sb.kddm asc-->

	<select id="getDSbxxsjyInfo" parameterType="java.lang.String" resultMap="BaseResultMap">
        SELECT 
		<include refid="Base_Column_List_common"></include>,kd.kdmc
 		from
			D_Sbxxsjy sb
		left join D_KDXXSJY kd on sb.KDDM = kd.KDDM
		<where>
			sb.status = 1
			 and sb.sbbh = #{sbbh,jdbcType=VARCHAR}
		</where>
    </select>

	<!--根据设备编号获取设备信息-任何状态-->
	<select id="getEquipmentInfo" parameterType="java.lang.String" resultMap="BaseResultMap">
		SELECT
		<include refid="Base_Column_List_common"></include>
		from
		D_Sbxxsjy sb
		<where>
			sb.sbbh = #{sbbh,jdbcType=VARCHAR}
		</where>
	</select>
    
    <!-- 更新设备信息 -->
    <update id="update" parameterType="com.unis.base.server.entity.DSbxxsjyDO">
	  	update D_Sbxxsjy
	  	<set>
	  		<if test="sbbh != null">
	  			sbbh = #{sbbh,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbyqmc != null">
	  			sbyqmc = #{sbyqmc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="kddm != null">
	  			kddm = #{kddm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbggxh != null">
	  			sbggxh = #{sbggxh,jdbcType=VARCHAR},
	  		</if>
	  		
	  		<if test="sbms != null">
	  			sbms = #{sbms,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbzt != null">
	  			sbzt = #{sbzt,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbfl != null">
	  			sbfl = #{sbfl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sccj != null">
	  			sccj = #{sccj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cgjg != null">
	  			cgjg = #{cgjg,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbglz != null">
	  			sbglz = #{sbglz,jdbcType=VARCHAR},
	  		</if>
	  		<if test="edgzsj != null">
	  			edgzsj = #{edgzsj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="dcgzsj != null">
	  			dcgzsj = #{dcgzsj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cgsj != null">
	  			cgsj = #{cgsj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="yjjdrq != null">
	  			yjjdrq = #{yjjdrq,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ljgzsj != null">
	  			ljgzsj = #{ljgzsj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sysm != null">
	  			sysm = #{sysm,jdbcType=VARCHAR},
	  		</if>
	  		
	  		<if test="yjbfrq != null">
	  			yjbfrq = #{yjbfrq,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbzp != null">
	  			sbzp = #{sbzp,jdbcType=VARCHAR},
	  		</if>
	  		<if test="rybh != null">
	  			rybh = #{rybh,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ryxm != null">
	  			ryxm = #{ryxm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="djr != null">
	  			djr = #{djr,jdbcType=VARCHAR},
	  		</if>
	  		<if test="whyy != null">
	  			whyy = #{whyy,jdbcType=VARCHAR},
	  		</if>
	  		<if test="whsj != null">
	  			whsj = #{whsj,jdbcType=VARCHAR},
	  		</if>
			<if test="sfba != null">
				sfba = #{sfba,jdbcType=DECIMAL},
			</if>
			<if test="szdwmc != null">
				szdwmc = #{szdwmc,jdbcType=VARCHAR},
			</if>
			<if test="szdwdm != null">
				szdwdm = #{szdwdm,jdbcType=VARCHAR},
			</if>
			<if test="jszt != null">
				jszt = #{jszt,jdbcType=VARCHAR},
			</if>
			<if test="sbsl != null">
				sbsl = #{sbsl,jdbcType=DECIMAL},
			</if>
			<if test="jscs != null">
				jscs = #{jscs,jdbcType=VARCHAR},
			</if>
			<if test="sblx != null">
				sblx = #{sblx,jdbcType=DECIMAL},
			</if>
			<if test="mqzt != null">
				mqzt = #{mqzt,jdbcType=DECIMAL},
			</if>
			<if test="sfzc != null">
				sfzc = #{sfzc,jdbcType=DECIMAL},
			</if>
			<if test="ccbm != null">
				ccbm = #{ccbm,jdbcType=VARCHAR},
			</if>
			<if test="sbbm != null">
				sbbm = #{sbbm,jdbcType=VARCHAR},
			</if>
			<if test="qyrq != null">
				qyrq = #{qyrq,jdbcType=DATE},
			</if>
			<if test="sfzc != null">
				ssfl = #{ssfl,jdbcType=DECIMAL},
			</if>
			<if test="jgId != null">
				jg_id = #{jgId,jdbcType=VARCHAR},
			</if>
            <if test="fzd != null">
                fzd = #{fzd,jdbcType=VARCHAR},
            </if>
			<if test="sbdwmc != null">
				sbdwmc = #{sbdwmc,jdbcType=VARCHAR},
			</if>
			<if test="zcbh != null">
				zcbh = #{zcbh,jdbcType=VARCHAR},
			</if>
			<if test="scrq != null">
				scrq = #{scrq,jdbcType=DATE},
			</if>
			<if test="rkrq != null">
				rkrq = #{rkrq,jdbcType=DATE},
			</if>
			<if test="sbflbh != null">
				sbflbh = #{sbflbh,jdbcType=VARCHAR},
			</if>
			<if test="sblxbh != null">
				sblxbh = #{sblxbh,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="bxqx != null">
				bxqx = #{bxqx,jdbcType=VARCHAR},
			</if>
			<if test="wxdh != null">
				wxdh = #{wxdh,jdbcType=VARCHAR},
			</if>
			<if test="cgr != null">
				cgr = #{cgr,jdbcType=VARCHAR},
			</if>
			<if test="pzr != null">
				pzr = #{pzr,jdbcType=VARCHAR},
			</if>
			<if test="sbazr != null">
				sbazr = #{sbazr,jdbcType=VARCHAR},
			</if>
			<if test="shrmc != null">
			    shrmc = #{shrmc,jdbcType=VARCHAR},
			</if>
			<if test="shyj != null">
			    shyj = #{shyj},
			</if>
			<if test="shsj != null">
			    shsj = #{shsj,jdbcType=DATE},
			</if>
	  		refresh_time = NOW()
	  	</set>
	  	<where>
	  		sbbh = #{sbbh,jdbcType=VARCHAR}
	  	</where>
  </update>
  
  <!-- 添加库点信息 -->
    <insert id="insert" parameterType="com.unis.base.server.entity.DSbxxsjyDO">
    	insert into D_Sbxxsjy
	    <trim prefix="(" suffix=")" suffixOverrides="," >
	      <if test="sbbh != null" >
	        sbbh,
	      </if>
	      <if test="sbyqmc != null" >
	        sbyqmc,
	      </if>
	      <if test="kddm != null" >
	        kddm,
	      </if>
	      <if test="sbggxh != null" >
	        sbggxh,
	      </if>
	      <if test="sbms != null" >
	        sbms,
	      </if>
	      <if test="sbzt != null" >
	        sbzt,
	      </if>
	      <if test="sbfl != null" >
	        sbfl,
	      </if>
	      <if test="sccj != null" >
	        sccj,
	      </if>
	      <if test="cgjg != null" >
	        cgjg,
	      </if>
	      <if test="sbglz != null" >
	        sbglz,
	      </if>
	      <if test="edgzsj != null" >
	        edgzsj,
	      </if>
	      <if test="dcgzsj != null" >
	        dcgzsj,
	      </if>
	      <if test="cgsj != null" >
	        cgsj,
	      </if>
	      <if test="yjjdrq != null" >
	        yjjdrq,
	      </if>
	      <if test="ljgzsj != null" >
	        ljgzsj,
	      </if>
	      <if test="sysm != null" >
	        sysm,
	      </if>
	      <if test="yjbfrq != null" >
	        yjbfrq,
	      </if>
	      <if test="sbzp != null" >
	        sbzp,
	      </if>
	      <if test="rybh != null" >
	        rybh,
	      </if>
	      <if test="ryxm != null" >
	        ryxm,
	      </if>
	      <if test="djr != null" >
	        djr,
	      </if>
	      <if test="whyy != null" >
	        whyy,
	      </if>
	      <if test="whsj != null" >
	        whsj,
	      </if>
			<if test="sfba != null" >
				sfba,
			</if>
			<if test="szdwmc != null" >
				szdwmc,
			</if>
			<if test="szdwdm != null" >
				szdwdm,
			</if>
			<if test="jszt != null" >
				jszt,
			</if>
			<if test="sbsl != null" >
				sbsl,
			</if>
			<if test="jscs != null" >
				jscs,
			</if>
			<if test="sblx != null" >
				sblx,
			</if>
			<if test="mqzt != null" >
				mqzt,
			</if>
			<if test="sfzc != null" >
				sfzc,
			</if>
			<if test="ccbm != null" >
				ccbm,
			</if>
			<if test="sbbm != null" >
				sbbm,
			</if>
			<if test="qyrq != null" >
				qyrq,
			</if>
			<if test="ssfl != null" >
				ssfl,
			</if>
			<if test="jgId != null" >
				jg_id,
			</if>
            <if test="fzd != null" >
                fzd,
            </if>
			<if test="sbdwmc != null" >
				sbdwmc,
			</if>
			<if test="zcbh != null" >
				zcbh,
			</if>
			<if test="scrq != null" >
				scrq,
			</if>
			<if test="rkrq != null" >
				rkrq,
			</if>
			<if test="sbflbh != null" >
				sbflbh,
			</if>
			<if test="sblxbh != null" >
				sblxbh,
			</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="bxqx != null">
				bxqx,
			</if>
			<if test="wxdh != null">
				wxdh,
			</if>
			<if test="cgr != null">
				cgr,
			</if>
			<if test="pzr != null">
				pzr,
			</if>
			<if test="sbazr != null">
				sbazr,
			</if>
	    </trim>
	    <trim prefix="values (" suffix=")" suffixOverrides="," >
	    	<if test="sbbh != null">
	  			#{sbbh,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbyqmc != null">
	  			#{sbyqmc,jdbcType=VARCHAR},
	  		</if>
	  		<if test="kddm != null">
	  			#{kddm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbggxh != null">
	  			#{sbggxh,jdbcType=VARCHAR},
	  		</if>
	  		
	  		<if test="sbms != null">
	  			#{sbms,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbzt != null">
	  			#{sbzt,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbfl != null">
	  			#{sbfl,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sccj != null">
	  			#{sccj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cgjg != null">
	  			#{cgjg,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbglz != null">
	  			#{sbglz,jdbcType=VARCHAR},
	  		</if>
	  		<if test="edgzsj != null">
	  			#{edgzsj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="dcgzsj != null">
	  			#{dcgzsj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="cgsj != null">
	  			#{cgsj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="yjjdrq != null">
	  			#{yjjdrq,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ljgzsj != null">
	  			#{ljgzsj,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sysm != null">
	  			#{sysm,jdbcType=VARCHAR},
	  		</if>
	  		
	  		<if test="yjbfrq != null">
	  			#{yjbfrq,jdbcType=VARCHAR},
	  		</if>
	  		<if test="sbzp != null">
	  			#{sbzp,jdbcType=VARCHAR},
	  		</if>
	  		<if test="rybh != null">
	  			#{rybh,jdbcType=VARCHAR},
	  		</if>
	  		<if test="ryxm != null">
	  			#{ryxm,jdbcType=VARCHAR},
	  		</if>
	  		<if test="djr != null">
	  			#{djr,jdbcType=VARCHAR},
	  		</if>
	  		<if test="whyy != null">
	  			#{whyy,jdbcType=VARCHAR},
	  		</if>
	  		<if test="whsj != null">
	  			#{whsj,jdbcType=VARCHAR},
	  		</if>
			<if test="sfba != null">
				#{sfba,jdbcType=DECIMAL},
			</if>
			<if test="szdwmc != null">
				#{szdwmc,jdbcType=VARCHAR},
			</if>
			<if test="szdwdm != null">
				#{szdwdm,jdbcType=VARCHAR},
			</if>
			<if test="jszt != null">
				#{jszt,jdbcType=VARCHAR},
			</if>
			<if test="sbsl != null">
				#{sbsl,jdbcType=DECIMAL},
			</if>
			<if test="jscs != null">
				#{jscs,jdbcType=VARCHAR},
			</if>
			<if test="sblx != null">
				#{sblx,jdbcType=DECIMAL},
			</if>
			<if test="mqzt != null">
				#{mqzt,jdbcType=DECIMAL},
			</if>
			<if test="sfzc != null">
				#{sfzc,jdbcType=DECIMAL},
			</if>
			<if test="ccbm != null">
				#{ccbm,jdbcType=VARCHAR},
			</if>
			<if test="sbbm != null">
				#{sbbm,jdbcType=VARCHAR},
			</if>
			<if test="qyrq != null">
				#{qyrq,jdbcType=DATE},
			</if>
			<if test="ssfl != null">
				#{ssfl,jdbcType=DECIMAL},
			</if>
			<if test="jgId != null">
				#{jgId,jdbcType=VARCHAR},
			</if>
            <if test="fzd != null">
                #{fzd,jdbcType=VARCHAR},
            </if>
			<if test="sbdwmc != null">
				#{sbdwmc,jdbcType=VARCHAR},
			</if>
			<if test="zcbh != null">
				#{zcbh,jdbcType=VARCHAR},
			</if>
			<if test="scrq != null">
				#{scrq,jdbcType=DATE},
			</if>
			<if test="rkrq != null">
				#{rkrq,jdbcType=DATE},
			</if>
			<if test="sbflbh != null">
				#{sbflbh,jdbcType=VARCHAR},
			</if>
			<if test="sblxbh != null">
				#{sblxbh,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>
			<if test="bxqx != null">
				#{bxqx,jdbcType=VARCHAR},
			</if>
			<if test="wxdh != null">
				#{wxdh,jdbcType=VARCHAR},
			</if>
			<if test="cgr != null">
				#{cgr,jdbcType=VARCHAR},
			</if>
			<if test="pzr != null">
				#{pzr,jdbcType=VARCHAR},
			</if>
			<if test="sbazr != null">
			 	#{sbazr,jdbcType=VARCHAR},
			</if>
	    </trim>
    </insert>
  
  <select id="getMaxCodeById" parameterType="java.lang.String" resultType="java.lang.String">
        SELECT
        	max(sb.sbbh)
        from
			D_Sbxxsjy sb
    </select>

	<select id="getMaxById" parameterType="java.lang.String" resultType="java.lang.String">
        SELECT
        	max(sb.sbbh)
        from
			D_Sbxxsjy sb
		<where>
			sb.sbbh like CONCAT(#{prefix,jdbcType=VARCHAR},'%')
		</where>
    </select>

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

	<!--根据条件删除设备列表-->
    <update id="deleteList" parameterType="com.unis.base.common.vo.DSbxxsjyClassifyVO">
        UPDATE
            D_Sbxxsjy sb
        SET
            sb.status = 0
        <where>
            sb.kddm like CONCAT(#{kddm,jdbcType=VARCHAR},'%')
            <if test='ssfl != null'>
                and sb.SSFL = #{ssfl,jdbcType=DECIMAL}
            </if>
        </where>
    </update>
	<delete id="deleteBySblxbh" parameterType="com.unis.base.common.vo.DSbxxsjyClassifyVO">
		DELETE from  D_Sbxxsjy where sblxbh =  #{sblxbh,jdbcType=VARCHAR}
	</delete>
</mapper>
