ProcessFormMapper.xml 6.8 KB
<?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.sunyo.customer.order.activity.dao.ProcessFormMapper" >
  <resultMap id="BaseResultMap" type="com.sunyo.customer.order.activity.model.ProcessForm" >
    <id column="formId" property="formid" jdbcType="VARCHAR" />
    <id column="processInstanceId" property="processinstanceid" jdbcType="VARCHAR" />
    <result column="userId" property="userid" jdbcType="INTEGER" />
    <result column="processName" property="processname" jdbcType="VARCHAR" />
    <result column="beginDate" property="begindate" jdbcType="TIMESTAMP" />
    <result column="endDate" property="enddate" jdbcType="TIMESTAMP" />
    <result column="vacationType" property="vacationtype" jdbcType="TINYINT" />
    <result column="reason" property="reason" jdbcType="VARCHAR" />
    <result column="processStatus" property="processstatus" jdbcType="TINYINT" />
    <result column="createTime" property="createtime" jdbcType="TIMESTAMP" />
    <result column="updateTime" property="updatetime" jdbcType="TIMESTAMP" />
    <association property="user" javaType="com.sunyo.customer.order.activity.model.USER" >
      <id column="user_id" property="userId"/>
      <result column="realName" property="realname"/>
    </association>
  </resultMap>
  <sql id="Base_Column_List" >
    formId, processInstanceId, userId, processName, beginDate, endDate, vacationType, 
    reason, processStatus, createTime, updateTime
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="com.sunyo.customer.order.activity.model.ProcessForm" >
    select 
    <include refid="Base_Column_List" />
    from processForm
    where formId = #{formid,jdbcType=VARCHAR}
      and processInstanceId = #{processinstanceid,jdbcType=VARCHAR}
  </select>
  <select id="selectAllWithUser" resultMap="BaseResultMap" >
    select
    p.*,
    u.realName
    from processForm p
    LEFT JOIN users u
    ON p.userId = u.user_id
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.sunyo.customer.order.activity.model.ProcessForm" >
    delete from processForm
    where formId = #{formid,jdbcType=VARCHAR}
      and processInstanceId = #{processinstanceid,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.sunyo.customer.order.activity.model.ProcessForm" >
    insert into processForm (formId, processInstanceId, userId, 
      processName, beginDate, endDate, 
      vacationType, reason, processStatus, 
      createTime, updateTime)
    values (#{formid,jdbcType=VARCHAR}, #{processinstanceid,jdbcType=VARCHAR}, #{userid,jdbcType=INTEGER}, 
      #{processname,jdbcType=VARCHAR}, #{begindate,jdbcType=TIMESTAMP}, #{enddate,jdbcType=TIMESTAMP}, 
      #{vacationtype,jdbcType=TINYINT}, #{reason,jdbcType=VARCHAR}, #{processstatus,jdbcType=TINYINT}, 
      #{createtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective"  parameterType="com.sunyo.customer.order.activity.model.ProcessForm" >
    insert into processForm
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="formid != null" >
        formId,
      </if>
      <if test="processinstanceid != null" >
        processInstanceId,
      </if>
      <if test="userid != null" >
        userId,
      </if>
      <if test="processname != null" >
        processName,
      </if>
      <if test="begindate != null" >
        beginDate,
      </if>
      <if test="enddate != null" >
        endDate,
      </if>
      <if test="vacationtype != null" >
        vacationType,
      </if>
      <if test="reason != null" >
        reason,
      </if>
      <if test="processstatus != null" >
        processStatus,
      </if>
      <if test="createtime != null" >
        createTime,
      </if>
      <if test="updatetime != null" >
        updateTime,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="formid != null" >
        #{formid,jdbcType=VARCHAR},
      </if>
      <if test="processinstanceid != null" >
        #{processinstanceid,jdbcType=VARCHAR},
      </if>
      <if test="userid != null" >
        #{userid,jdbcType=INTEGER},
      </if>
      <if test="processname != null" >
        #{processname,jdbcType=VARCHAR},
      </if>
      <if test="begindate != null" >
        #{begindate,jdbcType=TIMESTAMP},
      </if>
      <if test="enddate != null" >
        #{enddate,jdbcType=TIMESTAMP},
      </if>
      <if test="vacationtype != null" >
        #{vacationtype,jdbcType=TINYINT},
      </if>
      <if test="reason != null" >
        #{reason,jdbcType=VARCHAR},
      </if>
      <if test="processstatus != null" >
        #{processstatus,jdbcType=TINYINT},
      </if>
      <if test="createtime != null" >
        #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updatetime != null" >
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.customer.order.activity.model.ProcessForm" >
    update processForm
    <set >
      <if test="userid != null" >
        userId = #{userid,jdbcType=INTEGER},
      </if>
      <if test="processname != null" >
        processName = #{processname,jdbcType=VARCHAR},
      </if>
      <if test="begindate != null" >
        beginDate = #{begindate,jdbcType=TIMESTAMP},
      </if>
      <if test="enddate != null" >
        endDate = #{enddate,jdbcType=TIMESTAMP},
      </if>
      <if test="vacationtype != null" >
        vacationType = #{vacationtype,jdbcType=TINYINT},
      </if>
      <if test="reason != null" >
        reason = #{reason,jdbcType=VARCHAR},
      </if>
      <if test="processstatus != null" >
        processStatus = #{processstatus,jdbcType=TINYINT},
      </if>
      <if test="createtime != null" >
        createTime = #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updatetime != null" >
        updateTime = #{updatetime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where formId = #{formid,jdbcType=VARCHAR}
      and processInstanceId = #{processinstanceid,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.sunyo.customer.order.activity.model.ProcessForm" >
    update processForm
    set userId = #{userid,jdbcType=INTEGER},
      processName = #{processname,jdbcType=VARCHAR},
      beginDate = #{begindate,jdbcType=TIMESTAMP},
      endDate = #{enddate,jdbcType=TIMESTAMP},
      vacationType = #{vacationtype,jdbcType=TINYINT},
      reason = #{reason,jdbcType=VARCHAR},
      processStatus = #{processstatus,jdbcType=TINYINT},
      createTime = #{createtime,jdbcType=TIMESTAMP},
      updateTime = #{updatetime,jdbcType=TIMESTAMP}
    where formId = #{formid,jdbcType=VARCHAR}
      and processInstanceId = #{processinstanceid,jdbcType=VARCHAR}
  </update>
</mapper>