<?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.activiti6.mapper.MyFormDataActivitiMapper" >
  <resultMap id="BaseResultMap" type="com.activiti6.domain.MyFormDataActiviti" >
    <id column="f_id" property="fId" jdbcType="BIGINT" />
    <result column="model_key" property="modelKey" jdbcType="VARCHAR" />
    <result column="model_version" property="modelVersion" jdbcType="INTEGER" />
    <result column="modul_id" property="modulId" jdbcType="VARCHAR" />
    <result column="f_name" property="fName" jdbcType="VARCHAR" />
    <result column="work_num" property="workNum" jdbcType="VARCHAR" />
    <result column="title" property="title" jdbcType="VARCHAR" />
    <result column="instance_id" property="instanceId" jdbcType="VARCHAR" />
    <result column="process_definition_name" property="processDefinitionName" jdbcType="VARCHAR" />
    <result column="task_name" property="taskName" jdbcType="VARCHAR" />
    <result column="creat_user_name" property="creatUserName" jdbcType="VARCHAR" />
    <result column="creat_dept_name" property="creatDeptName" jdbcType="VARCHAR" />
    <result column="creat_form_time" property="creatFormTime" jdbcType="TIMESTAMP" />
    <result column="task_id" property="taskId" jdbcType="VARCHAR" />
    <result column="f_key" property="fKey" jdbcType="VARCHAR" />
    <result column="f_version" property="fVersion" jdbcType="BIGINT" />
    <result column="apply_user" property="applyUser" jdbcType="VARCHAR" />
    <result column="json_data" property="jsonData" jdbcType="VARCHAR" />
    <result column="status" property="status" jdbcType="INTEGER" />
    <result column="create_user" property="createUser" jdbcType="VARCHAR" />
    <result column="create_dept" property="createDept" jdbcType="VARCHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="update_by" property="updateBy" jdbcType="VARCHAR" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause" >
    <where >
      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    f_id, model_key, model_version, modul_id, f_name, work_num, title, instance_id, process_definition_name,
    task_name, creat_user_name, creat_dept_name, creat_form_time, task_id, f_key, f_version,
    apply_user, json_data, status, create_user, create_dept, create_by, create_time,
    update_by, update_time
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.activiti6.domain.MyFormDataActivitiExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from form_data_activiti
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select
    <include refid="Base_Column_List" />
    from form_data_activiti
    where f_id = #{fId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from form_data_activiti
    where f_id = #{fId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.activiti6.domain.MyFormDataActivitiExample" >
    delete from form_data_activiti
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.activiti6.domain.MyFormDataActiviti" >
    insert into form_data_activiti (f_id, model_key, model_version,
      modul_id, f_name, work_num,
      title, instance_id, process_definition_name,
      task_name, creat_user_name, creat_dept_name,
      creat_form_time, task_id, f_key,
      f_version, apply_user, json_data,
      status, create_user, create_dept,
      create_by, create_time, update_by,
      update_time)
    values (#{fId,jdbcType=BIGINT}, #{modelKey,jdbcType=VARCHAR}, #{modelVersion,jdbcType=INTEGER},
      #{modulId,jdbcType=VARCHAR}, #{fName,jdbcType=VARCHAR}, #{workNum,jdbcType=VARCHAR},
      #{title,jdbcType=VARCHAR}, #{instanceId,jdbcType=VARCHAR}, #{processDefinitionName,jdbcType=VARCHAR},
      #{taskName,jdbcType=VARCHAR}, #{creatUserName,jdbcType=VARCHAR}, #{creatDeptName,jdbcType=VARCHAR},
      #{creatFormTime,jdbcType=TIMESTAMP}, #{taskId,jdbcType=VARCHAR}, #{fKey,jdbcType=VARCHAR},
      #{fVersion,jdbcType=BIGINT}, #{applyUser,jdbcType=VARCHAR}, #{jsonData,jdbcType=VARCHAR},
      #{status,jdbcType=INTEGER}, #{createUser,jdbcType=VARCHAR}, #{createDept,jdbcType=VARCHAR},
      #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
      #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.activiti6.domain.MyFormDataActiviti" >
    insert into form_data_activiti
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="fId != null" >
        f_id,
      </if>
      <if test="modelKey != null" >
        model_key,
      </if>
      <if test="modelVersion != null" >
        model_version,
      </if>
      <if test="modulId != null" >
        modul_id,
      </if>
      <if test="fName != null" >
        f_name,
      </if>
      <if test="workNum != null" >
        work_num,
      </if>
      <if test="title != null" >
        title,
      </if>
      <if test="instanceId != null" >
        instance_id,
      </if>
      <if test="processDefinitionName != null" >
        process_definition_name,
      </if>
      <if test="taskName != null" >
        task_name,
      </if>
      <if test="creatUserName != null" >
        creat_user_name,
      </if>
      <if test="creatDeptName != null" >
        creat_dept_name,
      </if>
      <if test="creatFormTime != null" >
        creat_form_time,
      </if>
      <if test="taskId != null" >
        task_id,
      </if>
      <if test="fKey != null" >
        f_key,
      </if>
      <if test="fVersion != null" >
        f_version,
      </if>
      <if test="applyUser != null" >
        apply_user,
      </if>
      <if test="jsonData != null" >
        json_data,
      </if>
      <if test="status != null" >
        status,
      </if>
      <if test="createUser != null" >
        create_user,
      </if>
      <if test="createDept != null" >
        create_dept,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updateBy != null" >
        update_by,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="fId != null" >
        #{fId,jdbcType=BIGINT},
      </if>
      <if test="modelKey != null" >
        #{modelKey,jdbcType=VARCHAR},
      </if>
      <if test="modelVersion != null" >
        #{modelVersion,jdbcType=INTEGER},
      </if>
      <if test="modulId != null" >
        #{modulId,jdbcType=VARCHAR},
      </if>
      <if test="fName != null" >
        #{fName,jdbcType=VARCHAR},
      </if>
      <if test="workNum != null" >
        #{workNum,jdbcType=VARCHAR},
      </if>
      <if test="title != null" >
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="instanceId != null" >
        #{instanceId,jdbcType=VARCHAR},
      </if>
      <if test="processDefinitionName != null" >
        #{processDefinitionName,jdbcType=VARCHAR},
      </if>
      <if test="taskName != null" >
        #{taskName,jdbcType=VARCHAR},
      </if>
      <if test="creatUserName != null" >
        #{creatUserName,jdbcType=VARCHAR},
      </if>
      <if test="creatDeptName != null" >
        #{creatDeptName,jdbcType=VARCHAR},
      </if>
      <if test="creatFormTime != null" >
        #{creatFormTime,jdbcType=TIMESTAMP},
      </if>
      <if test="taskId != null" >
        #{taskId,jdbcType=VARCHAR},
      </if>
      <if test="fKey != null" >
        #{fKey,jdbcType=VARCHAR},
      </if>
      <if test="fVersion != null" >
        #{fVersion,jdbcType=BIGINT},
      </if>
      <if test="applyUser != null" >
        #{applyUser,jdbcType=VARCHAR},
      </if>
      <if test="jsonData != null" >
        #{jsonData,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        #{status,jdbcType=INTEGER},
      </if>
      <if test="createUser != null" >
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="createDept != null" >
        #{createDept,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null" >
        #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.activiti6.domain.MyFormDataActivitiExample" resultType="java.lang.Integer" >
    select count(*) from form_data_activiti
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update form_data_activiti
    <set >
      <if test="record.fId != null" >
        f_id = #{record.fId,jdbcType=BIGINT},
      </if>
      <if test="record.modelKey != null" >
        model_key = #{record.modelKey,jdbcType=VARCHAR},
      </if>
      <if test="record.modelVersion != null" >
        model_version = #{record.modelVersion,jdbcType=INTEGER},
      </if>
      <if test="record.modulId != null" >
        modul_id = #{record.modulId,jdbcType=VARCHAR},
      </if>
      <if test="record.fName != null" >
        f_name = #{record.fName,jdbcType=VARCHAR},
      </if>
      <if test="record.workNum != null" >
        work_num = #{record.workNum,jdbcType=VARCHAR},
      </if>
      <if test="record.title != null" >
        title = #{record.title,jdbcType=VARCHAR},
      </if>
      <if test="record.instanceId != null" >
        instance_id = #{record.instanceId,jdbcType=VARCHAR},
      </if>
      <if test="record.processDefinitionName != null" >
        process_definition_name = #{record.processDefinitionName,jdbcType=VARCHAR},
      </if>
      <if test="record.taskName != null" >
        task_name = #{record.taskName,jdbcType=VARCHAR},
      </if>
      <if test="record.creatUserName != null" >
        creat_user_name = #{record.creatUserName,jdbcType=VARCHAR},
      </if>
      <if test="record.creatDeptName != null" >
        creat_dept_name = #{record.creatDeptName,jdbcType=VARCHAR},
      </if>
      <if test="record.creatFormTime != null" >
        creat_form_time = #{record.creatFormTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.taskId != null" >
        task_id = #{record.taskId,jdbcType=VARCHAR},
      </if>
      <if test="record.fKey != null" >
        f_key = #{record.fKey,jdbcType=VARCHAR},
      </if>
      <if test="record.fVersion != null" >
        f_version = #{record.fVersion,jdbcType=BIGINT},
      </if>
      <if test="record.applyUser != null" >
        apply_user = #{record.applyUser,jdbcType=VARCHAR},
      </if>
      <if test="record.jsonData != null" >
        json_data = #{record.jsonData,jdbcType=VARCHAR},
      </if>
      <if test="record.status != null" >
        status = #{record.status,jdbcType=INTEGER},
      </if>
      <if test="record.createUser != null" >
        create_user = #{record.createUser,jdbcType=VARCHAR},
      </if>
      <if test="record.createDept != null" >
        create_dept = #{record.createDept,jdbcType=VARCHAR},
      </if>
      <if test="record.createBy != null" >
        create_by = #{record.createBy,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null" >
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateBy != null" >
        update_by = #{record.updateBy,jdbcType=VARCHAR},
      </if>
      <if test="record.updateTime != null" >
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update form_data_activiti
    set f_id = #{record.fId,jdbcType=BIGINT},
    model_key = #{record.modelKey,jdbcType=VARCHAR},
    model_version = #{record.modelVersion,jdbcType=INTEGER},
    modul_id = #{record.modulId,jdbcType=VARCHAR},
    f_name = #{record.fName,jdbcType=VARCHAR},
    work_num = #{record.workNum,jdbcType=VARCHAR},
    title = #{record.title,jdbcType=VARCHAR},
    instance_id = #{record.instanceId,jdbcType=VARCHAR},
    process_definition_name = #{record.processDefinitionName,jdbcType=VARCHAR},
    task_name = #{record.taskName,jdbcType=VARCHAR},
    creat_user_name = #{record.creatUserName,jdbcType=VARCHAR},
    creat_dept_name = #{record.creatDeptName,jdbcType=VARCHAR},
    creat_form_time = #{record.creatFormTime,jdbcType=TIMESTAMP},
    task_id = #{record.taskId,jdbcType=VARCHAR},
    f_key = #{record.fKey,jdbcType=VARCHAR},
    f_version = #{record.fVersion,jdbcType=BIGINT},
    apply_user = #{record.applyUser,jdbcType=VARCHAR},
    json_data = #{record.jsonData,jdbcType=VARCHAR},
    status = #{record.status,jdbcType=INTEGER},
    create_user = #{record.createUser,jdbcType=VARCHAR},
    create_dept = #{record.createDept,jdbcType=VARCHAR},
    create_by = #{record.createBy,jdbcType=VARCHAR},
    create_time = #{record.createTime,jdbcType=TIMESTAMP},
    update_by = #{record.updateBy,jdbcType=VARCHAR},
    update_time = #{record.updateTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.activiti6.domain.MyFormDataActiviti" >
    update form_data_activiti
    <set >
      <if test="modelKey != null" >
        model_key = #{modelKey,jdbcType=VARCHAR},
      </if>
      <if test="modelVersion != null" >
        model_version = #{modelVersion,jdbcType=INTEGER},
      </if>
      <if test="modulId != null" >
        modul_id = #{modulId,jdbcType=VARCHAR},
      </if>
      <if test="fName != null" >
        f_name = #{fName,jdbcType=VARCHAR},
      </if>
      <if test="workNum != null" >
        work_num = #{workNum,jdbcType=VARCHAR},
      </if>
      <if test="title != null" >
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="instanceId != null" >
        instance_id = #{instanceId,jdbcType=VARCHAR},
      </if>
      <if test="processDefinitionName != null" >
        process_definition_name = #{processDefinitionName,jdbcType=VARCHAR},
      </if>
      <if test="taskName != null" >
        task_name = #{taskName,jdbcType=VARCHAR},
      </if>
      <if test="creatUserName != null" >
        creat_user_name = #{creatUserName,jdbcType=VARCHAR},
      </if>
      <if test="creatDeptName != null" >
        creat_dept_name = #{creatDeptName,jdbcType=VARCHAR},
      </if>
      <if test="creatFormTime != null" >
        creat_form_time = #{creatFormTime,jdbcType=TIMESTAMP},
      </if>
      <if test="taskId != null" >
        task_id = #{taskId,jdbcType=VARCHAR},
      </if>
      <if test="fKey != null" >
        f_key = #{fKey,jdbcType=VARCHAR},
      </if>
      <if test="fVersion != null" >
        f_version = #{fVersion,jdbcType=BIGINT},
      </if>
      <if test="applyUser != null" >
        apply_user = #{applyUser,jdbcType=VARCHAR},
      </if>
      <if test="jsonData != null" >
        json_data = #{jsonData,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="createUser != null" >
        create_user = #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="createDept != null" >
        create_dept = #{createDept,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null" >
        update_by = #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where f_id = #{fId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.activiti6.domain.MyFormDataActiviti" >
    update form_data_activiti
    set model_key = #{modelKey,jdbcType=VARCHAR},
      model_version = #{modelVersion,jdbcType=INTEGER},
      modul_id = #{modulId,jdbcType=VARCHAR},
      f_name = #{fName,jdbcType=VARCHAR},
      work_num = #{workNum,jdbcType=VARCHAR},
      title = #{title,jdbcType=VARCHAR},
      instance_id = #{instanceId,jdbcType=VARCHAR},
      process_definition_name = #{processDefinitionName,jdbcType=VARCHAR},
      task_name = #{taskName,jdbcType=VARCHAR},
      creat_user_name = #{creatUserName,jdbcType=VARCHAR},
      creat_dept_name = #{creatDeptName,jdbcType=VARCHAR},
      creat_form_time = #{creatFormTime,jdbcType=TIMESTAMP},
      task_id = #{taskId,jdbcType=VARCHAR},
      f_key = #{fKey,jdbcType=VARCHAR},
      f_version = #{fVersion,jdbcType=BIGINT},
      apply_user = #{applyUser,jdbcType=VARCHAR},
      json_data = #{jsonData,jdbcType=VARCHAR},
      status = #{status,jdbcType=INTEGER},
      create_user = #{createUser,jdbcType=VARCHAR},
      create_dept = #{createDept,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_by = #{updateBy,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where f_id = #{fId,jdbcType=BIGINT}
  </update>
  <select id="taskDoneList" resultType="com.activiti6.domain.MyFormDataActiviti">
    SELECT
    f_id AS fId,
    model_key AS modelKey,
    model_version AS modelVersion,
    modul_id AS modulId,
    f_name AS fName,
    work_num AS workNum,
    title AS  title,
    instance_id AS instanceId,
    process_definition_name AS processDefinitionName,
    task_name AS taskName,
    creat_user_name AS creatUserName,
    creat_dept_name AS creatDeptName,
    creat_form_time AS creatFormTime,
    task_id AS taskId,
    f_key AS fKey,
    f_version AS fVersion,
    apply_user AS applyUser,
    STATUS AS 'status',
    create_user AS createUser,
    create_dept AS createDept,
    create_by AS createBy,
    create_time AS createTime,
    update_by AS updateBy,
    update_time AS updateTime
    FROM
    form_data_activiti
    WHERE
    1=1
    <if test="myFormDataActiviti.createBy !=null and myFormDataActiviti.createBy !=''">
      AND create_by = #{myFormDataActiviti.createBy}
    </if>
    <if test="myFormDataActiviti.processDefinitionName !=null and myFormDataActiviti.processDefinitionName !=''">
      AND title like concat('%', #{myFormDataActiviti.processDefinitionName}, '%')
    </if>
    GROUP BY
    instance_id
    ORDER BY
    create_time DESC
  </select>
</mapper>