|  | @@ -14,7 +14,11 @@
 | 
	
		
			
				|  |  |      <result column="approval_details" property="approvalDetails" jdbcType="VARCHAR" />
 | 
	
		
			
				|  |  |      <result column="approval_remark" property="approvalRemark" jdbcType="VARCHAR" />
 | 
	
		
			
				|  |  |      <result column="approval_create_time" property="approvalCreateTime" jdbcType="TIMESTAMP" />
 | 
	
		
			
				|  |  | +    <collection property="approvalProduction" column="approval_id" ofType="ApprovalProduction" select="getApprovalProduction"/>
 | 
	
		
			
				|  |  | +    <collection property="approvalApplyPick" column="approval_id" ofType="ApprovalApplyPick" select="getApplyPick"/>
 | 
	
		
			
				|  |  | +    <collection property="listProductionContract" column="approval_id" ofType="ApprovalProductionContract" select="listProductionContract"/>
 | 
	
		
			
				|  |  |    </resultMap>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    <resultMap id="ApprovalProductionResultMap" type="ApprovalProduction" >
 | 
	
		
			
				|  |  |      <id column="production_id" property="productionId" jdbcType="INTEGER" />
 | 
	
		
			
				|  |  |      <result column="approval_id" property="approvalId" jdbcType="VARCHAR" />
 | 
	
	
		
			
				|  | @@ -33,6 +37,21 @@
 | 
	
		
			
				|  |  |      <result column="production_remark" property="productionRemark" jdbcType="VARCHAR" />
 | 
	
		
			
				|  |  |      <result column="production_create_time" property="productionCreateTime" jdbcType="TIMESTAMP" />
 | 
	
		
			
				|  |  |      <result column="production_update_time" property="productionUpdateTime" jdbcType="TIMESTAMP" />
 | 
	
		
			
				|  |  | +    <collection property="listProductionItem" column="production_id" ofType="ApprovalProductionItem" select="listProductionItem"/>
 | 
	
		
			
				|  |  | +  </resultMap>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  <resultMap id="ApprovalApplyPickMap" type="ApprovalApplyPick" >
 | 
	
		
			
				|  |  | +    <id column="apply_pick_id" property="applyPickId" jdbcType="INTEGER" />
 | 
	
		
			
				|  |  | +    <result column="approval_id" property="approvalId" jdbcType="INTEGER" />
 | 
	
		
			
				|  |  | +    <result column="admin_id" property="adminId" jdbcType="INTEGER" />
 | 
	
		
			
				|  |  | +    <result column="apply_pick_name" property="applyPickName" jdbcType="VARCHAR" />
 | 
	
		
			
				|  |  | +    <result column="apply_pick_tel" property="applyPickTel" jdbcType="VARCHAR" />
 | 
	
		
			
				|  |  | +    <result column="apply_pick_reason" property="applyPickReason" jdbcType="VARCHAR" />
 | 
	
		
			
				|  |  | +    <result column="apply_pick_struts" property="applyPickStruts" jdbcType="INTEGER" />
 | 
	
		
			
				|  |  | +    <result column="apply_pick_remk" property="applyPickRemk" jdbcType="VARCHAR" />
 | 
	
		
			
				|  |  | +    <result column="apply_pick_create_time" property="applyPickCreateTime" jdbcType="TIMESTAMP" />
 | 
	
		
			
				|  |  | +    <result column="apply_pick_update_time" property="applyPickUpdateTime" jdbcType="TIMESTAMP" />
 | 
	
		
			
				|  |  | +    <collection property="listApplyPickItem" column="apply_pick_id" ofType="ApprovalApplyPickItem" select="listApplyPickItem"/>
 | 
	
		
			
				|  |  |    </resultMap>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -54,8 +73,9 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    <resultMap id="ApprovalProductionContractMap" type="ApprovalProductionContract" >
 | 
	
		
			
				|  |  |      <id column="contract_id" property="contractId" jdbcType="INTEGER" />
 | 
	
		
			
				|  |  | -    <result column="production_id" property="productionId" jdbcType="INTEGER" />
 | 
	
		
			
				|  |  | +    <result column="approval_id" property="approvalId" jdbcType="INTEGER" />
 | 
	
		
			
				|  |  |      <result column="contract_url" property="contractUrl" jdbcType="VARCHAR" />
 | 
	
		
			
				|  |  | +    <result column="contract_name" property="contractName" jdbcType="VARCHAR" />
 | 
	
		
			
				|  |  |      <result column="contract_create_time" property="contractCreateTime" jdbcType="TIMESTAMP" />
 | 
	
		
			
				|  |  |    </resultMap>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -149,10 +169,11 @@
 | 
	
		
			
				|  |  |      contract_id
 | 
	
		
			
				|  |  |      production_id
 | 
	
		
			
				|  |  |      contract_url
 | 
	
		
			
				|  |  | +    contract_type
 | 
	
		
			
				|  |  |      contract_create_time
 | 
	
		
			
				|  |  |      )
 | 
	
		
			
				|  |  |      VALUES
 | 
	
		
			
				|  |  | -    (#{contractId},#{productionId},#{contractUrl},NOW())
 | 
	
		
			
				|  |  | +    (#{contractId},#{productionId},#{contractUrl},#{contractType},NOW())
 | 
	
		
			
				|  |  |    </insert>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    <insert id="insertProcessInfo" parameterType="ProcessInfo">
 | 
	
	
		
			
				|  | @@ -225,6 +246,219 @@
 | 
	
		
			
				|  |  |      </where>
 | 
	
		
			
				|  |  |    </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<!--查询审批信息列表-->
 | 
	
		
			
				|  |  | +  <select id="listApprovalInfo" parameterType="ApprovalInfo" resultMap="ApprovalInfoResultMap">
 | 
	
		
			
				|  |  | +    SELECT
 | 
	
		
			
				|  |  | +    ai.approval_id
 | 
	
		
			
				|  |  | +    ai.approval_name
 | 
	
		
			
				|  |  | +    ai.approval_type
 | 
	
		
			
				|  |  | +    ai.approval_status
 | 
	
		
			
				|  |  | +    ai.approval_status_details
 | 
	
		
			
				|  |  | +    ai.admin_id
 | 
	
		
			
				|  |  | +    ai.approval_applicant
 | 
	
		
			
				|  |  | +    ai.activiti_id
 | 
	
		
			
				|  |  | +    ai.approval_details
 | 
	
		
			
				|  |  | +    ai.approval_remark
 | 
	
		
			
				|  |  | +    ai.approval_create_time
 | 
	
		
			
				|  |  | +    from tb_rst_approval_info ai
 | 
	
		
			
				|  |  | +    LEFT JOIN  tb_rst_historical_record hr ON ai.approval_id = hr.approval_id
 | 
	
		
			
				|  |  | +    <where>
 | 
	
		
			
				|  |  | +      <if test="adminId != null and adminId != ''">
 | 
	
		
			
				|  |  | +        ai.admin_id = #{adminId}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +      <if test="approvalType != null and approvalType != ''">
 | 
	
		
			
				|  |  | +        ai.approval_type = #{approvalType}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +      <if test="approvalStatus != null and approvalStatus != ''">
 | 
	
		
			
				|  |  | +        ai.approval_status = #{approvalStatus}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +      <if test="adminId != null and adminId != ''">
 | 
	
		
			
				|  |  | +        hr.admin_id = #{adminId}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +    </where>
 | 
	
		
			
				|  |  | +  </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  <!--查询生产审批信息-->
 | 
	
		
			
				|  |  | +  <select id="getApprovalProduction" parameterType="Integer" resultMap="ApprovalProductionResultMap">
 | 
	
		
			
				|  |  | +    SELECT
 | 
	
		
			
				|  |  | +    ap.production_id,
 | 
	
		
			
				|  |  | +    ap.approval_id,
 | 
	
		
			
				|  |  | +    ap.applicant_order_no,
 | 
	
		
			
				|  |  | +    ap.applicant_name,
 | 
	
		
			
				|  |  | +    ap.applicant_id,
 | 
	
		
			
				|  |  | +    ap.order_name,
 | 
	
		
			
				|  |  | +    ap.company_name,
 | 
	
		
			
				|  |  | +    ap.contact_name,
 | 
	
		
			
				|  |  | +    ap.contact_tel,
 | 
	
		
			
				|  |  | +    ap.production_delivery_date,
 | 
	
		
			
				|  |  | +    ap.production_delivery_way,
 | 
	
		
			
				|  |  | +    ap.production_delivery_desc,
 | 
	
		
			
				|  |  | +    ap.production_state,
 | 
	
		
			
				|  |  | +    ap.production_packing_way,
 | 
	
		
			
				|  |  | +    ap.production_remark,
 | 
	
		
			
				|  |  | +    ap.production_create_time,
 | 
	
		
			
				|  |  | +    ap.production_update_time
 | 
	
		
			
				|  |  | +    from tb_rst_approval_production ap
 | 
	
		
			
				|  |  | +    where
 | 
	
		
			
				|  |  | +        ap.approval_id = #{approvalId}
 | 
	
		
			
				|  |  | +  </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  <!--查询提货申请信息-->
 | 
	
		
			
				|  |  | +  <select id="getApplyPick" parameterType="ApprovalApplyPick" resultMap="ApprovalApplyPickMap">
 | 
	
		
			
				|  |  | +    SELECT
 | 
	
		
			
				|  |  | +    aap.apply_pick_id,
 | 
	
		
			
				|  |  | +    aap.approval_id,
 | 
	
		
			
				|  |  | +    aap.admin_id,
 | 
	
		
			
				|  |  | +    aap.apply_pick_name,
 | 
	
		
			
				|  |  | +    aap.apply_pick_tel,
 | 
	
		
			
				|  |  | +    aap.apply_pick_reason,
 | 
	
		
			
				|  |  | +    aap.apply_pick_struts,
 | 
	
		
			
				|  |  | +    aap.apply_pick_remk,
 | 
	
		
			
				|  |  | +    aap.apply_pick_create_time,
 | 
	
		
			
				|  |  | +    aap.apply_pick_update_time
 | 
	
		
			
				|  |  | +    from tb_rst_approval_apply_pick aap
 | 
	
		
			
				|  |  | +    where
 | 
	
		
			
				|  |  | +        aap.approval_id = #{approvalId}
 | 
	
		
			
				|  |  | +  </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  <!--查询提货产品项信息-->
 | 
	
		
			
				|  |  | +  <select id="listProductionItem" parameterType="Integer" resultType="ApprovalProductionItem">
 | 
	
		
			
				|  |  | +    SELECT
 | 
	
		
			
				|  |  | +    api.item_id itemId,
 | 
	
		
			
				|  |  | +    api.production_id productionId,
 | 
	
		
			
				|  |  | +    api.product_id productId,
 | 
	
		
			
				|  |  | +    api.item_product_name itemProductName,
 | 
	
		
			
				|  |  | +    api.item_color_name itemColorName,
 | 
	
		
			
				|  |  | +    api.item_product_num itemProductNum,
 | 
	
		
			
				|  |  | +    api.item_brand_name itemBrandName,
 | 
	
		
			
				|  |  | +    api.item_product_model itemProductModel,
 | 
	
		
			
				|  |  | +    api.item_product_unit itemProductUnit,
 | 
	
		
			
				|  |  | +    api.item_product_box_number itemProductBoxNumber,
 | 
	
		
			
				|  |  | +    api.item_create_time itemCreateTime,
 | 
	
		
			
				|  |  | +    api.item_update_time itemUpdateTime
 | 
	
		
			
				|  |  | +    from tb_rst_approval_production_item api
 | 
	
		
			
				|  |  | +    where
 | 
	
		
			
				|  |  | +        api.production_id = #{productionId}
 | 
	
		
			
				|  |  | +  </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  <!--查询提货产品项信息-->
 | 
	
		
			
				|  |  | +  <select id="listApplyPickItem" parameterType="Integer" resultType="ApprovalApplyPickItem">
 | 
	
		
			
				|  |  | +    SELECT
 | 
	
		
			
				|  |  | +    aapi.apply_item_id applyItemId,
 | 
	
		
			
				|  |  | +    aapi.apply_pick_id applyPickId,
 | 
	
		
			
				|  |  | +    aapi.product_id productId,
 | 
	
		
			
				|  |  | +    aapi.item_product_name itemProductName,
 | 
	
		
			
				|  |  | +    aapi.item_color_name itemColorName,
 | 
	
		
			
				|  |  | +    aapi.item_product_num itemProductNum,
 | 
	
		
			
				|  |  | +    aapi.item_brand_name itemBrandName,
 | 
	
		
			
				|  |  | +    aapi.item_product_model itemProductModel,
 | 
	
		
			
				|  |  | +    aapi.item_product_unit itemProductUnit,
 | 
	
		
			
				|  |  | +    aapi.item_product_box_number itemProductBoxNumber,
 | 
	
		
			
				|  |  | +    aapi.item_create_time itemCreateTime,
 | 
	
		
			
				|  |  | +    aapi.item_update_time itemUpdateTime
 | 
	
		
			
				|  |  | +    from tb_rst_approval_apply_pick_item aapi
 | 
	
		
			
				|  |  | +    where
 | 
	
		
			
				|  |  | +        aapi.apply_pick_id = #{applyPickId}
 | 
	
		
			
				|  |  | +  </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  <!--查询审批合同信息-->
 | 
	
		
			
				|  |  | +  <select id="listProductionContract" parameterType="Integer" resultType="ApprovalProductionContract">
 | 
	
		
			
				|  |  | +    SELECT
 | 
	
		
			
				|  |  | +    apc.contract_id contractId,
 | 
	
		
			
				|  |  | +    apc.approval_id approvalId,
 | 
	
		
			
				|  |  | +    apc.contract_url contractUrl,
 | 
	
		
			
				|  |  | +    apc.contract_name contractName,
 | 
	
		
			
				|  |  | +    apc.contract_create_time contractCreateTime
 | 
	
		
			
				|  |  | +    from tb_rst_approval_production_contract apc
 | 
	
		
			
				|  |  | +    where
 | 
	
		
			
				|  |  | +        apc.approval_id = #{approvalId}
 | 
	
		
			
				|  |  | +  </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  <select id="getHistoricalRecord" parameterType="HistoricalRecord" resultType="HistoricalRecord">
 | 
	
		
			
				|  |  | +    SELECT
 | 
	
		
			
				|  |  | +    hr.record_id recordId,
 | 
	
		
			
				|  |  | +    hr.approval_id approvalId,
 | 
	
		
			
				|  |  | +    hr.admin_id adminId,
 | 
	
		
			
				|  |  | +    hr.record_state recordState,
 | 
	
		
			
				|  |  | +    hr.task_id taskId,
 | 
	
		
			
				|  |  | +    hr.approval_time approvalTime,
 | 
	
		
			
				|  |  | +    hr.record_create_time recordCreateTime
 | 
	
		
			
				|  |  | +    from tb_rst_historical_record hr
 | 
	
		
			
				|  |  | +    <where>
 | 
	
		
			
				|  |  | +      <if test="adminId != null and adminId != ''">
 | 
	
		
			
				|  |  | +        hr.admin_id = #{adminId}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +      <if test="approvalId != null and approvalId != ''">
 | 
	
		
			
				|  |  | +        hr.approval_id = #{approvalId}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +    </where>
 | 
	
		
			
				|  |  | +  </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  <select id="getHistoricalRecord" parameterType="HistoricalRecord" resultType="HistoricalRecord">
 | 
	
		
			
				|  |  | +    SELECT
 | 
	
		
			
				|  |  | +    hr.record_id recordId,
 | 
	
		
			
				|  |  | +    hr.approval_id approvalId,
 | 
	
		
			
				|  |  | +    hr.admin_id adminId,
 | 
	
		
			
				|  |  | +    hr.record_state recordState,
 | 
	
		
			
				|  |  | +    hr.task_id taskId,
 | 
	
		
			
				|  |  | +    hr.approval_time approvalTime,
 | 
	
		
			
				|  |  | +    hr.record_create_time recordCreateTime
 | 
	
		
			
				|  |  | +    from tb_rst_historical_record hr
 | 
	
		
			
				|  |  | +    <where>
 | 
	
		
			
				|  |  | +      <if test="adminId != null and adminId != ''">
 | 
	
		
			
				|  |  | +        hr.admin_id = #{adminId}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +      <if test="approvalId != null and approvalId != ''">
 | 
	
		
			
				|  |  | +        hr.approval_id = #{approvalId}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +    </where>
 | 
	
		
			
				|  |  | +  </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  <select id="listProcessInfo" parameterType="ProcessInfo" resultType="ProcessInfo">
 | 
	
		
			
				|  |  | +    SELECT
 | 
	
		
			
				|  |  | +    process_id processId,
 | 
	
		
			
				|  |  | +    approval_id approvalId,
 | 
	
		
			
				|  |  | +    admin_id adminId,
 | 
	
		
			
				|  |  | +    process_desc processDesc,
 | 
	
		
			
				|  |  | +    process_state processState,
 | 
	
		
			
				|  |  | +    process_create_time processCreateTime
 | 
	
		
			
				|  |  | +    from tb_rst_process_info
 | 
	
		
			
				|  |  | +    <where>
 | 
	
		
			
				|  |  | +      <if test="approvalId != null and approvalId != ''">
 | 
	
		
			
				|  |  | +        approval_id = #{approvalId}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +      <if test="adminId != null and adminId != ''">
 | 
	
		
			
				|  |  | +        admin_id = #{adminId}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +    </where>
 | 
	
		
			
				|  |  | +  </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  <!-- 修改审批信息-->
 | 
	
		
			
				|  |  | +  <update id="updateApprovalInfo" parameterType="ApprovalInfo">
 | 
	
		
			
				|  |  | +    update tb_rst_approval_info
 | 
	
		
			
				|  |  | +    <set >
 | 
	
		
			
				|  |  | +      <if test="approvalStatus != null" >
 | 
	
		
			
				|  |  | +        approval_status = #{approvalStatus},
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +      <if test="approvalStatusDetails != null" >
 | 
	
		
			
				|  |  | +        approval_status_details = #{approvalStatusDetails}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +      <if test="approvalDetails != null" >
 | 
	
		
			
				|  |  | +        approval_details = #{approvalDetails}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +    </set>
 | 
	
		
			
				|  |  | +    <where>
 | 
	
		
			
				|  |  | +      <if test="approvalId != null and approvalId != ''">
 | 
	
		
			
				|  |  | +        approval_id = #{approvalId}
 | 
	
		
			
				|  |  | +      </if>
 | 
	
		
			
				|  |  | +    </where>
 | 
	
		
			
				|  |  | +  </update>
 | 
	
		
			
				|  |  |   <!-- <resultMap id="BaseResultMap" type="ApprovalOrderInfo" >
 | 
	
		
			
				|  |  |      <id column="approval_id" property="approvalId" jdbcType="INTEGER" />
 | 
	
		
			
				|  |  |      <result column="applicant_name" property="applicantName" jdbcType="VARCHAR" />
 |