<?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.yd.dal.mapper.meta.MdDropMasterMapper">
  <resultMap id="BaseResultMap" type="com.yd.dal.entity.meta.MdDropMaster">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="scenario_code" jdbcType="VARCHAR" property="scenarioCode" />
    <result column="scenario_name" jdbcType="VARCHAR" property="scenarioName" />
    <result column="drop_code" jdbcType="VARCHAR" property="dropCode" />
    <result column="drop_name" jdbcType="VARCHAR" property="dropName" />
    <result column="drop_code_desc" jdbcType="VARCHAR" property="dropCodeDesc" />
    <result column="is_active" jdbcType="INTEGER" property="isActive" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="BIGINT" property="createdBy" />
  </resultMap>
  <sql id="Base_Column_List">
    id, scenario_code, scenario_name, drop_code, drop_name, drop_code_desc, is_active, 
    created_at, created_by
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from ag_md_drop_master
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from ag_md_drop_master
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.meta.MdDropMaster" useGeneratedKeys="true">
    insert into ag_md_drop_master (scenario_code, scenario_name, drop_code, 
      drop_name, drop_code_desc, is_active, 
      created_at, created_by)
    values (#{scenarioCode,jdbcType=VARCHAR}, #{scenarioName,jdbcType=VARCHAR}, #{dropCode,jdbcType=VARCHAR}, 
      #{dropName,jdbcType=VARCHAR}, #{dropCodeDesc,jdbcType=VARCHAR}, #{isActive,jdbcType=INTEGER}, 
      #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.meta.MdDropMaster" useGeneratedKeys="true">
    insert into ag_md_drop_master
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="scenarioCode != null">
        scenario_code,
      </if>
      <if test="scenarioName != null">
        scenario_name,
      </if>
      <if test="dropCode != null">
        drop_code,
      </if>
      <if test="dropName != null">
        drop_name,
      </if>
      <if test="dropCodeDesc != null">
        drop_code_desc,
      </if>
      <if test="isActive != null">
        is_active,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="scenarioCode != null">
        #{scenarioCode,jdbcType=VARCHAR},
      </if>
      <if test="scenarioName != null">
        #{scenarioName,jdbcType=VARCHAR},
      </if>
      <if test="dropCode != null">
        #{dropCode,jdbcType=VARCHAR},
      </if>
      <if test="dropName != null">
        #{dropName,jdbcType=VARCHAR},
      </if>
      <if test="dropCodeDesc != null">
        #{dropCodeDesc,jdbcType=VARCHAR},
      </if>
      <if test="isActive != null">
        #{isActive,jdbcType=INTEGER},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.meta.MdDropMaster">
    update ag_md_drop_master
    <set>
      <if test="scenarioCode != null">
        scenario_code = #{scenarioCode,jdbcType=VARCHAR},
      </if>
      <if test="scenarioName != null">
        scenario_name = #{scenarioName,jdbcType=VARCHAR},
      </if>
      <if test="dropCode != null">
        drop_code = #{dropCode,jdbcType=VARCHAR},
      </if>
      <if test="dropName != null">
        drop_name = #{dropName,jdbcType=VARCHAR},
      </if>
      <if test="dropCodeDesc != null">
        drop_code_desc = #{dropCodeDesc,jdbcType=VARCHAR},
      </if>
      <if test="isActive != null">
        is_active = #{isActive,jdbcType=INTEGER},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.meta.MdDropMaster">
    update ag_md_drop_master
    set scenario_code = #{scenarioCode,jdbcType=VARCHAR},
      scenario_name = #{scenarioName,jdbcType=VARCHAR},
      drop_code = #{dropCode,jdbcType=VARCHAR},
      drop_name = #{dropName,jdbcType=VARCHAR},
      drop_code_desc = #{dropCodeDesc,jdbcType=VARCHAR},
      is_active = #{isActive,jdbcType=INTEGER},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
    <select id="findByScenarioCode" resultMap="BaseResultMap">
      select
      <include refid="Base_Column_List" />
      from ag_md_drop_master
      where scenario_code like #{scenarioCode,jdbcType=BIGINT}
    </select>
</mapper>