ModelPredictionTasksMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.ufo.project.model.mapper.ModelPredictionTasksMapper">
  6. <resultMap type="ModelPredictionTasks" id="ModelPredictionTasksResult">
  7. <result property="id" column="id" />
  8. <result property="taskName" column="task_name" />
  9. <result property="stationId" column="station_id" />
  10. <result property="modelVersionId" column="model_version_id" />
  11. <result property="versionSource" column="version_source" />
  12. <result property="predictionType" column="prediction_type" />
  13. <result property="targetTime" column="target_time" />
  14. <result property="status" column="status" />
  15. <result property="resultPath" column="result_path" />
  16. <result property="createdAt" column="created_at" />
  17. <result property="executedAt" column="executed_at" />
  18. </resultMap>
  19. <sql id="selectModelPredictionTasksVo">
  20. select id, task_name, station_id, model_version_id, version_source, prediction_type, target_time, status, result_path, created_at, executed_at from model_prediction_tasks
  21. </sql>
  22. <select id="selectModelPredictionTasksList" parameterType="ModelPredictionTasks" resultMap="ModelPredictionTasksResult">
  23. <include refid="selectModelPredictionTasksVo"/>
  24. <where>
  25. <if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
  26. <if test="stationId != null"> and station_id = #{stationId}</if>
  27. <if test="modelVersionId != null "> and model_version_id = #{modelVersionId}</if>
  28. <if test="versionSource != null and versionSource != ''"> and version_source = #{versionSource}</if>
  29. <if test="predictionType != null and predictionType != ''"> and prediction_type = #{predictionType}</if>
  30. <if test="targetTime != null and targetTime != ''"> and target_time = #{targetTime}</if>
  31. <if test="status != null and status != ''"> and status = #{status}</if>
  32. <if test="resultPath != null and resultPath != ''"> and result_path = #{resultPath}</if>
  33. <if test="createdAt != null and createdAt != ''"> and created_at = #{createdAt}</if>
  34. <if test="executedAt != null and executedAt != ''"> and executed_at = #{executedAt}</if>
  35. </where>
  36. </select>
  37. <select id="selectModelPredictionTasksById" parameterType="Long" resultMap="ModelPredictionTasksResult">
  38. <include refid="selectModelPredictionTasksVo"/>
  39. where id = #{id}
  40. </select>
  41. <select id="selectPredictionTasks" resultMap="ModelPredictionTasksResult">
  42. <include refid="selectModelPredictionTasksVo"/>
  43. where station_id = #{stationId}
  44. and version_source = 'station'
  45. and prediction_type = #{predictionType}
  46. and status = 'SUCCESS'
  47. and target_time &gt;= #{startTime}
  48. and target_time &lt;= #{endTime}
  49. order by target_time asc
  50. </select>
  51. <insert id="insertModelPredictionTasks" parameterType="ModelPredictionTasks" useGeneratedKeys="true" keyProperty="id">
  52. insert into model_prediction_tasks
  53. <trim prefix="(" suffix=")" suffixOverrides=",">
  54. <if test="taskName != null">task_name,</if>
  55. <if test="stationId != null">station_id,</if>
  56. <if test="modelVersionId != null">model_version_id,</if>
  57. <if test="versionSource != null">version_source,</if>
  58. <if test="predictionType != null and predictionType != ''">prediction_type,</if>
  59. <if test="targetTime != null and targetTime != ''">target_time,</if>
  60. <if test="status != null and status != ''">status,</if>
  61. <if test="resultPath != null">result_path,</if>
  62. <if test="createdAt != null and createdAt != ''">created_at,</if>
  63. <if test="executedAt != null">executed_at,</if>
  64. </trim>
  65. <trim prefix="values (" suffix=")" suffixOverrides=",">
  66. <if test="taskName != null">#{taskName},</if>
  67. <if test="stationId != null">#{stationId},</if>
  68. <if test="modelVersionId != null">#{modelVersionId},</if>
  69. <if test="versionSource != null">#{versionSource},</if>
  70. <if test="predictionType != null and predictionType != ''">#{predictionType},</if>
  71. <if test="targetTime != null and targetTime != ''">#{targetTime},</if>
  72. <if test="status != null and status != ''">#{status},</if>
  73. <if test="resultPath != null">#{resultPath},</if>
  74. <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
  75. <if test="executedAt != null">#{executedAt},</if>
  76. </trim>
  77. </insert>
  78. <update id="updateModelPredictionTasks" parameterType="ModelPredictionTasks">
  79. update model_prediction_tasks
  80. <trim prefix="SET" suffixOverrides=",">
  81. <if test="taskName != null">task_name = #{taskName},</if>
  82. <if test="stationId != null">station_id = #{stationId},</if>
  83. <if test="modelVersionId != null">model_version_id = #{modelVersionId},</if>
  84. <if test="versionSource != null">version_source = #{versionSource},</if>
  85. <if test="predictionType != null and predictionType != ''">prediction_type = #{predictionType},</if>
  86. <if test="targetTime != null and targetTime != ''">target_time = #{targetTime},</if>
  87. <if test="status != null and status != ''">status = #{status},</if>
  88. <if test="resultPath != null">result_path = #{resultPath},</if>
  89. <if test="createdAt != null and createdAt != ''">created_at = #{createdAt},</if>
  90. <if test="executedAt != null">executed_at = #{executedAt},</if>
  91. </trim>
  92. where id = #{id}
  93. </update>
  94. <delete id="deleteModelPredictionTasksById" parameterType="Long">
  95. delete from model_prediction_tasks where id = #{id}
  96. </delete>
  97. <delete id="deleteModelPredictionTasksByIds" parameterType="String">
  98. delete from model_prediction_tasks where id in
  99. <foreach item="id" collection="array" open="(" separator="," close=")">
  100. #{id}
  101. </foreach>
  102. </delete>
  103. </mapper>