<?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.PreFryStageChangesMapper">
  <resultMap id="BaseResultMap" type="com.cool.store.entity.PreFryStageChangesDO">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="record_id" jdbcType="INTEGER" property="recordId" />
    <result column="stage" jdbcType="TINYINT" property="stage" />
    <result column="image1" jdbcType="VARCHAR" property="image1" />
    <result column="image2" jdbcType="VARCHAR" property="image2" />
    <result column="operator_name" jdbcType="VARCHAR" property="operatorName" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
    <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
  </resultMap>


  <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
    INSERT INTO xfsg_pre_fry_stage_changes
    (record_id, stage, image1, image2, operator_name, remark, created_time, updated_time)
    VALUES
    <foreach collection="list" item="item" separator=",">
      (#{item.recordId}, #{item.stage}, #{item.image1}, #{item.image2},
      #{item.operatorName}, #{item.remark}, NOW(), NOW())
    </foreach>
  </insert>


  <select id="selectByRecordId" resultType="com.cool.store.dto.pre.fry.PreFryStageImagesDTO">
    SELECT id, record_id, image1, image2, created_time,stage
    FROM xfsg_pre_fry_stage_changes
    WHERE record_id = #{recordId}
    ORDER BY created_time asc
  </select>
  <select id="selectByRecordIdList" resultType="com.cool.store.dto.pre.fry.PreFryStageImagesDTO">
    SELECT id, record_id, image1, image2, created_time,stage
    FROM xfsg_pre_fry_stage_changes
    <where>
      and record_id in
      <foreach collection="recordIdList" item="item" open="(" separator="," close=")">
        #{item}
      </foreach>
    </where>
    ORDER BY created_time asc
  </select>



</mapper>