<?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.yami.shop.dao.AttachFileMapper">
  <resultMap id="BaseResultMap" type="com.yami.shop.bean.model.AttachFile">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="file_id" jdbcType="BIGINT" property="fileId" />
    <result column="file_path" jdbcType="VARCHAR" property="filePath" />
    <result column="file_type" jdbcType="VARCHAR" property="fileType" />
    <result column="file_name" jdbcType="VARCHAR" property="fileName" />
    <result column="file_size" jdbcType="INTEGER" property="fileSize" />
    <result column="upload_time" jdbcType="TIMESTAMP" property="uploadTime" />
    <result column="shop_id" jdbcType="TIMESTAMP" property="shopId" />
    <result column="type" jdbcType="TIMESTAMP" property="type" />
  </resultMap>
    <update id="updateFileName">
      UPDATE tz_attach_file SET file_name = #{attachFile.fileName} WHERE file_id = #{attachFile.fileId}
    </update>
    <select id="getPage" resultType="com.yami.shop.bean.model.AttachFile">
      SELECT * FROM `tz_attach_file`
      WHERE `type` = 1 AND shop_id = #{attachFile.shopId}
      <if test="attachFile.fileName != null and attachFile.fileName != ''">
        AND file_name LIKE CONCAT("%",#{attachFile.fileName},"%")
      </if>
      ORDER BY upload_time DESC
    </select>

</mapper>
