<?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.cool.store.mapper.HyWorkflowStageMapper">
  <resultMap id="BaseResultMap" type="com.cool.store.entity.HyWorkflowStageDO">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="stage_code" jdbcType="VARCHAR" property="stageCode" />
    <result column="stage_name" jdbcType="VARCHAR" property="stageName" />
    <result column="stage_order" jdbcType="TINYINT" property="stageOrder" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, stage_code, stage_name, stage_order, create_time, update_time
  </sql>
  <insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
    insert into hy_workflow_stage
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="record.stageCode != null">
        stage_code,
      </if>
      <if test="record.stageName != null">
        stage_name,
      </if>
      <if test="record.stageOrder != null">
        stage_order,
      </if>
      <if test="record.createTime != null">
        create_time,
      </if>
      <if test="record.updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="record.stageCode != null">
        #{record.stageCode},
      </if>
      <if test="record.stageName != null">
        #{record.stageName},
      </if>
      <if test="record.stageOrder != null">
        #{record.stageOrder},
      </if>
      <if test="record.createTime != null">
        #{record.createTime},
      </if>
      <if test="record.updateTime != null">
        #{record.updateTime},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective">
    update hy_workflow_stage
    <set>
      <if test="record.stageCode != null">
        stage_code = #{record.stageCode},
      </if>
      <if test="record.stageName != null">
        stage_name = #{record.stageName},
      </if>
      <if test="record.stageOrder != null">
        stage_order = #{record.stageOrder},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime},
      </if>
    </set>
    where id = #{record.id}
  </update>
</mapper>