SyncLogMapper.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.dgtly.sync.mapper.SyncLogMapper">
  6. <resultMap type="SyncLog" id="SyncLogResult">
  7. <result property="packageId" column="package_id" />
  8. <result property="successCount" column="success_count" />
  9. <result property="faileCount" column="faile_count" />
  10. <result property="totalCount" column="total_count" />
  11. <result property="createTime" column="create_time" />
  12. <result property="startTime" column="start_time" />
  13. <result property="endTime" column="end_time" />
  14. <result property="syncType" column="sync_type" />
  15. </resultMap>
  16. <sql id="selectSyncLogVo">
  17. select package_id, success_count, faile_count, total_count, create_time, sync_type from sync_log
  18. </sql>
  19. <select id="selectSyncLogList" parameterType="SyncLog" resultMap="SyncLogResult">
  20. <include refid="selectSyncLogVo"/>
  21. <where>
  22. <if test="params.beginCreateTime != null and params.beginCreateTime != ''"> and create_time &gt;= #{params.beginCreateTime} </if>
  23. <if test="params.endCreateTime != null and params.endCreateTime != '' ">and create_time &lt;= #{params.endCreateTime}</if>
  24. <if test="syncType != null and syncType != ''"> and sync_type = #{syncType}</if>
  25. </where>
  26. </select>
  27. <select id="selectSyncLogById" parameterType="String" resultMap="SyncLogResult">
  28. <include refid="selectSyncLogVo"/>
  29. where package_id = #{packageId}
  30. </select>
  31. <insert id="insertSyncLog" parameterType="SyncLog">
  32. insert into sync_log
  33. <trim prefix="(" suffix=")" suffixOverrides=",">
  34. create_time,
  35. <if test="packageId != null and packageId != ''">package_id,</if>
  36. <if test="successCount != null ">success_count,</if>
  37. <if test="faileCount != null ">faile_count,</if>
  38. <if test="totalCount != null ">total_count,</if>
  39. <if test="startTime != null ">start_time,</if>
  40. <if test="endTime != null ">end_time,</if>
  41. <if test="syncType != null and syncType != ''">sync_type,</if>
  42. </trim>
  43. <trim prefix="values (" suffix=")" suffixOverrides=",">
  44. now(),
  45. <if test="packageId != null and packageId != ''">#{packageId},</if>
  46. <if test="successCount != null ">#{successCount},</if>
  47. <if test="faileCount != null ">#{faileCount},</if>
  48. <if test="totalCount != null ">#{totalCount},</if>
  49. <if test="startTime != null ">#{startTime},</if>
  50. <if test="endTime != null ">#{endTime},</if>
  51. <if test="syncType != null and syncType != ''">#{syncType},</if>
  52. </trim>
  53. </insert>
  54. <update id="updateSyncLog" parameterType="SyncLog">
  55. update sync_log
  56. <trim prefix="SET" suffixOverrides=",">
  57. <if test="successCount != null ">success_count = #{successCount},</if>
  58. <if test="faileCount != null ">faile_count = #{faileCount},</if>
  59. <if test="totalCount != null ">total_count = #{totalCount},</if>
  60. <if test="startTime != null ">start_time = #{startTime},</if>
  61. <if test="endTime != null ">end_time = #{endTime},</if>
  62. <if test="syncType != null and syncType != ''">sync_type = #{syncType},</if>
  63. </trim>
  64. where package_id = #{packageId}
  65. </update>
  66. <delete id="deleteSyncLogById" parameterType="String">
  67. delete from sync_log where package_id = #{packageId}
  68. </delete>
  69. <delete id="deleteSyncLogByIds" parameterType="String">
  70. delete from sync_log where package_id in
  71. <foreach item="packageId" collection="array" open="(" separator="," close=")">
  72. #{packageId}
  73. </foreach>
  74. </delete>
  75. </mapper>