ConvergeMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.siwei.apply.mapper.ConvergeMapper">
  6. <resultMap id="convergeMap" type="com.siwei.apply.domain.Converge">
  7. <id column="id" property="id"/>
  8. <result column="name" property="name"/>
  9. <result column="batch_name" property="batchName"/>
  10. <result column="operation_time" property="operationTime"/>
  11. <result column="file_path" property="filePath"/>
  12. <result column="status" property="status"/>
  13. <result column="type" property="type"/>
  14. <result column="read_message" property="readMessage"/>
  15. <result column="file_cost_time" property="fileCostTime"/>
  16. <result column="create_time" property="createTime"/>
  17. </resultMap>
  18. <insert id="add" parameterType="com.siwei.apply.domain.Converge">
  19. INSERT INTO t_converge (
  20. id, name, batch_name, operation_time, file_path, status, type, read_message, file_cost_time, create_time
  21. ) VALUES (
  22. #{id}, #{name}, #{batchName}, now(), #{filePath}, #{status}, #{type}, #{readMessage}, #{fileCostTime}, now()
  23. )
  24. </insert>
  25. <select id="get" resultMap="convergeMap">
  26. SELECT *
  27. FROM t_converge
  28. WHERE id = #{id}
  29. </select>
  30. <select id="getByIds" resultMap="convergeMap">
  31. SELECT *
  32. FROM t_converge
  33. WHERE id IN
  34. <foreach collection="ids" item="id" open="(" separator="," close=")">
  35. #{id}
  36. </foreach>
  37. </select>
  38. <select id="getList" parameterType="com.siwei.apply.domain.vo.ConvergeFilterVo" resultMap="convergeMap">
  39. SELECT *
  40. FROM t_converge
  41. <where>
  42. <if test="name != null and name != ''">
  43. AND name LIKE CONCAT('%', #{name}, '%')
  44. </if>
  45. <if test="batchName != null and batchName != ''">
  46. AND batch_name LIKE CONCAT('%', #{batchName}, '%')
  47. </if>
  48. <if test="status != null and status != ''">
  49. AND status = #{status}
  50. </if>
  51. <if test="type != null and type != '' and type != 0">
  52. AND type = #{type}
  53. </if>
  54. <if test="beginTime != null and beginTime != ''">
  55. AND "operation_time" &gt;= TO_TIMESTAMP(#{beginTime}, 'YYYY-MM-DD HH24:MI:SS')
  56. </if>
  57. <if test="endTime != null and endTime != ''">
  58. AND "operation_time" &lt;= TO_TIMESTAMP(#{endTime}, 'YYYY-MM-DD HH24:MI:SS') + INTERVAL '1 day'
  59. </if>
  60. </where>
  61. ORDER BY create_time DESC
  62. LIMIT #{pageSize} OFFSET #{offset}
  63. </select>
  64. <select id="getCount" parameterType="com.siwei.apply.domain.vo.ConvergeFilterVo" resultType="int">
  65. SELECT COUNT(*)
  66. FROM t_converge
  67. <where>
  68. <if test="name != null and name != ''">
  69. AND name LIKE CONCAT('%', #{name}, '%')
  70. </if>
  71. <if test="batchName != null and batchName != ''">
  72. AND batch_name LIKE CONCAT('%', #{batchName}, '%')
  73. </if>
  74. <if test="status != null and status != ''">
  75. AND status = #{status}
  76. </if>
  77. <if test="type != null and type != '' and type != 0">
  78. AND type = #{type}
  79. </if>
  80. <if test="beginTime != null and beginTime != ''">
  81. AND "operation_time" &gt;= TO_TIMESTAMP(#{beginTime}, 'YYYY-MM-DD HH24:MI:SS')
  82. </if>
  83. <if test="endTime != null and endTime != ''">
  84. AND "operation_time" &lt;= TO_TIMESTAMP(#{endTime}, 'YYYY-MM-DD HH24:MI:SS') + INTERVAL '1 day'
  85. </if>
  86. </where>
  87. </select>
  88. <update id="update" parameterType="com.siwei.apply.domain.vo.ConvergeUpdateVo">
  89. UPDATE t_converge
  90. <set>
  91. <if test="name != null">name = #{name},</if>
  92. <if test="batchName != null">batch_name = #{batchName},</if>
  93. <if test="filePath != null">file_path = #{filePath},</if>
  94. <if test="status != null">status = #{status},</if>
  95. <if test="type != null">type = #{type},</if>
  96. <if test="readMessage != null">read_message = #{readMessage},</if>
  97. <if test="fileCostTime != null">file_cost_time = #{fileCostTime},</if>
  98. </set>
  99. WHERE id = #{id}
  100. </update>
  101. <delete id="batchDelete">
  102. DELETE FROM t_converge
  103. WHERE id IN
  104. <foreach collection="ids" item="id" open="(" separator="," close=")">
  105. #{id}
  106. </foreach>
  107. </delete>
  108. </mapper>