| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ufo.project.model.mapper.ModelPredictionTasksMapper">
-
- <resultMap type="ModelPredictionTasks" id="ModelPredictionTasksResult">
- <result property="id" column="id" />
- <result property="taskName" column="task_name" />
- <result property="stationId" column="station_id" />
- <result property="modelVersionId" column="model_version_id" />
- <result property="versionSource" column="version_source" />
- <result property="predictionType" column="prediction_type" />
- <result property="targetTime" column="target_time" />
- <result property="status" column="status" />
- <result property="resultPath" column="result_path" />
- <result property="createdAt" column="created_at" />
- <result property="executedAt" column="executed_at" />
- </resultMap>
- <sql id="selectModelPredictionTasksVo">
- 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
- </sql>
- <select id="selectModelPredictionTasksList" parameterType="ModelPredictionTasks" resultMap="ModelPredictionTasksResult">
- <include refid="selectModelPredictionTasksVo"/>
- <where>
- <if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
- <if test="stationId != null"> and station_id = #{stationId}</if>
- <if test="modelVersionId != null "> and model_version_id = #{modelVersionId}</if>
- <if test="versionSource != null and versionSource != ''"> and version_source = #{versionSource}</if>
- <if test="predictionType != null and predictionType != ''"> and prediction_type = #{predictionType}</if>
- <if test="targetTime != null and targetTime != ''"> and target_time = #{targetTime}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="resultPath != null and resultPath != ''"> and result_path = #{resultPath}</if>
- <if test="createdAt != null and createdAt != ''"> and created_at = #{createdAt}</if>
- <if test="executedAt != null and executedAt != ''"> and executed_at = #{executedAt}</if>
- </where>
- </select>
-
- <select id="selectModelPredictionTasksById" parameterType="Long" resultMap="ModelPredictionTasksResult">
- <include refid="selectModelPredictionTasksVo"/>
- where id = #{id}
- </select>
- <select id="selectPredictionTasks" resultMap="ModelPredictionTasksResult">
- <include refid="selectModelPredictionTasksVo"/>
- where station_id = #{stationId}
- and version_source = 'station'
- and prediction_type = #{predictionType}
- and status = 'SUCCESS'
- and target_time >= #{startTime}
- and target_time <= #{endTime}
- order by target_time asc
- </select>
- <insert id="insertModelPredictionTasks" parameterType="ModelPredictionTasks" useGeneratedKeys="true" keyProperty="id">
- insert into model_prediction_tasks
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="taskName != null">task_name,</if>
- <if test="stationId != null">station_id,</if>
- <if test="modelVersionId != null">model_version_id,</if>
- <if test="versionSource != null">version_source,</if>
- <if test="predictionType != null and predictionType != ''">prediction_type,</if>
- <if test="targetTime != null and targetTime != ''">target_time,</if>
- <if test="status != null and status != ''">status,</if>
- <if test="resultPath != null">result_path,</if>
- <if test="createdAt != null and createdAt != ''">created_at,</if>
- <if test="executedAt != null">executed_at,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="taskName != null">#{taskName},</if>
- <if test="stationId != null">#{stationId},</if>
- <if test="modelVersionId != null">#{modelVersionId},</if>
- <if test="versionSource != null">#{versionSource},</if>
- <if test="predictionType != null and predictionType != ''">#{predictionType},</if>
- <if test="targetTime != null and targetTime != ''">#{targetTime},</if>
- <if test="status != null and status != ''">#{status},</if>
- <if test="resultPath != null">#{resultPath},</if>
- <if test="createdAt != null and createdAt != ''">#{createdAt},</if>
- <if test="executedAt != null">#{executedAt},</if>
- </trim>
- </insert>
- <update id="updateModelPredictionTasks" parameterType="ModelPredictionTasks">
- update model_prediction_tasks
- <trim prefix="SET" suffixOverrides=",">
- <if test="taskName != null">task_name = #{taskName},</if>
- <if test="stationId != null">station_id = #{stationId},</if>
- <if test="modelVersionId != null">model_version_id = #{modelVersionId},</if>
- <if test="versionSource != null">version_source = #{versionSource},</if>
- <if test="predictionType != null and predictionType != ''">prediction_type = #{predictionType},</if>
- <if test="targetTime != null and targetTime != ''">target_time = #{targetTime},</if>
- <if test="status != null and status != ''">status = #{status},</if>
- <if test="resultPath != null">result_path = #{resultPath},</if>
- <if test="createdAt != null and createdAt != ''">created_at = #{createdAt},</if>
- <if test="executedAt != null">executed_at = #{executedAt},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteModelPredictionTasksById" parameterType="Long">
- delete from model_prediction_tasks where id = #{id}
- </delete>
- <delete id="deleteModelPredictionTasksByIds" parameterType="String">
- delete from model_prediction_tasks where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|