<?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.goafanti.common.dao.TOrderTaskMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderTask">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
    <result column="main" jdbcType="INTEGER" property="main" />
    <result column="super_id" jdbcType="VARCHAR" property="superId" />
    <result column="commodity_id" jdbcType="VARCHAR" property="commodityId" />
    <result column="commodity_name" jdbcType="VARCHAR" property="commodityName" />
    <result column="commodity_quantity" jdbcType="INTEGER" property="commodityQuantity" />
    <result column="commodity_mode" jdbcType="VARCHAR" property="commodityMode" />
    <result column="commodity_price" jdbcType="DECIMAL" property="commodityPrice" />
    <result column="task_status" jdbcType="INTEGER" property="taskStatus" />
    <result column="task_distribution_time" jdbcType="TIMESTAMP" property="taskDistributionTime" />
    <result column="task_allocator" jdbcType="VARCHAR" property="taskAllocator" />
    <result column="task_receiver" jdbcType="VARCHAR" property="taskReceiver" />
    <result column="task_comment" jdbcType="VARCHAR" property="taskComment" />
    <result column="task_start_time" jdbcType="TIMESTAMP" property="taskStartTime" />
    <result column="task_end_time" jdbcType="TIMESTAMP" property="taskEndTime" />
    <result column="project_status" jdbcType="INTEGER" property="projectStatus" />
    <result column="accept_time" jdbcType="DATE" property="acceptTime" />
    <result column="review_time" jdbcType="DATE" property="reviewTime" />
    <result column="publicity_time" jdbcType="DATE" property="publicityTime" />
    <result column="licence_time" jdbcType="DATE" property="licenceTime" />
    <result column="certificate_number" jdbcType="VARCHAR" property="certificateNumber" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="form_retrieve" jdbcType="INTEGER" property="formRetrieve" />
    <result column="task_refund" jdbcType="INTEGER" property="taskRefund" />
    <result column="refund_content" jdbcType="VARCHAR" property="refundContent" />
    <result column="retrieve_content" jdbcType="VARCHAR" property="retrieveContent" />
    <result column="declare_user" jdbcType="VARCHAR" property="declareUser" />
    <result column="declare_pwd" jdbcType="VARCHAR" property="declarePwd" />
    <result column="set_up_amount" jdbcType="DECIMAL" property="setUpAmount" />
    <result column="arrival_money" jdbcType="INTEGER" property="arrivalMoney" />
    <result column="outsource_name" jdbcType="VARCHAR" property="outsourceName" />
    <result column="outsource_price" jdbcType="DECIMAL" property="outsourcePrice" />
    <result column="consultant_id" jdbcType="VARCHAR" property="consultantId" />
    <result column="manager_id" jdbcType="VARCHAR" property="managerId" />
    <result column="outsource" jdbcType="INTEGER" property="outsource" />
    <result column="split_super" jdbcType="INTEGER" property="splitSuper" />
    <result column="split_status" jdbcType="INTEGER" property="splitStatus" />
    <result column="split_id" jdbcType="INTEGER" property="splitId" />
    <result column="split_aid" jdbcType="VARCHAR" property="splitAid" />
    <result column="split_time" jdbcType="TIMESTAMP" property="splitTime" />
    <result column="cname" jdbcType="VARCHAR" property="cname" />
    <result column="receiver_name" jdbcType="VARCHAR" property="receiverName" />
    <result column="declaration_batch" jdbcType="INTEGER" property="declarationBatch" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.TOrderTask">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    <result column="attachment_url" jdbcType="LONGVARCHAR" property="attachmentUrl" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    id, order_no, main, super_id, commodity_id, commodity_name, commodity_quantity, commodity_mode, 
    commodity_price, task_status, task_distribution_time, task_allocator, task_receiver, 
    task_comment, task_start_time, task_end_time, project_status, accept_time, review_time, 
    publicity_time, licence_time, certificate_number, status, form_retrieve, task_refund, 
    refund_content, retrieve_content, declare_user, declare_pwd, set_up_amount, arrival_money, 
    outsource_name, outsource_price, consultant_id, manager_id, outsource, split_super, 
    split_status, split_id, split_aid, split_time, cname, receiver_name, declaration_batch
  </sql>
  <sql id="Blob_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    attachment_url
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.goafanti.common.model.TOrderTaskExample" resultMap="ResultMapWithBLOBs">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from t_order_task
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderTaskExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_order_task
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from t_order_task
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    delete from t_order_task
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.goafanti.common.model.TOrderTaskExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    delete from t_order_task
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.TOrderTask">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    insert into t_order_task (id, order_no, main, 
      super_id, commodity_id, commodity_name, 
      commodity_quantity, commodity_mode, commodity_price, 
      task_status, task_distribution_time, task_allocator, 
      task_receiver, task_comment, task_start_time, 
      task_end_time, project_status, accept_time, 
      review_time, publicity_time, licence_time, 
      certificate_number, status, form_retrieve, 
      task_refund, refund_content, retrieve_content, 
      declare_user, declare_pwd, set_up_amount, 
      arrival_money, outsource_name, outsource_price, 
      consultant_id, manager_id, outsource, 
      split_super, split_status, split_id, 
      split_aid, split_time, cname, 
      receiver_name, declaration_batch, attachment_url
      )
    values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{main,jdbcType=INTEGER}, 
      #{superId,jdbcType=VARCHAR}, #{commodityId,jdbcType=VARCHAR}, #{commodityName,jdbcType=VARCHAR}, 
      #{commodityQuantity,jdbcType=INTEGER}, #{commodityMode,jdbcType=VARCHAR}, #{commodityPrice,jdbcType=DECIMAL}, 
      #{taskStatus,jdbcType=INTEGER}, #{taskDistributionTime,jdbcType=TIMESTAMP}, #{taskAllocator,jdbcType=VARCHAR}, 
      #{taskReceiver,jdbcType=VARCHAR}, #{taskComment,jdbcType=VARCHAR}, #{taskStartTime,jdbcType=TIMESTAMP}, 
      #{taskEndTime,jdbcType=TIMESTAMP}, #{projectStatus,jdbcType=INTEGER}, #{acceptTime,jdbcType=DATE}, 
      #{reviewTime,jdbcType=DATE}, #{publicityTime,jdbcType=DATE}, #{licenceTime,jdbcType=DATE}, 
      #{certificateNumber,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{formRetrieve,jdbcType=INTEGER}, 
      #{taskRefund,jdbcType=INTEGER}, #{refundContent,jdbcType=VARCHAR}, #{retrieveContent,jdbcType=VARCHAR}, 
      #{declareUser,jdbcType=VARCHAR}, #{declarePwd,jdbcType=VARCHAR}, #{setUpAmount,jdbcType=DECIMAL}, 
      #{arrivalMoney,jdbcType=INTEGER}, #{outsourceName,jdbcType=VARCHAR}, #{outsourcePrice,jdbcType=DECIMAL}, 
      #{consultantId,jdbcType=VARCHAR}, #{managerId,jdbcType=VARCHAR}, #{outsource,jdbcType=INTEGER}, 
      #{splitSuper,jdbcType=INTEGER}, #{splitStatus,jdbcType=INTEGER}, #{splitId,jdbcType=INTEGER}, 
      #{splitAid,jdbcType=VARCHAR}, #{splitTime,jdbcType=TIMESTAMP}, #{cname,jdbcType=VARCHAR}, 
      #{receiverName,jdbcType=VARCHAR}, #{declarationBatch,jdbcType=INTEGER}, #{attachmentUrl,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderTask">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    insert into t_order_task
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="orderNo != null">
        order_no,
      </if>
      <if test="main != null">
        main,
      </if>
      <if test="superId != null">
        super_id,
      </if>
      <if test="commodityId != null">
        commodity_id,
      </if>
      <if test="commodityName != null">
        commodity_name,
      </if>
      <if test="commodityQuantity != null">
        commodity_quantity,
      </if>
      <if test="commodityMode != null">
        commodity_mode,
      </if>
      <if test="commodityPrice != null">
        commodity_price,
      </if>
      <if test="taskStatus != null">
        task_status,
      </if>
      <if test="taskDistributionTime != null">
        task_distribution_time,
      </if>
      <if test="taskAllocator != null">
        task_allocator,
      </if>
      <if test="taskReceiver != null">
        task_receiver,
      </if>
      <if test="taskComment != null">
        task_comment,
      </if>
      <if test="taskStartTime != null">
        task_start_time,
      </if>
      <if test="taskEndTime != null">
        task_end_time,
      </if>
      <if test="projectStatus != null">
        project_status,
      </if>
      <if test="acceptTime != null">
        accept_time,
      </if>
      <if test="reviewTime != null">
        review_time,
      </if>
      <if test="publicityTime != null">
        publicity_time,
      </if>
      <if test="licenceTime != null">
        licence_time,
      </if>
      <if test="certificateNumber != null">
        certificate_number,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="formRetrieve != null">
        form_retrieve,
      </if>
      <if test="taskRefund != null">
        task_refund,
      </if>
      <if test="refundContent != null">
        refund_content,
      </if>
      <if test="retrieveContent != null">
        retrieve_content,
      </if>
      <if test="declareUser != null">
        declare_user,
      </if>
      <if test="declarePwd != null">
        declare_pwd,
      </if>
      <if test="setUpAmount != null">
        set_up_amount,
      </if>
      <if test="arrivalMoney != null">
        arrival_money,
      </if>
      <if test="outsourceName != null">
        outsource_name,
      </if>
      <if test="outsourcePrice != null">
        outsource_price,
      </if>
      <if test="consultantId != null">
        consultant_id,
      </if>
      <if test="managerId != null">
        manager_id,
      </if>
      <if test="outsource != null">
        outsource,
      </if>
      <if test="splitSuper != null">
        split_super,
      </if>
      <if test="splitStatus != null">
        split_status,
      </if>
      <if test="splitId != null">
        split_id,
      </if>
      <if test="splitAid != null">
        split_aid,
      </if>
      <if test="splitTime != null">
        split_time,
      </if>
      <if test="cname != null">
        cname,
      </if>
      <if test="receiverName != null">
        receiver_name,
      </if>
      <if test="declarationBatch != null">
        declaration_batch,
      </if>
      <if test="attachmentUrl != null">
        attachment_url,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="orderNo != null">
        #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="main != null">
        #{main,jdbcType=INTEGER},
      </if>
      <if test="superId != null">
        #{superId,jdbcType=VARCHAR},
      </if>
      <if test="commodityId != null">
        #{commodityId,jdbcType=VARCHAR},
      </if>
      <if test="commodityName != null">
        #{commodityName,jdbcType=VARCHAR},
      </if>
      <if test="commodityQuantity != null">
        #{commodityQuantity,jdbcType=INTEGER},
      </if>
      <if test="commodityMode != null">
        #{commodityMode,jdbcType=VARCHAR},
      </if>
      <if test="commodityPrice != null">
        #{commodityPrice,jdbcType=DECIMAL},
      </if>
      <if test="taskStatus != null">
        #{taskStatus,jdbcType=INTEGER},
      </if>
      <if test="taskDistributionTime != null">
        #{taskDistributionTime,jdbcType=TIMESTAMP},
      </if>
      <if test="taskAllocator != null">
        #{taskAllocator,jdbcType=VARCHAR},
      </if>
      <if test="taskReceiver != null">
        #{taskReceiver,jdbcType=VARCHAR},
      </if>
      <if test="taskComment != null">
        #{taskComment,jdbcType=VARCHAR},
      </if>
      <if test="taskStartTime != null">
        #{taskStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="taskEndTime != null">
        #{taskEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="projectStatus != null">
        #{projectStatus,jdbcType=INTEGER},
      </if>
      <if test="acceptTime != null">
        #{acceptTime,jdbcType=DATE},
      </if>
      <if test="reviewTime != null">
        #{reviewTime,jdbcType=DATE},
      </if>
      <if test="publicityTime != null">
        #{publicityTime,jdbcType=DATE},
      </if>
      <if test="licenceTime != null">
        #{licenceTime,jdbcType=DATE},
      </if>
      <if test="certificateNumber != null">
        #{certificateNumber,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="formRetrieve != null">
        #{formRetrieve,jdbcType=INTEGER},
      </if>
      <if test="taskRefund != null">
        #{taskRefund,jdbcType=INTEGER},
      </if>
      <if test="refundContent != null">
        #{refundContent,jdbcType=VARCHAR},
      </if>
      <if test="retrieveContent != null">
        #{retrieveContent,jdbcType=VARCHAR},
      </if>
      <if test="declareUser != null">
        #{declareUser,jdbcType=VARCHAR},
      </if>
      <if test="declarePwd != null">
        #{declarePwd,jdbcType=VARCHAR},
      </if>
      <if test="setUpAmount != null">
        #{setUpAmount,jdbcType=DECIMAL},
      </if>
      <if test="arrivalMoney != null">
        #{arrivalMoney,jdbcType=INTEGER},
      </if>
      <if test="outsourceName != null">
        #{outsourceName,jdbcType=VARCHAR},
      </if>
      <if test="outsourcePrice != null">
        #{outsourcePrice,jdbcType=DECIMAL},
      </if>
      <if test="consultantId != null">
        #{consultantId,jdbcType=VARCHAR},
      </if>
      <if test="managerId != null">
        #{managerId,jdbcType=VARCHAR},
      </if>
      <if test="outsource != null">
        #{outsource,jdbcType=INTEGER},
      </if>
      <if test="splitSuper != null">
        #{splitSuper,jdbcType=INTEGER},
      </if>
      <if test="splitStatus != null">
        #{splitStatus,jdbcType=INTEGER},
      </if>
      <if test="splitId != null">
        #{splitId,jdbcType=INTEGER},
      </if>
      <if test="splitAid != null">
        #{splitAid,jdbcType=VARCHAR},
      </if>
      <if test="splitTime != null">
        #{splitTime,jdbcType=TIMESTAMP},
      </if>
      <if test="cname != null">
        #{cname,jdbcType=VARCHAR},
      </if>
      <if test="receiverName != null">
        #{receiverName,jdbcType=VARCHAR},
      </if>
      <if test="declarationBatch != null">
        #{declarationBatch,jdbcType=INTEGER},
      </if>
      <if test="attachmentUrl != null">
        #{attachmentUrl,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.goafanti.common.model.TOrderTaskExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    select count(*) from t_order_task
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    update t_order_task
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.orderNo != null">
        order_no = #{record.orderNo,jdbcType=VARCHAR},
      </if>
      <if test="record.main != null">
        main = #{record.main,jdbcType=INTEGER},
      </if>
      <if test="record.superId != null">
        super_id = #{record.superId,jdbcType=VARCHAR},
      </if>
      <if test="record.commodityId != null">
        commodity_id = #{record.commodityId,jdbcType=VARCHAR},
      </if>
      <if test="record.commodityName != null">
        commodity_name = #{record.commodityName,jdbcType=VARCHAR},
      </if>
      <if test="record.commodityQuantity != null">
        commodity_quantity = #{record.commodityQuantity,jdbcType=INTEGER},
      </if>
      <if test="record.commodityMode != null">
        commodity_mode = #{record.commodityMode,jdbcType=VARCHAR},
      </if>
      <if test="record.commodityPrice != null">
        commodity_price = #{record.commodityPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.taskStatus != null">
        task_status = #{record.taskStatus,jdbcType=INTEGER},
      </if>
      <if test="record.taskDistributionTime != null">
        task_distribution_time = #{record.taskDistributionTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.taskAllocator != null">
        task_allocator = #{record.taskAllocator,jdbcType=VARCHAR},
      </if>
      <if test="record.taskReceiver != null">
        task_receiver = #{record.taskReceiver,jdbcType=VARCHAR},
      </if>
      <if test="record.taskComment != null">
        task_comment = #{record.taskComment,jdbcType=VARCHAR},
      </if>
      <if test="record.taskStartTime != null">
        task_start_time = #{record.taskStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.taskEndTime != null">
        task_end_time = #{record.taskEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.projectStatus != null">
        project_status = #{record.projectStatus,jdbcType=INTEGER},
      </if>
      <if test="record.acceptTime != null">
        accept_time = #{record.acceptTime,jdbcType=DATE},
      </if>
      <if test="record.reviewTime != null">
        review_time = #{record.reviewTime,jdbcType=DATE},
      </if>
      <if test="record.publicityTime != null">
        publicity_time = #{record.publicityTime,jdbcType=DATE},
      </if>
      <if test="record.licenceTime != null">
        licence_time = #{record.licenceTime,jdbcType=DATE},
      </if>
      <if test="record.certificateNumber != null">
        certificate_number = #{record.certificateNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.status != null">
        status = #{record.status,jdbcType=INTEGER},
      </if>
      <if test="record.formRetrieve != null">
        form_retrieve = #{record.formRetrieve,jdbcType=INTEGER},
      </if>
      <if test="record.taskRefund != null">
        task_refund = #{record.taskRefund,jdbcType=INTEGER},
      </if>
      <if test="record.refundContent != null">
        refund_content = #{record.refundContent,jdbcType=VARCHAR},
      </if>
      <if test="record.retrieveContent != null">
        retrieve_content = #{record.retrieveContent,jdbcType=VARCHAR},
      </if>
      <if test="record.declareUser != null">
        declare_user = #{record.declareUser,jdbcType=VARCHAR},
      </if>
      <if test="record.declarePwd != null">
        declare_pwd = #{record.declarePwd,jdbcType=VARCHAR},
      </if>
      <if test="record.setUpAmount != null">
        set_up_amount = #{record.setUpAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.arrivalMoney != null">
        arrival_money = #{record.arrivalMoney,jdbcType=INTEGER},
      </if>
      <if test="record.outsourceName != null">
        outsource_name = #{record.outsourceName,jdbcType=VARCHAR},
      </if>
      <if test="record.outsourcePrice != null">
        outsource_price = #{record.outsourcePrice,jdbcType=DECIMAL},
      </if>
      <if test="record.consultantId != null">
        consultant_id = #{record.consultantId,jdbcType=VARCHAR},
      </if>
      <if test="record.managerId != null">
        manager_id = #{record.managerId,jdbcType=VARCHAR},
      </if>
      <if test="record.outsource != null">
        outsource = #{record.outsource,jdbcType=INTEGER},
      </if>
      <if test="record.splitSuper != null">
        split_super = #{record.splitSuper,jdbcType=INTEGER},
      </if>
      <if test="record.splitStatus != null">
        split_status = #{record.splitStatus,jdbcType=INTEGER},
      </if>
      <if test="record.splitId != null">
        split_id = #{record.splitId,jdbcType=INTEGER},
      </if>
      <if test="record.splitAid != null">
        split_aid = #{record.splitAid,jdbcType=VARCHAR},
      </if>
      <if test="record.splitTime != null">
        split_time = #{record.splitTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.cname != null">
        cname = #{record.cname,jdbcType=VARCHAR},
      </if>
      <if test="record.receiverName != null">
        receiver_name = #{record.receiverName,jdbcType=VARCHAR},
      </if>
      <if test="record.declarationBatch != null">
        declaration_batch = #{record.declarationBatch,jdbcType=INTEGER},
      </if>
      <if test="record.attachmentUrl != null">
        attachment_url = #{record.attachmentUrl,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    update t_order_task
    set id = #{record.id,jdbcType=INTEGER},
      order_no = #{record.orderNo,jdbcType=VARCHAR},
      main = #{record.main,jdbcType=INTEGER},
      super_id = #{record.superId,jdbcType=VARCHAR},
      commodity_id = #{record.commodityId,jdbcType=VARCHAR},
      commodity_name = #{record.commodityName,jdbcType=VARCHAR},
      commodity_quantity = #{record.commodityQuantity,jdbcType=INTEGER},
      commodity_mode = #{record.commodityMode,jdbcType=VARCHAR},
      commodity_price = #{record.commodityPrice,jdbcType=DECIMAL},
      task_status = #{record.taskStatus,jdbcType=INTEGER},
      task_distribution_time = #{record.taskDistributionTime,jdbcType=TIMESTAMP},
      task_allocator = #{record.taskAllocator,jdbcType=VARCHAR},
      task_receiver = #{record.taskReceiver,jdbcType=VARCHAR},
      task_comment = #{record.taskComment,jdbcType=VARCHAR},
      task_start_time = #{record.taskStartTime,jdbcType=TIMESTAMP},
      task_end_time = #{record.taskEndTime,jdbcType=TIMESTAMP},
      project_status = #{record.projectStatus,jdbcType=INTEGER},
      accept_time = #{record.acceptTime,jdbcType=DATE},
      review_time = #{record.reviewTime,jdbcType=DATE},
      publicity_time = #{record.publicityTime,jdbcType=DATE},
      licence_time = #{record.licenceTime,jdbcType=DATE},
      certificate_number = #{record.certificateNumber,jdbcType=VARCHAR},
      status = #{record.status,jdbcType=INTEGER},
      form_retrieve = #{record.formRetrieve,jdbcType=INTEGER},
      task_refund = #{record.taskRefund,jdbcType=INTEGER},
      refund_content = #{record.refundContent,jdbcType=VARCHAR},
      retrieve_content = #{record.retrieveContent,jdbcType=VARCHAR},
      declare_user = #{record.declareUser,jdbcType=VARCHAR},
      declare_pwd = #{record.declarePwd,jdbcType=VARCHAR},
      set_up_amount = #{record.setUpAmount,jdbcType=DECIMAL},
      arrival_money = #{record.arrivalMoney,jdbcType=INTEGER},
      outsource_name = #{record.outsourceName,jdbcType=VARCHAR},
      outsource_price = #{record.outsourcePrice,jdbcType=DECIMAL},
      consultant_id = #{record.consultantId,jdbcType=VARCHAR},
      manager_id = #{record.managerId,jdbcType=VARCHAR},
      outsource = #{record.outsource,jdbcType=INTEGER},
      split_super = #{record.splitSuper,jdbcType=INTEGER},
      split_status = #{record.splitStatus,jdbcType=INTEGER},
      split_id = #{record.splitId,jdbcType=INTEGER},
      split_aid = #{record.splitAid,jdbcType=VARCHAR},
      split_time = #{record.splitTime,jdbcType=TIMESTAMP},
      cname = #{record.cname,jdbcType=VARCHAR},
      receiver_name = #{record.receiverName,jdbcType=VARCHAR},
      declaration_batch = #{record.declarationBatch,jdbcType=INTEGER},
      attachment_url = #{record.attachmentUrl,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    update t_order_task
    set id = #{record.id,jdbcType=INTEGER},
      order_no = #{record.orderNo,jdbcType=VARCHAR},
      main = #{record.main,jdbcType=INTEGER},
      super_id = #{record.superId,jdbcType=VARCHAR},
      commodity_id = #{record.commodityId,jdbcType=VARCHAR},
      commodity_name = #{record.commodityName,jdbcType=VARCHAR},
      commodity_quantity = #{record.commodityQuantity,jdbcType=INTEGER},
      commodity_mode = #{record.commodityMode,jdbcType=VARCHAR},
      commodity_price = #{record.commodityPrice,jdbcType=DECIMAL},
      task_status = #{record.taskStatus,jdbcType=INTEGER},
      task_distribution_time = #{record.taskDistributionTime,jdbcType=TIMESTAMP},
      task_allocator = #{record.taskAllocator,jdbcType=VARCHAR},
      task_receiver = #{record.taskReceiver,jdbcType=VARCHAR},
      task_comment = #{record.taskComment,jdbcType=VARCHAR},
      task_start_time = #{record.taskStartTime,jdbcType=TIMESTAMP},
      task_end_time = #{record.taskEndTime,jdbcType=TIMESTAMP},
      project_status = #{record.projectStatus,jdbcType=INTEGER},
      accept_time = #{record.acceptTime,jdbcType=DATE},
      review_time = #{record.reviewTime,jdbcType=DATE},
      publicity_time = #{record.publicityTime,jdbcType=DATE},
      licence_time = #{record.licenceTime,jdbcType=DATE},
      certificate_number = #{record.certificateNumber,jdbcType=VARCHAR},
      status = #{record.status,jdbcType=INTEGER},
      form_retrieve = #{record.formRetrieve,jdbcType=INTEGER},
      task_refund = #{record.taskRefund,jdbcType=INTEGER},
      refund_content = #{record.refundContent,jdbcType=VARCHAR},
      retrieve_content = #{record.retrieveContent,jdbcType=VARCHAR},
      declare_user = #{record.declareUser,jdbcType=VARCHAR},
      declare_pwd = #{record.declarePwd,jdbcType=VARCHAR},
      set_up_amount = #{record.setUpAmount,jdbcType=DECIMAL},
      arrival_money = #{record.arrivalMoney,jdbcType=INTEGER},
      outsource_name = #{record.outsourceName,jdbcType=VARCHAR},
      outsource_price = #{record.outsourcePrice,jdbcType=DECIMAL},
      consultant_id = #{record.consultantId,jdbcType=VARCHAR},
      manager_id = #{record.managerId,jdbcType=VARCHAR},
      outsource = #{record.outsource,jdbcType=INTEGER},
      split_super = #{record.splitSuper,jdbcType=INTEGER},
      split_status = #{record.splitStatus,jdbcType=INTEGER},
      split_id = #{record.splitId,jdbcType=INTEGER},
      split_aid = #{record.splitAid,jdbcType=VARCHAR},
      split_time = #{record.splitTime,jdbcType=TIMESTAMP},
      cname = #{record.cname,jdbcType=VARCHAR},
      receiver_name = #{record.receiverName,jdbcType=VARCHAR},
      declaration_batch = #{record.declarationBatch,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderTask">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    update t_order_task
    <set>
      <if test="orderNo != null">
        order_no = #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="main != null">
        main = #{main,jdbcType=INTEGER},
      </if>
      <if test="superId != null">
        super_id = #{superId,jdbcType=VARCHAR},
      </if>
      <if test="commodityId != null">
        commodity_id = #{commodityId,jdbcType=VARCHAR},
      </if>
      <if test="commodityName != null">
        commodity_name = #{commodityName,jdbcType=VARCHAR},
      </if>
      <if test="commodityQuantity != null">
        commodity_quantity = #{commodityQuantity,jdbcType=INTEGER},
      </if>
      <if test="commodityMode != null">
        commodity_mode = #{commodityMode,jdbcType=VARCHAR},
      </if>
      <if test="commodityPrice != null">
        commodity_price = #{commodityPrice,jdbcType=DECIMAL},
      </if>
      <if test="taskStatus != null">
        task_status = #{taskStatus,jdbcType=INTEGER},
      </if>
      <if test="taskDistributionTime != null">
        task_distribution_time = #{taskDistributionTime,jdbcType=TIMESTAMP},
      </if>
      <if test="taskAllocator != null">
        task_allocator = #{taskAllocator,jdbcType=VARCHAR},
      </if>
      <if test="taskReceiver != null">
        task_receiver = #{taskReceiver,jdbcType=VARCHAR},
      </if>
      <if test="taskComment != null">
        task_comment = #{taskComment,jdbcType=VARCHAR},
      </if>
      <if test="taskStartTime != null">
        task_start_time = #{taskStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="taskEndTime != null">
        task_end_time = #{taskEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="projectStatus != null">
        project_status = #{projectStatus,jdbcType=INTEGER},
      </if>
      <if test="acceptTime != null">
        accept_time = #{acceptTime,jdbcType=DATE},
      </if>
      <if test="reviewTime != null">
        review_time = #{reviewTime,jdbcType=DATE},
      </if>
      <if test="publicityTime != null">
        publicity_time = #{publicityTime,jdbcType=DATE},
      </if>
      <if test="licenceTime != null">
        licence_time = #{licenceTime,jdbcType=DATE},
      </if>
      <if test="certificateNumber != null">
        certificate_number = #{certificateNumber,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="formRetrieve != null">
        form_retrieve = #{formRetrieve,jdbcType=INTEGER},
      </if>
      <if test="taskRefund != null">
        task_refund = #{taskRefund,jdbcType=INTEGER},
      </if>
      <if test="refundContent != null">
        refund_content = #{refundContent,jdbcType=VARCHAR},
      </if>
      <if test="retrieveContent != null">
        retrieve_content = #{retrieveContent,jdbcType=VARCHAR},
      </if>
      <if test="declareUser != null">
        declare_user = #{declareUser,jdbcType=VARCHAR},
      </if>
      <if test="declarePwd != null">
        declare_pwd = #{declarePwd,jdbcType=VARCHAR},
      </if>
      <if test="setUpAmount != null">
        set_up_amount = #{setUpAmount,jdbcType=DECIMAL},
      </if>
      <if test="arrivalMoney != null">
        arrival_money = #{arrivalMoney,jdbcType=INTEGER},
      </if>
      <if test="outsourceName != null">
        outsource_name = #{outsourceName,jdbcType=VARCHAR},
      </if>
      <if test="outsourcePrice != null">
        outsource_price = #{outsourcePrice,jdbcType=DECIMAL},
      </if>
      <if test="consultantId != null">
        consultant_id = #{consultantId,jdbcType=VARCHAR},
      </if>
      <if test="managerId != null">
        manager_id = #{managerId,jdbcType=VARCHAR},
      </if>
      <if test="outsource != null">
        outsource = #{outsource,jdbcType=INTEGER},
      </if>
      <if test="splitSuper != null">
        split_super = #{splitSuper,jdbcType=INTEGER},
      </if>
      <if test="splitStatus != null">
        split_status = #{splitStatus,jdbcType=INTEGER},
      </if>
      <if test="splitId != null">
        split_id = #{splitId,jdbcType=INTEGER},
      </if>
      <if test="splitAid != null">
        split_aid = #{splitAid,jdbcType=VARCHAR},
      </if>
      <if test="splitTime != null">
        split_time = #{splitTime,jdbcType=TIMESTAMP},
      </if>
      <if test="cname != null">
        cname = #{cname,jdbcType=VARCHAR},
      </if>
      <if test="receiverName != null">
        receiver_name = #{receiverName,jdbcType=VARCHAR},
      </if>
      <if test="declarationBatch != null">
        declaration_batch = #{declarationBatch,jdbcType=INTEGER},
      </if>
      <if test="attachmentUrl != null">
        attachment_url = #{attachmentUrl,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.goafanti.common.model.TOrderTask">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    update t_order_task
    set order_no = #{orderNo,jdbcType=VARCHAR},
      main = #{main,jdbcType=INTEGER},
      super_id = #{superId,jdbcType=VARCHAR},
      commodity_id = #{commodityId,jdbcType=VARCHAR},
      commodity_name = #{commodityName,jdbcType=VARCHAR},
      commodity_quantity = #{commodityQuantity,jdbcType=INTEGER},
      commodity_mode = #{commodityMode,jdbcType=VARCHAR},
      commodity_price = #{commodityPrice,jdbcType=DECIMAL},
      task_status = #{taskStatus,jdbcType=INTEGER},
      task_distribution_time = #{taskDistributionTime,jdbcType=TIMESTAMP},
      task_allocator = #{taskAllocator,jdbcType=VARCHAR},
      task_receiver = #{taskReceiver,jdbcType=VARCHAR},
      task_comment = #{taskComment,jdbcType=VARCHAR},
      task_start_time = #{taskStartTime,jdbcType=TIMESTAMP},
      task_end_time = #{taskEndTime,jdbcType=TIMESTAMP},
      project_status = #{projectStatus,jdbcType=INTEGER},
      accept_time = #{acceptTime,jdbcType=DATE},
      review_time = #{reviewTime,jdbcType=DATE},
      publicity_time = #{publicityTime,jdbcType=DATE},
      licence_time = #{licenceTime,jdbcType=DATE},
      certificate_number = #{certificateNumber,jdbcType=VARCHAR},
      status = #{status,jdbcType=INTEGER},
      form_retrieve = #{formRetrieve,jdbcType=INTEGER},
      task_refund = #{taskRefund,jdbcType=INTEGER},
      refund_content = #{refundContent,jdbcType=VARCHAR},
      retrieve_content = #{retrieveContent,jdbcType=VARCHAR},
      declare_user = #{declareUser,jdbcType=VARCHAR},
      declare_pwd = #{declarePwd,jdbcType=VARCHAR},
      set_up_amount = #{setUpAmount,jdbcType=DECIMAL},
      arrival_money = #{arrivalMoney,jdbcType=INTEGER},
      outsource_name = #{outsourceName,jdbcType=VARCHAR},
      outsource_price = #{outsourcePrice,jdbcType=DECIMAL},
      consultant_id = #{consultantId,jdbcType=VARCHAR},
      manager_id = #{managerId,jdbcType=VARCHAR},
      outsource = #{outsource,jdbcType=INTEGER},
      split_super = #{splitSuper,jdbcType=INTEGER},
      split_status = #{splitStatus,jdbcType=INTEGER},
      split_id = #{splitId,jdbcType=INTEGER},
      split_aid = #{splitAid,jdbcType=VARCHAR},
      split_time = #{splitTime,jdbcType=TIMESTAMP},
      cname = #{cname,jdbcType=VARCHAR},
      receiver_name = #{receiverName,jdbcType=VARCHAR},
      declaration_batch = #{declarationBatch,jdbcType=INTEGER},
      attachment_url = #{attachmentUrl,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderTask">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 09 09:38:55 CST 2020.
    -->
    update t_order_task
    set order_no = #{orderNo,jdbcType=VARCHAR},
      main = #{main,jdbcType=INTEGER},
      super_id = #{superId,jdbcType=VARCHAR},
      commodity_id = #{commodityId,jdbcType=VARCHAR},
      commodity_name = #{commodityName,jdbcType=VARCHAR},
      commodity_quantity = #{commodityQuantity,jdbcType=INTEGER},
      commodity_mode = #{commodityMode,jdbcType=VARCHAR},
      commodity_price = #{commodityPrice,jdbcType=DECIMAL},
      task_status = #{taskStatus,jdbcType=INTEGER},
      task_distribution_time = #{taskDistributionTime,jdbcType=TIMESTAMP},
      task_allocator = #{taskAllocator,jdbcType=VARCHAR},
      task_receiver = #{taskReceiver,jdbcType=VARCHAR},
      task_comment = #{taskComment,jdbcType=VARCHAR},
      task_start_time = #{taskStartTime,jdbcType=TIMESTAMP},
      task_end_time = #{taskEndTime,jdbcType=TIMESTAMP},
      project_status = #{projectStatus,jdbcType=INTEGER},
      accept_time = #{acceptTime,jdbcType=DATE},
      review_time = #{reviewTime,jdbcType=DATE},
      publicity_time = #{publicityTime,jdbcType=DATE},
      licence_time = #{licenceTime,jdbcType=DATE},
      certificate_number = #{certificateNumber,jdbcType=VARCHAR},
      status = #{status,jdbcType=INTEGER},
      form_retrieve = #{formRetrieve,jdbcType=INTEGER},
      task_refund = #{taskRefund,jdbcType=INTEGER},
      refund_content = #{refundContent,jdbcType=VARCHAR},
      retrieve_content = #{retrieveContent,jdbcType=VARCHAR},
      declare_user = #{declareUser,jdbcType=VARCHAR},
      declare_pwd = #{declarePwd,jdbcType=VARCHAR},
      set_up_amount = #{setUpAmount,jdbcType=DECIMAL},
      arrival_money = #{arrivalMoney,jdbcType=INTEGER},
      outsource_name = #{outsourceName,jdbcType=VARCHAR},
      outsource_price = #{outsourcePrice,jdbcType=DECIMAL},
      consultant_id = #{consultantId,jdbcType=VARCHAR},
      manager_id = #{managerId,jdbcType=VARCHAR},
      outsource = #{outsource,jdbcType=INTEGER},
      split_super = #{splitSuper,jdbcType=INTEGER},
      split_status = #{splitStatus,jdbcType=INTEGER},
      split_id = #{splitId,jdbcType=INTEGER},
      split_aid = #{splitAid,jdbcType=VARCHAR},
      split_time = #{splitTime,jdbcType=TIMESTAMP},
      cname = #{cname,jdbcType=VARCHAR},
      receiver_name = #{receiverName,jdbcType=VARCHAR},
      declaration_batch = #{declarationBatch,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <!-- 记得返回id -->
  <!-- &amp;amp;lt;insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderTask" useGeneratedKeys="true"&amp;amp;gt;
  		&amp;amp;lt;selectKey keyProperty="id" order="AFTER" resultType="int"&amp;amp;gt;
        SELECT LAST_INSERT_ID()
    &amp;amp;lt;/selectKey&amp;amp;gt; -->
  <insert id="insertSelectiveGetId" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderTask" useGeneratedKeys="true">
    insert into t_order_task
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="orderNo != null">
        order_no,
      </if>
      <if test="main != null">
        main,
      </if>
      <if test="superId != null">
        super_id,
      </if>
      <if test="commodityId != null">
        commodity_id,
      </if>
      <if test="commodityName != null">
        commodity_name,
      </if>
      <if test="commodityQuantity != null">
        commodity_quantity,
      </if>
      <if test="commodityMode != null">
        commodity_mode,
      </if>
      <if test="commodityPrice != null">
        commodity_price,
      </if>
      <if test="taskStatus != null">
        task_status,
      </if>
      <if test="taskDistributionTime != null">
        task_distribution_time,
      </if>
      <if test="taskAllocator != null">
        task_allocator,
      </if>
      <if test="taskReceiver != null">
        task_receiver,
      </if>
      <if test="taskComment != null">
        task_comment,
      </if>
      <if test="taskStartTime != null">
        task_start_time,
      </if>
      <if test="taskEndTime != null">
        task_end_time,
      </if>
      <if test="projectStatus != null">
        project_status,
      </if>
      <if test="acceptTime != null">
        accept_time,
      </if>
      <if test="reviewTime != null">
        review_time,
      </if>
      <if test="publicityTime != null">
        publicity_time,
      </if>
      <if test="licenceTime != null">
        licence_time,
      </if>
      <if test="certificateNumber != null">
        certificate_number,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="formRetrieve != null">
        form_retrieve,
      </if>
      <if test="taskRefund != null">
        task_refund,
      </if>
      <if test="refundContent != null">
        refund_content,
      </if>
      <if test="retrieveContent != null">
        retrieve_content,
      </if>
      <if test="declareUser != null">
        declare_user,
      </if>
      <if test="declarePwd != null">
        declare_pwd,
      </if>
      <if test="setUpAmount != null">
        set_up_amount,
      </if>
      <if test="arrivalMoney != null">
        arrival_money,
      </if>
      <if test="outsourceName != null">
        outsource_name,
      </if>
      <if test="outsourcePrice != null">
        outsource_price,
      </if>
      <if test="consultantId != null">
        consultant_id,
      </if>
      <if test="managerId != null">
        manager_id,
      </if>
      <if test="outsource != null">
        outsource,
      </if>
      <if test="splitSuper != null">
        split_super,
      </if>
      <if test="splitStatus != null">
        split_status,
      </if>
      <if test="splitId != null">
        split_id,
      </if>
      <if test="splitAid != null">
        split_aid,
      </if>
      <if test="splitTime != null">
        split_time,
      </if>
      <if test="cname != null">
        cname,
      </if>
      <if test="receiverName != null">
        receiver_name,
      </if>
      <if test="attachmentUrl != null">
        attachment_url,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="orderNo != null">
        #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="main != null">
        #{main,jdbcType=INTEGER},
      </if>
      <if test="superId != null">
        #{superId,jdbcType=VARCHAR},
      </if>
      <if test="commodityId != null">
        #{commodityId,jdbcType=VARCHAR},
      </if>
      <if test="commodityName != null">
        #{commodityName,jdbcType=VARCHAR},
      </if>
      <if test="commodityQuantity != null">
        #{commodityQuantity,jdbcType=INTEGER},
      </if>
      <if test="commodityMode != null">
        #{commodityMode,jdbcType=VARCHAR},
      </if>
      <if test="commodityPrice != null">
        #{commodityPrice,jdbcType=DECIMAL},
      </if>
      <if test="taskStatus != null">
        #{taskStatus,jdbcType=INTEGER},
      </if>
      <if test="taskDistributionTime != null">
        #{taskDistributionTime,jdbcType=TIMESTAMP},
      </if>
      <if test="taskAllocator != null">
        #{taskAllocator,jdbcType=VARCHAR},
      </if>
      <if test="taskReceiver != null">
        #{taskReceiver,jdbcType=VARCHAR},
      </if>
      <if test="taskComment != null">
        #{taskComment,jdbcType=VARCHAR},
      </if>
      <if test="taskStartTime != null">
        #{taskStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="taskEndTime != null">
        #{taskEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="projectStatus != null">
        #{projectStatus,jdbcType=INTEGER},
      </if>
      <if test="acceptTime != null">
        #{acceptTime,jdbcType=DATE},
      </if>
      <if test="reviewTime != null">
        #{reviewTime,jdbcType=DATE},
      </if>
      <if test="publicityTime != null">
        #{publicityTime,jdbcType=DATE},
      </if>
      <if test="licenceTime != null">
        #{licenceTime,jdbcType=DATE},
      </if>
      <if test="certificateNumber != null">
        #{certificateNumber,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="formRetrieve != null">
        #{formRetrieve,jdbcType=INTEGER},
      </if>
      <if test="taskRefund != null">
        #{taskRefund,jdbcType=INTEGER},
      </if>
      <if test="refundContent != null">
        #{refundContent,jdbcType=VARCHAR},
      </if>
      <if test="retrieveContent != null">
        #{retrieveContent,jdbcType=VARCHAR},
      </if>
      <if test="declareUser != null">
        #{declareUser,jdbcType=VARCHAR},
      </if>
      <if test="declarePwd != null">
        #{declarePwd,jdbcType=VARCHAR},
      </if>
      <if test="setUpAmount != null">
        #{setUpAmount,jdbcType=DECIMAL},
      </if>
      <if test="arrivalMoney != null">
        #{arrivalMoney,jdbcType=INTEGER},
      </if>
      <if test="outsourceName != null">
        #{outsourceName,jdbcType=VARCHAR},
      </if>
      <if test="outsourcePrice != null">
        #{outsourcePrice,jdbcType=DECIMAL},
      </if>
      <if test="consultantId != null">
        #{consultantId,jdbcType=VARCHAR},
      </if>
      <if test="managerId != null">
        #{managerId,jdbcType=VARCHAR},
      </if>
      <if test="outsource != null">
        #{outsource,jdbcType=INTEGER},
      </if>
      <if test="splitSuper != null">
        #{splitSuper,jdbcType=INTEGER},
      </if>
      <if test="splitStatus != null">
        #{splitStatus,jdbcType=INTEGER},
      </if>
      <if test="splitId != null">
        #{splitId,jdbcType=INTEGER},
      </if>
      <if test="splitAid != null">
        #{splitAid,jdbcType=VARCHAR},
      </if>
      <if test="splitTime != null">
        #{splitTime,jdbcType=TIMESTAMP},
      </if>
      <if test="cname != null">
        #{cname,jdbcType=VARCHAR},
      </if>
      <if test="receiverName != null">
        #{receiverName,jdbcType=VARCHAR},
      </if>
      <if test="attachmentUrl != null">
        #{attachmentUrl,jdbcType=LONGVARCHAR},
      </if>
    </trim>
    <selectKey keyProperty="id" order="AFTER" resultType="int">
        SELECT LAST_INSERT_ID()
    </selectKey>
  </insert>
  <select id="selectOrderTask" resultType="com.goafanti.order.bo.TOrderTaskBo">
        select a.id,e.contract_no contractNo,a.order_no as orderNo,h.nickname userName,f.name salesmanName,a.outsource_name outsourceName,a.outsource,
  a.outsource_price outsourcePrice,g.name depName,e.order_status orderStatus,d.name as contacts,d.contact_mobile as contactsMobile,a.main, c.cname,
  c.sort cSort,a.commodity_name as commodityName,a.commodity_quantity as commodityQuantity,i.price,a.certificate_number as certificateNumber,
  a.commodity_id as commodityId,a.manager_id managerId,a.consultant_id consultantId,a.project_status as projectStatus,a.set_up_amount setUpAmount,
  a.task_comment as taskComment ,a.commodity_price as commodityPrice, a.task_status as taskStatus,  a.task_receiver as taskReceiver ,a.split_status splitStatus
  	 from t_order_task a left join business_project b on a.commodity_id=b.id left join t_order_new e on a.order_no=e.order_no
  	 left join admin f on e.salesman_id=f.id left join department g on e.order_dep=g.id left join user h on e.buyer_id=h.id
  	 left join business_project i on a.commodity_id=i.id left join business_category c on b.cid=c.id left join admin d on a.task_receiver=d.id
  	where a.super_id is null and a.split_status !=2 and  a.order_no= #{orderNo,jdbcType=VARCHAR} order by a.id
  </select>
  
  <select id="selectOrderTaskAll" resultType="com.goafanti.order.bo.TOrderTaskBo">
      	select a.id,e.contract_no contractNo,a.order_no as orderNo,h.nickname userName,f.name salesmanName,a.outsource_name outsourceName,a.outsource,
	  a.outsource_price outsourcePrice,g.name depName,e.order_status orderStatus,d.name as contacts,d.contact_mobile as contactsMobile,a.main, c.cname,
	  c.sort cSort,a.commodity_name as commodityName,a.commodity_quantity as commodityQuantity,i.price,a.certificate_number as certificateNumber,a.receiver_name receiverName,
	  a.commodity_id as commodityId,a.manager_id managerId,a.consultant_id consultantId,a.project_status as projectStatus,a.set_up_amount setUpAmount,
	  a.task_comment as taskComment ,a.commodity_price as commodityPrice, a.task_status as taskStatus,  a.task_receiver as taskReceiver ,
	  a.split_status splitStatus,a.split_super splitSuper,a.split_aid splitAid,a.split_time splitTime
	from t_order_task a left join business_project b on a.commodity_id=b.id left join t_order_new e on a.order_no=e.order_no
  	left join admin f on e.salesman_id=f.id left join department g on e.order_dep=g.id left join user h on e.buyer_id=h.id
  	left join business_project i on a.commodity_id=i.id left join business_category c on b.cid=c.id left join admin d on a.task_receiver=d.id
  	where a.super_id is null  and  a.order_no= #{orderNo,jdbcType=VARCHAR} order by a.id
  </select>
  
  
   <select id="selectOrderTaskListByPage" resultType="com.goafanti.order.bo.TOrderTaskListBo">
  	select  a.id,a.commodity_name as taskName,a.order_no as orderNo,c.cname,a.receiver_name receiverName,a.project_status as projectStatus,e.contract_no contractNo,
a.task_receiver taskReceiver,a.task_status as taskStatus,date_format(a.task_distribution_time,'%Y-%m-%d') as taskDate, a.commodity_quantity as commodityQuantity,
e.approval,l.refund_status outsourceStatus,ifnull(i.alreadyNumber,0) as alreadyNumber,f.nickname as userName,h.name as depName, l.company_name as outsourceName ,
ifnull(k.hours,0) hours,a.split_status splitStatus,a.split_super splitSuper, a.split_id splitId
    from t_order_task a left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id 
  	left join t_order_new e on a.order_no=e.order_no left join user f on e.buyer_id=f.id
    left join department h on e.order_dep=h.id left join (select task_id , sum(already_number) as alreadyNumber from task_progress 
    group by task_id) i on a.id=i.task_id left join task_hours_count k on a.id=k.tid and a.task_receiver=k.aid left join t_order_outsource l
    on a.id=l.tid where  e.delete_sign in (0,2,3)  and e.order_status in (2,4) 
    and a.outsource= #{outsource,jdbcType=INTEGER}
    <if test="role == 0 ">
    and a.task_receiver= #{aid,jdbcType=VARCHAR}
    </if>
    <if test="role ==1 and fids != null and fids.size() &gt; 0">
	  	and e.finance_id in 
	   <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
       		#{item}
     	</foreach>
	</if>
    <if test="specially == 0 ">
    and a.split_status in (0,2) 
    </if>
    <if test="specially == 1 ">
    and a.split_status in (0,1) 
    </if>
    <if test="orderNo != null">
  	and a.order_no= #{orderNo,jdbcType=VARCHAR}
  	</if>
  	<if test="approval ==0">
  	and e.approval = 0
  	</if>
  	<if test="approval ==1">
  	and e.approval = 1
  	</if>
  	<if test="approval ==2">
  	and e.approval &gt; 1
  	</if>
  	<if test="outsourceStatus !=null">
  	and l.refund_status = #{outsourceStatus,jdbcType=INTEGER}
  	</if> 
  	<if test="contractNo != null">
  	and e.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="projectStatus != null">
  	and e.project_status = #{projectStatus,jdbcType=INTEGER}
  	</if>
  	<if test="depId != null">
  	and e.order_dep= #{depId,jdbcType=VARCHAR}
  	</if>
    <if test="name != null">
  	and f.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="orderNo != null">
  	and a.order_no= #{orderNo,jdbcType=VARCHAR}
  	</if>
  	<if test="taskId != null">
  	and (a.id= #{taskId,jdbcType=VARCHAR} or a.split_super= #{taskId,jdbcType=VARCHAR}) 
  	</if>
  	<if test="taskStatus != null">
  	and a.task_status= #{taskStatus,jdbcType=INTEGER}
  	</if>
  	<if test="adminName != null">
  	and a.receiver_name like CONCAT('%', #{adminName,jdbcType=VARCHAR},'%')
  	</if>
  	order by a.task_distribution_time desc
  	<if test="page_sql!=null">
			${page_sql}
	</if>
  </select>
  
   <select id="selectOrderTaskListCount" resultType="java.lang.Integer">
  	select  count(*) from t_order_task a  left join t_order_new e on a.order_no=e.order_no
    left join admin g on e.salesman_id=g.id left join department h on g.department_id=h.id where e.delete_sign in (0,2,3)  and e.order_status in (2,4) 
    and a.outsource= #{outsource,jdbcType=INTEGER}
   <if test="role == 0 ">
    and a.task_receiver= #{aid,jdbcType=VARCHAR}
    </if>
    <if test="role ==1 and fids != null and fids.size() &gt; 0">
	  	and e.finance_id in 
	   <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
       		#{item}
     	</foreach>
	</if>
    <if test="specially == 0 ">
    and a.split_status in (0,2) 
    </if>
    <if test="specially == 1 ">
    and a.split_status in (0,1) 
    </if>
    <if test="orderNo != null">
  	and a.order_no= #{orderNo,jdbcType=VARCHAR}
  	</if>
  	<if test="approval ==0">
  	and e.approval = 0
  	</if>
  	<if test="approval ==1">
  	and e.approval = 1
  	</if>
  	<if test="approval ==2">
  	and e.approval &gt; 1
  	</if> 
  	<if test="outsourceStatus !=null">
  	and l.refund_status = #{outsourceStatus,jdbcType=INTEGER}
  	</if> 
  	<if test="contractNo != null">
  	and e.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="projectStatus != null">
  	and e.project_status = #{projectStatus,jdbcType=INTEGER}
  	</if>
  	<if test="depId != null">
  	and e.order_dep = #{depId,jdbcType=VARCHAR}
  	</if>
    <if test="name != null">
  	and f.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="orderNo != null">
  	and a.order_no= #{orderNo,jdbcType=VARCHAR}
  	</if>
  	<if test="taskId != null">
  	and (a.id= #{taskId,jdbcType=VARCHAR} or a.split_super= #{taskId,jdbcType=VARCHAR}) 
  	</if>
  	<if test="taskStatus != null">
  	and a.task_status= #{taskStatus,jdbcType=INTEGER}
  	</if>
  	<if test="adminName != null">
  	and a.receiver_name  like CONCAT('%', #{adminName,jdbcType=VARCHAR},'%')
  	</if>
  </select>
  <select id="getOrderTaskDetail" resultType="com.goafanti.order.bo.TOrderTaskDetailBo">
select  
	a.id,a.commodity_name as taskName,a.order_no as orderNo,c.cname,d.name as receiverName,a.task_comment as taskComment,a.project_status as projectStatus,
	a.task_status as taskStatus,e.contacts,a.attachment_url as attachmentUrl,a.outsource_name outsourceName, f.nickname as userName,a.set_up_amount as setUpAmount,
	g.name as salesmanName,date_format(a.task_start_time,'%Y-%m-%d') as startDate,a.retrieve_content as retrieveContent, a.arrival_money as arrivalMoney,
	a.certificate_number as certificateNumber, a.status,a.form_retrieve as formRetrieve, a.task_refund as taskRefund,a.task_receiver taskReceiver,
	a.refund_content as refundContent, a.declare_user as  declareUser, a.declare_pwd as declarePwd,e.contract_no as contractNo,e.contacts ,
	date_format(a.task_end_time,'%Y-%m-%d') as endDate,date_format(a.accept_time,'%Y-%m-%d') as acceptDate,h.name as depName,e.contact_mobile as contactMobile ,
	date_format(a.review_time,'%Y-%m-%d') as reviewDate,date_format(a.publicity_time,'%Y-%m-%d') as publicityDate,a.outsource_price outsourcePrice,
	date_format(a.licence_time,'%Y-%m-%d') as licenceDate,date_format(a.task_distribution_time,'%Y-%m-%d') as taskDate,e.legal_person as legalPerson,
	e.legal_person_tel as legalPersonTel, a.split_status splitStatus, a.split_super splitSuper, a.split_id splitId,a.declaration_batch declarationBatch
	from t_order_task a left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id
    left join admin d on a.task_receiver=d.id left join t_order_new e on a.order_no=e.order_no
    left join department h on e.order_dep=h.id left join user f on e.buyer_id=f.id
    left join admin g on e.salesman_id=g.id
    where a.id= #{id,jdbcType=VARCHAR}
  </select>
  <select id="selectBySuperId" resultType="com.goafanti.common.model.TOrderTask">
     select super_id as superId,min(task_status) as taskStatus,min(project_status) as projectStatus,max(main) as main  from t_order_task
    where super_id = #{superId,jdbcType=VARCHAR} group by super_id
  </select>
  
   <select id="selectTaskHoursListByPage" resultType="com.goafanti.order.bo.TOrderTaskListBo">
  	   select  a.id,a.commodity_name as taskName,a.order_no as orderNo,c.cname,a.receiver_name as receiverName,dep.name as depName,a.project_status projectStatus,
    a.task_status as taskStatus,f.nickname as userName,ifnull(g.hours,0) as hours,a.commodity_quantity as commodityQuantity,a.commodity_price commodityPrice,
    e.contract_no as contractNo,date_format(e.create_time,'%Y-%m-%d %H:%i:%S')as creteTime,date_format(e.sign_time,'%Y-%m-%d')as signTime,a.outsource,
    date_format(a.task_distribution_time,'%Y-%m-%d %H:%i:%S')taskDistributionTime, date_format(a.task_end_time,'%Y-%m-%d')taskEndTime,tm.salesman_name salesmanName,
    a.split_status splitStatus, a.split_super splitSuper, a.split_id splitId
  	from t_order_task a left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id
    left join t_order_new e on a.order_no=e.order_no left join department dep on e.order_dep=dep.id  
    left join user f on e.buyer_id=f.id left join (select tid,sum(hours)hours from task_hours_count group by tid) g on a.id=g.tid
    left join t_order_mid tm on a.order_no=tm.order_no where e.delete_sign =0 and a.super_id is null and a.split_status in(0,2)
  	<if test="shiroType == 1 and aid !=null">
  	  	and tm.finance_id= #{aid,jdbcType=VARCHAR}
  	</if>
  	<if test="shiroType == 2 and aid !=null">
  	  	and tm.finance_id in (select id from admin where superior_id= #{aid,jdbcType=VARCHAR})
  	</if>
    <if test="name != null">
  	and f.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="cid != null">
  	and b.cid = #{cid,jdbcType=VARCHAR}
  	</if>
  	<if test="outsource != null">
  	and a.outsource = #{outsource,jdbcType=INTEGER}
  	</if>
  	<if test="depId != null">
  	and e.order_dep = #{depId,jdbcType=VARCHAR}
  	</if>
  	<if test="contractNo != null">
  	and e.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="orderNo != null">
  	and e.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="taskId != null">
  	and a.id= #{taskId,jdbcType=VARCHAR}
  	</if>
  	<if test="starTime !=null and endTime !=null">
  	and  e.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  	</if>
  	order by  a.task_start_time desc,e.create_time desc
  	<if test="page_sql!=null">
			${page_sql}
	</if>
  </select>
  
   <select id="selectTaskHoursListCount" resultType="java.lang.Integer">
  	select count(*) from t_order_task a left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id 
    left join t_order_new e on a.order_no=e.order_no left join user f on e.buyer_id=f.id left join t_order_mid tm on a.order_no=tm.order_no
    where e.delete_sign =0 and a.super_id is null and a.split_status in(0,2) 
  <if test="shiroType == 1 and aid !=null">
  	  	and tm.finance_id= #{aid,jdbcType=VARCHAR}
  	</if>
  	<if test="shiroType == 2 and aid !=null">
  	  	and tm.finance_id in (select id from admin where superior_id= #{aid,jdbcType=VARCHAR})
  	</if>
    <if test="name != null">
  	and f.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="outsource != null">
  	and a.outsource = #{outsource,jdbcType=INTEGER}
  	</if>
  	<if test="cid != null">
  	and b.cid = #{cid,jdbcType=VARCHAR}
  	</if>
  	<if test="depId != null">
  	and e.order_dep = #{depId,jdbcType=VARCHAR}
  	</if>
  	<if test="contractNo != null">
  	and e.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="orderNo != null">
  	and e.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="taskId != null">
  	and a.id= #{taskId,jdbcType=VARCHAR}
  	</if>
  	<if test="starTime !=null and endTime !=null">
  	and  e.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  	</if>
  </select>
  
   <select id="selectTaskListByPage" resultType="com.goafanti.order.bo.TOrderTaskListBo">
 	select  a.id,a.commodity_name as taskName,a.order_no as orderNo,c.cname,d.name as receiverName,
    a.project_status as projectStatus,a.task_status as taskStatus,date_format(a.task_distribution_time,'%Y-%m-%d') as taskDate,
    a.commodity_quantity as commodityQuantity,f.nickname as userName,h.name as depName,ifnull(i.alreadyNumber,0)as alreadyNumber,
    a.split_status splitStatus,a.split_super splitSuper, a.split_id splitId
    from (select task_id from t_task_log a where task_receiver=#{aid ,jdbcType=VARCHAR} UNION select task_id from t_task_log a 
    where task_allocator=#{aid ,jdbcType=VARCHAR}) x left join  t_order_task a on x.task_id=a.id 
  	left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id
	left join admin d on a.task_receiver=d.id left join t_order_new e on a.order_no=e.order_no
    left join user f on e.buyer_id=f.id left join department h on e.order_dep=h.id
    left join (select task_id , sum(already_number) as alreadyNumber from task_progress group by task_id) i on a.id=i.task_id
    where e.delete_sign !=1 
    <if test="orderNo != null">
  	and a.order_no= #{orderNo,jdbcType=VARCHAR}
  	</if>
    <if test="name != null">
  	and f.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="orderNo != null">
  	and a.order_no= #{orderNo,jdbcType=VARCHAR}
  	</if>
  	<if test="depId != null">
  	and e.order_dep= #{depId ,jdbcType=VARCHAR}
  	</if>
  	<if test="taskId != null">
  	and (a.id= #{taskId,jdbcType=VARCHAR} or a.split_super= #{taskId,jdbcType=VARCHAR})
  	</if>
  	<if test="taskStatus != null">
  	and a.task_status= #{taskStatus,jdbcType=INTEGER}
  	</if>
  	<if test="adminName != null">
  	and d.name like CONCAT('%', #{adminName,jdbcType=VARCHAR},'%')
  	</if>
  	order by a.task_distribution_time desc
  	<if test="page_sql!=null">
			${page_sql}
	</if>
  </select>
  
   <select id="selectTaskListCount" resultType="java.lang.Integer">
  	select  count(*)
    from (select task_id from t_task_log a where task_receiver=#{aid ,jdbcType=VARCHAR} UNION select task_id from t_task_log a 
    where task_allocator=#{aid ,jdbcType=VARCHAR}) x left join  t_order_task a on x.task_id=a.id 
  	left join business_project b on a.commodity_id=b.id
  	left join business_category c on b.cid=c.id
    left join admin d on a.task_receiver=d.id
    left join t_order_new e on a.order_no=e.order_no
    left join user f on e.buyer_id=f.id
    left join department h on e.order_dep=h.id
    left join (select task_id , sum(already_number) as alreadyNumber from task_progress group by task_id) i on a.id=i.task_id
    where e.delete_sign !=1 
    <if test="orderNo != null">
  	and a.order_no= #{orderNo,jdbcType=VARCHAR}
  	</if>
    <if test="name != null">
  	and f.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  	</if>
  	<if test="depId != null">
  	and e.order_dep= #{depId ,jdbcType=VARCHAR}
  	</if>
  	<if test="orderNo != null">
  	and a.order_no= #{orderNo,jdbcType=VARCHAR}
  	</if>
  	<if test="taskId != null">
  	and (a.id= #{taskId,jdbcType=VARCHAR} or a.split_super= #{taskId,jdbcType=VARCHAR})
  	</if>
  	<if test="taskStatus != null">
  	and a.task_status= #{taskStatus,jdbcType=INTEGER}
  	</if>
  	<if test="adminName != null">
  	and d.name like CONCAT('%', #{adminName,jdbcType=VARCHAR},'%')
  	</if>
  </select>
  	<!-- 根据订单编号获得所有的任务负责人 -->
  	<select id="getReceiverByOid" parameterType="java.lang.String" resultMap="BaseResultMap">
  	select distinct task_receiver, a.name, a.email, t.id, t.project_status from t_order_task t
	inner join admin a on t.task_receiver = a.id
	where order_no = #{orderNo,jdbcType=VARCHAR} and task_status &gt; 0 and super_id is null
  	</select>
  	<update id="updateDimissionTransfer" parameterType="java.lang.String">
    update t_order_task set task_allocator= #{aid,jdbcType=VARCHAR},task_receiver= #{transferId,jdbcType=VARCHAR}
    <if test="type==0">
    ,consultant_id=#{transferId,jdbcType=VARCHAR}
    </if>
    <if test="type==1">
    ,manager_id=#{transferId,jdbcType=VARCHAR}
    </if>
	where task_receiver=#{aid,jdbcType=VARCHAR}
  </update>
  
  <select id="selectEstimateCost" resultType="java.lang.String">
  	select ifnull(sum(a.commodity_quantity * ifnull(b.price,0)),0)   from t_order_task a
	left join business_project b on a.commodity_id=b.id
	where order_no= #{orderNo}
  </select>
  
  <select id="listNameByDepAndName" resultType="java.lang.String">
	select
	<if test="type ==0">
	consultant_id 
	</if> 
	<if test="type ==1">
	manager_id 
	</if> 
	from t_order_task
		where order_no= #{orderNo}
		group by 
	<if test="type ==0">
	consultant_id 
	</if> 
	<if test="type ==1">
	manager_id 
	</if> 
  </select>
  
  <select id="splitProjectList" resultType="com.goafanti.order.bo.TOrderTaskListBo">
     select  a.id,a.commodity_name as taskName,a.order_no as orderNo,c.cname,d.name as receiverName,a.project_status as projectStatus,e.contract_no contractNo,a.task_receiver taskReceiver,
    a.task_status as taskStatus,date_format(a.task_distribution_time,'%Y-%m-%d') as taskDate, a.commodity_quantity as commodityQuantity,e.approval,l.refund_status outsourceStatus,
    ifnull(i.alreadyNumber,0) as alreadyNumber,f.nickname as userName,h.name as depName, j.name as outsourceName ,ifnull(k.hours,0) hours,a.split_status splitStatus,
    a.split_super splitSuper,date_format(a.split_time,'%Y-%m-%d %H:%i:%S') splitTimes,ad.name splitAname,a.split_id splitId
    from t_order_task a left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id 
  	left join admin d on a.task_receiver=d.id left join t_order_new e on a.order_no=e.order_no left join user f on e.buyer_id=f.id
    left join department h on e.order_dep=h.id left join (select task_id , sum(already_number) as alreadyNumber from task_progress 
    group by task_id) i on a.id=i.task_id  left join (select order_no,max(name)as name from outsource_organization group by order_no) j 
    on a.order_no=j.order_no left join task_hours_count k on a.id=k.tid and a.task_receiver=k.aid left join t_order_outsource l
    on a.id=l.tid left join admin ad on ad.id=a.split_aid where  e.order_status not in (5,7)  
    and split_status =2 and a.split_super= #{tid} order by split_id
  </select>
    <select id="selectByidGetCname" resultType="java.lang.String">
   select b.cname from business_project a left join business_category b on a.cid =b.id
  	where a.id= #{pid}
  </select>
  <update id="updateByOutsourceToOrderNo">
  	update t_order_task set outsource= #{type} where order_no= #{orderNo}
  </update>
</mapper>