TbFileMapper.xml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ylx.massage.mapper.TbFileMapper">
  4. <resultMap type="com.ylx.massage.domain.TbFile" id="TbFileMap">
  5. <result property="id" column="id" jdbcType="VARCHAR"/>
  6. <result property="md5" column="MD5" jdbcType="VARCHAR"/>
  7. <result property="fileUrl" column="file_url" jdbcType="VARCHAR"/>
  8. <result property="fileName" column="file_name" jdbcType="VARCHAR"/>
  9. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  10. <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
  11. <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
  12. </resultMap>
  13. <!-- 批量插入 -->
  14. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  15. insert into ry-vue.tb_file(MD5file_urlfile_namecreate_timeupdate_timeis_delete)
  16. values
  17. <foreach collection="entities" item="entity" separator=",">
  18. (#{entity.md5}#{entity.fileUrl}#{entity.fileName}#{entity.createTime}#{entity.updateTime}#{entity.isDelete})
  19. </foreach>
  20. </insert>
  21. <!-- 批量插入或按主键更新 -->
  22. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  23. insert into ry-vue.tb_file(MD5file_urlfile_namecreate_timeupdate_timeis_delete)
  24. values
  25. <foreach collection="entities" item="entity" separator=",">
  26. (#{entity.md5}#{entity.fileUrl}#{entity.fileName}#{entity.createTime}#{entity.updateTime}#{entity.isDelete})
  27. </foreach>
  28. on duplicate key update
  29. MD5 = values(MD5) file_url = values(file_url) file_name = values(file_name) create_time = values(create_time)
  30. update_time = values(update_time) is_delete = values(is_delete)
  31. </insert>
  32. </mapper>