TaskLogMapper.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.goafanti.common.dao.TaskLogMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.TaskLog">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="content" jdbcType="VARCHAR" property="content" />
  7. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  8. <result column="task_id" jdbcType="INTEGER" property="taskId" />
  9. <result column="aid" jdbcType="VARCHAR" property="aid" />
  10. <result column="stop_id" jdbcType="INTEGER" property="stopId" />
  11. </resultMap>
  12. <sql id="Base_Column_List">
  13. id, content, create_time, task_id, aid, stop_id
  14. </sql>
  15. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  16. select
  17. <include refid="Base_Column_List" />
  18. from task_log
  19. where id = #{id,jdbcType=INTEGER}
  20. </select>
  21. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  22. delete from task_log
  23. where id = #{id,jdbcType=INTEGER}
  24. </delete>
  25. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TaskLog" useGeneratedKeys="true">
  26. insert into task_log (content, create_time, task_id,
  27. aid, stop_id)
  28. values (#{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{taskId,jdbcType=INTEGER},
  29. #{aid,jdbcType=VARCHAR}, #{stopId,jdbcType=INTEGER})
  30. </insert>
  31. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TaskLog" useGeneratedKeys="true">
  32. insert into task_log
  33. <trim prefix="(" suffix=")" suffixOverrides=",">
  34. <if test="content != null">
  35. content,
  36. </if>
  37. <if test="createTime != null">
  38. create_time,
  39. </if>
  40. <if test="taskId != null">
  41. task_id,
  42. </if>
  43. <if test="aid != null">
  44. aid,
  45. </if>
  46. <if test="stopId != null">
  47. stop_id,
  48. </if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="content != null">
  52. #{content,jdbcType=VARCHAR},
  53. </if>
  54. <if test="createTime != null">
  55. #{createTime,jdbcType=TIMESTAMP},
  56. </if>
  57. <if test="taskId != null">
  58. #{taskId,jdbcType=INTEGER},
  59. </if>
  60. <if test="aid != null">
  61. #{aid,jdbcType=VARCHAR},
  62. </if>
  63. <if test="stopId != null">
  64. #{stopId,jdbcType=INTEGER},
  65. </if>
  66. </trim>
  67. </insert>
  68. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TaskLog">
  69. update task_log
  70. <set>
  71. <if test="content != null">
  72. content = #{content,jdbcType=VARCHAR},
  73. </if>
  74. <if test="createTime != null">
  75. create_time = #{createTime,jdbcType=TIMESTAMP},
  76. </if>
  77. <if test="taskId != null">
  78. task_id = #{taskId,jdbcType=INTEGER},
  79. </if>
  80. <if test="aid != null">
  81. aid = #{aid,jdbcType=VARCHAR},
  82. </if>
  83. <if test="stopId != null">
  84. stop_id = #{stopId,jdbcType=INTEGER},
  85. </if>
  86. </set>
  87. where id = #{id,jdbcType=INTEGER}
  88. </update>
  89. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TaskLog">
  90. update task_log
  91. set content = #{content,jdbcType=VARCHAR},
  92. create_time = #{createTime,jdbcType=TIMESTAMP},
  93. task_id = #{taskId,jdbcType=INTEGER},
  94. aid = #{aid,jdbcType=VARCHAR},
  95. stop_id = #{stopId,jdbcType=INTEGER}
  96. where id = #{id,jdbcType=INTEGER}
  97. </update>
  98. <select id="selectTaskLogList" resultType="com.goafanti.order.bo.TaskLogBo">
  99. select a.id,a.task_id taskId,a.content,date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTimes,b.name as aName,
  100. a.stop_id ,c.reason
  101. from task_log a left join admin b on a.aid=b.id left join task_stop c on a.stop_id =c.id
  102. where a.task_id= #{id,jdbcType=INTEGER} order by a.create_time
  103. </select>
  104. </mapper>