Newer
Older
huludao / src / main / resources / mapper / TaskProcessMapper.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.TaskProcessMapper">
  <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.entity.TaskProcess">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="next_user" jdbcType="VARCHAR" property="nextUser" />
    <result column="task_id" jdbcType="BIGINT" property="taskId" />
    <result column="unit_id" jdbcType="BIGINT" property="unitId" />
    <result column="operation_user" jdbcType="VARCHAR" property="operationUser" />
    <result column="process_content" jdbcType="VARCHAR" property="processContent" />
    <result column="prosess_status" jdbcType="INTEGER" property="prosessStatus" />
    <result column="prosess_name" jdbcType="VARCHAR" property="prosessName" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>

  <resultMap id="taskProcessVos" type="com.newfiber.api.pc.model.vo.TaskProcessVo">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="next_user" jdbcType="VARCHAR" property="nextUser" />
    <result column="task_id" jdbcType="BIGINT" property="taskId" />
    <result column="unit_id" jdbcType="BIGINT" property="unitId" />
    <result column="operation_user" jdbcType="VARCHAR" property="operationUser" />
    <result column="process_content" jdbcType="VARCHAR" property="processContent" />
    <result column="prosess_status" jdbcType="INTEGER" property="prosessStatus" />
    <result column="prosess_name" jdbcType="VARCHAR" property="prosessName" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <collection property="taskFiles" ofType="com.newfiber.api.pc.model.entity.TaskFile">
      <id column="fid" jdbcType="BIGINT" property="id" />
      <result column="process_id" jdbcType="BIGINT" property="processId" />
      <result column="file_path" jdbcType="VARCHAR" property="filePath" />
      <result column="file_name" jdbcType="VARCHAR" property="fileName" />
      <result column="ct" jdbcType="TIMESTAMP" property="createTime" />
    </collection>
  </resultMap>

  <sql id="Base_Column_List">
    id, next_user, task_id,unitId, operation_user, process_content, prosess_status, prosess_name,
    create_time
  </sql>

  <select id="selectTaskList" resultMap="taskProcessVos">
    select tp.id, tp.next_user, tp.task_id,tp.unit_id, tp.operation_user, tp.process_content,
    tp.prosess_status, tp.prosess_name,tp.create_time,tf.id as fid, tf.process_id, tf.file_path,
    tf.file_name, tf.create_time ct from task_process tp
    LEFT JOIN task_file tf on tp.id=tf.process_id
    where 1=1 and tp.task_id = #{taskId}
    <if test="unitId != null">
      and tp.unit_id = #{unitId}
    </if>
   <!-- <foreach collection="collect" item="item" open="(" close=")" separator=",">
      #{item}
    </foreach>-->
    order by tp.id asc
  </select>

  <insert id="insertSelective" keyProperty="id"  keyColumn="id" useGeneratedKeys="true" parameterType="com.newfiber.api.pc.model.entity.TaskProcess">
    insert into task_process
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="nextUser != null">
        next_user,
      </if>
      <if test="taskId != null">
        task_id,
      </if>
      <if test="unitId != null">
        unit_id,
      </if>
      <if test="operationUser != null">
        operation_user,
      </if>
      <if test="processContent != null">
        process_content,
      </if>
      <if test="prosessStatus != null">
        prosess_status,
      </if>
      <if test="prosessName != null">
        prosess_name,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="nextUser != null">
        #{nextUser,jdbcType=VARCHAR},
      </if>
      <if test="taskId != null">
        #{taskId,jdbcType=BIGINT},
      </if>
      <if test="unitId != null">
        #{unitId,jdbcType=BIGINT},
      </if>
      <if test="operationUser != null">
        #{operationUser,jdbcType=VARCHAR},
      </if>
      <if test="processContent != null">
        #{processContent,jdbcType=VARCHAR},
      </if>
      <if test="prosessStatus != null">
        #{prosessStatus,jdbcType=INTEGER},
      </if>
      <if test="prosessName != null">
        #{prosessName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>

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