|  |  | 
 |  |  |  | 
 |  |  |     </resultMap> | 
 |  |  |  | 
 |  |  |     <update id="updateSettle"> | 
 |  |  |         update man_order | 
 |  |  |         set settle = #{settle} | 
 |  |  |         ,update_time = getdate() | 
 |  |  |         <if test="userId != null"> | 
 |  |  |             ,update_by = #{userId} | 
 |  |  |         </if> | 
 |  |  |         where 1=1 | 
 |  |  |         and id = #{orderId} | 
 |  |  |     </update> | 
 |  |  |     <update id="updateSettleTo1"> | 
 |  |  |         UPDATE man_order set settle = 1 WHERE order_no = #{orderNo} | 
 |  |  |     </update> | 
 |  |  |     <select id="checkDetlWorkQtyLess0" resultType="integer"> | 
 |  |  |         select count(*) FROM man_order_detl WHERE order_no = #{orderNo} and (work_qty > 0 or qty > 0) | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectComplete" resultMap="BaseResultMap"> | 
 |  |  |         select top 5 * | 
 |  |  |         from man_order | 
 |  |  |         where 1=1 | 
 |  |  |         and settle = 4 | 
 |  |  |         and status = 1 | 
 |  |  |         order by create_time asc | 
 |  |  |     </select> | 
 |  |  |     <select id="selectInOrOutOrders" resultMap="BaseResultMap"> | 
 |  |  |         SELECT * FROM man_order o left join man_doc_type d on o.doc_type = d.doc_id WHERE d.pakin = #{flag} and o.settle in (1,2) | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectToBeHistoryOrder" resultMap="BaseResultMap"> | 
 |  |  |         select * | 
 |  |  |         from man_order | 
 |  |  |         where 1=1 | 
 |  |  |           and settle = #{settle} | 
 |  |  |         order by create_time asc | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <insert id="addToLogTable"> | 
 |  |  |         INSERT INTO man_order_log SELECT * FROM man_order WHERE id = #{id} | 
 |  |  |     </insert> | 
 |  |  |  | 
 |  |  | </mapper> |