<?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.EquipmentTypeDao" >
  <resultMap id="BaseResultMap" type="com.unis.base.server.entity.EquipmentTypeDO" >
    <result column="SBLXBH" property="sblxbh" jdbcType="VARCHAR" />
    <result column="SBLXMC" property="sblxmc" jdbcType="VARCHAR" />
    <result column="GGXHBM" property="ggxhbm" jdbcType="VARCHAR" />
    <result column="GGXHMC" property="ggxhmc" jdbcType="VARCHAR" />
    <result column="SBMCBM" property="sbmcbm" jdbcType="VARCHAR" />
    <result column="SBMC" property="sbmc" jdbcType="VARCHAR" />
    <result column="ZCBM" property="zcbm" jdbcType="VARCHAR" />
    <result column="KCSL" property="kcsl" jdbcType="DECIMAL" />
    <result column="tyshxydm" property="tyshxydm" jdbcType="VARCHAR" />
    <result column="SBLXMCBH" property="sblxmcbh" jdbcType="VARCHAR" />
  
    
    <result column="STATUS" property="status" jdbcType="DECIMAL" />
    <result column="CREATOR" property="creator" jdbcType="VARCHAR" />
    <result column="CREATOR_CODE" property="creatorCode" jdbcType="VARCHAR" />
    <result column="CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" />
    <result column="REFRESHER" property="refresher" jdbcType="VARCHAR" />
    <result column="REFRESHER_CODE" property="refresherCode" jdbcType="VARCHAR" />
    <result column="REFRESH_TIME" property="refreshTime" jdbcType="TIMESTAMP" />
    <result column="REMARK" property="remark" jdbcType="VARCHAR" />
  </resultMap>

  <sql id="Base_Column_List_common">
    	sb.SBLXBH, sb.SBLXMC, sb.GGXHBM, sb.GGXHMC, sb.SBMCBM, sb.SBMC, sb.ZCBM, sb.KCSL, sb.status, sb.creator, sb.creator_code ,
    	sb.create_date, sb.refresher, sb.refresher_code, sb.refresh_time, sb.remark,sb.sblxmcbh
    </sql>

  <insert id="insert" parameterType="com.unis.base.server.entity.EquipmentTypeDO" >
    insert into D_SBLXSJY (SBLXBH, SBLXMC,
      GGXHBM, GGXHMC, SBMCBM, SBMC,
      ZCBM, KCSL, STATUS, 
      CREATOR, CREATOR_CODE, CREATE_DATE, 
      REFRESHER, REFRESHER_CODE, REFRESH_TIME, 
      REMARK,tyshxydm,SBLXMCBH)
    values (#{sblxbh,jdbcType=VARCHAR}, #{sblxmc,jdbcType=VARCHAR}, #{ggxhbm,jdbcType=VARCHAR},
      #{ggxhmc,jdbcType=VARCHAR}, #{sbmcbm,jdbcType=VARCHAR}, #{sbmc,jdbcType=VARCHAR},
      #{zcbm,jdbcType=VARCHAR}, #{kcsl,jdbcType=DECIMAL}, #{status,jdbcType=DECIMAL}, 
      #{creator,jdbcType=VARCHAR}, #{creatorCode,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, 
      #{refresher,jdbcType=VARCHAR}, #{refresherCode,jdbcType=VARCHAR}, #{refreshTime,jdbcType=TIMESTAMP}, 
      #{remark,jdbcType=VARCHAR}),  #{tyshxydm,jdbcType=VARCHAR}, #{sblxmcbh,jdbcType=VARCHAR})
      
  </insert>
  <insert id="insertSelective" parameterType="com.unis.base.server.entity.EquipmentTypeDO" >
    insert into D_SBLXSJY
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="sblxbh != null" >
        SBLXBH,
      </if>
      <if test="sblxmc != null" >
        SBLXMC,
      </if>
      <if test="ggxhbm != null" >
        GGXHBM,
      </if>
      <if test="ggxhmc != null" >
        GGXHMC,
      </if>
      <if test="sbmcbm != null" >
        SBMCBM,
      </if>
      <if test="sbmc != null" >
        SBMC,
      </if>
      <if test="zcbm != null" >
        ZCBM,
      </if>
      <if test="kcsl != null" >
        KCSL,
      </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="tyshxydm != null" >
        tyshxydm,
      </if>
      
       <if test="sblxmcbh != null" >
        sblxmcbh,
      </if>
      
    
      
      
      
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="sblxbh != null" >
        #{sblxbh,jdbcType=VARCHAR},
      </if>
      <if test="sblxmc != null" >
        #{sblxmc,jdbcType=VARCHAR},
      </if>
      <if test="ggxhbm != null" >
        #{ggxhbm,jdbcType=VARCHAR},
      </if>
      <if test="ggxhmc != null" >
        #{ggxhmc,jdbcType=VARCHAR},
      </if>
      <if test="sbmcbm != null" >
        #{sbmcbm,jdbcType=VARCHAR},
      </if>
      <if test="sbmc != null" >
        #{sbmc,jdbcType=VARCHAR},
      </if>
      <if test="zcbm != null" >
        #{zcbm,jdbcType=VARCHAR},
      </if>
      <if test="kcsl != null" >
        #{kcsl,jdbcType=DECIMAL},
      </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="tyshxydm != null" >
         #{tyshxydm,jdbcType=VARCHAR},
      </if>
         <if test="sblxmcbh != null" >
         #{sblxmcbh,jdbcType=VARCHAR},
      </if>
      
      
  
      
    </trim>
  </insert>
  
  <!-- 设备编号生成策略 -->
	 <select id="getMaxCodeById"  resultType="java.lang.String" parameterType="java.lang.String">
	        SELECT  MAX(SBLXBH) FROM  D_SBLXSJY where SBLXBH  LIKE CONCAT(#{pstr,jdbcType=VARCHAR}, '%')
	  </select>

  <!-- 根据参数获取设备类型列表 -->
  <select id="getEquipmentTypeList" parameterType="com.unis.base.common.vo.EquipmentTypequeryVO" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List_common"></include>
    from
    D_SBLXSJY sb
    <where>
      sb.status = 1
      <!-- 设备类型编号 -->
      <if test="sblxbh != null and sblxbh != ''" >
        and	sb.SBLXBH LIKE concat(CONCAT('%',#{sblxbh,jdbcType=VARCHAR}) ,'%')
      </if>
      <!-- 设备类型名称 -->
      <if test="sblxmc != null and sblxmc != ''" >
        and	sb.SBLXMC LIKE concat(CONCAT('%',#{sblxmc,jdbcType=VARCHAR}) ,'%')
      </if>
      <!-- 设备名称编码 -->
      <if test="sbmcbm != null and sbmcbm != ''" >
        and	sb.SBMCBM LIKE concat(CONCAT('%',#{sbmcbm,jdbcType=VARCHAR}) ,'%')
      </if>
      <!-- 设备名称 -->
      <if test="sbmc != null and sbmc != ''" >
        and	sb.SBMC LIKE concat(CONCAT('%',#{sbmc,jdbcType=VARCHAR}) ,'%')
      </if>
       <if test="sblxmcbh != null and sblxmcbh != ''" >
        and	sb.sblxmcbh=#{sblxmcbh}
      </if>
      
       <if test="tyshxydm != null and tyshxydm != ''" >
        and	sb.tyshxydm =#{tyshxydm}
      </if>
     
    </where>
    order by sb.SBLXBH desc
  </select>

</mapper>