Newer
Older
huludao / src / main / resources / mapper / TaskStateMapper.xml
<?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.newfiber.api.pc.dao.TaskStateMapper">
  <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.entity.TaskState">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="task_id" jdbcType="BIGINT" property="taskId" />
    <result column="operation_user" jdbcType="VARCHAR" property="operationUser" />
    <result column="task_state" jdbcType="TINYINT" property="taskState" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, task_id, operation_user, task_state, create_time
  </sql>

  <update id="updateTaskState">
    update task_state
    set task_state = #{state}
    where task_id = #{taskId} and operation_user = #{user}
  </update>

  <delete id="deleteByTaskId">
    delete from task_state where task_id = #{taskId}
  </delete>

  <select id="selectByTaskIdAndUserName" resultMap="BaseResultMap">
    select <include refid="Base_Column_List"/>
    from task_state where operation_user = #{userName} and task_id = #{taskId}
  </select>

  <update id="updateByTaskId">
    update task_state
    set task_state = 2
    where task_id = #{taskId}
  </update>
</mapper>