|  |  | 
 |  |  | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
 |  |  | <mapper namespace="com.aps.core.mapper.ApsStandardProcessRouteHeaderMapper"> | 
 |  |  |      | 
 |  |  |     <resultMap type="ApsStandardProcessRouteHeader" id="ApsStandardProcessRouteHeaderResult"> | 
 |  |  |     <resultMap type="com.aps.core.domain.ApsStandardProcessRouteHeader" id="ApsStandardProcessRouteHeaderResult"> | 
 |  |  |         <result property="id"    column="id"    /> | 
 |  |  |         <result property="itemCode"    column="item_code"    /> | 
 |  |  |         <result property="drawingNumber"    column="drawing_number"    /> | 
 |  |  |         <result property="routeId"    column="route_id"    /> | 
 |  |  |         <result property="version"    column="version"    /> | 
 |  |  |         <result property="startDate"    column="start_date"    /> | 
 |  |  |         <result property="endDate"    column="end_date"    /> | 
 |  |  |         <result property="orgCode"    column="org_code"    /> | 
 |  |  |         <result property="processAllTime"    column="process_all_time"    /> | 
 |  |  |         <result property="delFlag"    column="del_flag"    /> | 
 |  |  |         <result property="createBy"    column="create_by"    /> | 
 |  |  |         <result property="createTime"    column="create_time"    /> | 
 |  |  | 
 |  |  |     </resultMap> | 
 |  |  |  | 
 |  |  |     <sql id="selectApsStandardProcessRouteHeaderVo"> | 
 |  |  |         select id, route_id, version, start_date, end_date, org_code, del_flag, create_by, create_time, update_by, update_time from aps_standard_process_route_header | 
 |  |  |         select id, route_id, version, start_date, end_date, org_code, del_flag, create_by, | 
 |  |  |                create_time, update_by, update_time, item_code, drawing_number, process_all_time | 
 |  |  |         from aps_standard_process_route_header | 
 |  |  |     </sql> | 
 |  |  |  | 
 |  |  |     <select id="selectApsStandardProcessRouteHeaderList" parameterType="ApsStandardProcessRouteHeader" resultMap="ApsStandardProcessRouteHeaderResult"> | 
 |  |  |     <select id="selectApsStandardProcessRouteHeaderList" parameterType="com.aps.core.domain.ApsStandardProcessRouteHeader" resultMap="ApsStandardProcessRouteHeaderResult"> | 
 |  |  |         <include refid="selectApsStandardProcessRouteHeaderVo"/> | 
 |  |  |         <where>   | 
 |  |  |             <if test="routeId != null  and routeId != ''"> and route_id = #{routeId}</if> | 
 |  |  | 
 |  |  |             <if test="endDate != null  and endDate != ''"> and end_date = #{endDate}</if> | 
 |  |  |             <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if> | 
 |  |  |             <if test="itemCode != null  and itemCode != ''"> and item_code like '%' || #{itemCode} || '%'</if> | 
 |  |  |             <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if> | 
 |  |  |             and del_flag = '0' | 
 |  |  |         </where> | 
 |  |  |         ORDER BY version desc | 
 |  |  |     </select> | 
 |  |  |      | 
 |  |  |     <select id="selectApsStandardProcessRouteHeaderById" parameterType="Long" resultMap="ApsStandardProcessRouteHeaderResult"> | 
 |  |  | 
 |  |  |         where id = #{id} | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <insert id="insertApsStandardProcessRouteHeader" parameterType="ApsStandardProcessRouteHeader"> | 
 |  |  |     <insert id="insertApsStandardProcessRouteHeader" parameterType="com.aps.core.domain.ApsStandardProcessRouteHeader"> | 
 |  |  |         insert into aps_standard_process_route_header | 
 |  |  |         <trim prefix="(" suffix=")" suffixOverrides=","> | 
 |  |  |             <if test="id != null">id,</if> | 
 |  |  | 
 |  |  |          </trim> | 
 |  |  |     </insert> | 
 |  |  |  | 
 |  |  |     <update id="updateApsStandardProcessRouteHeader" parameterType="ApsStandardProcessRouteHeader"> | 
 |  |  |     <update id="updateApsStandardProcessRouteHeader" parameterType="com.aps.core.domain.ApsStandardProcessRouteHeader"> | 
 |  |  |         update aps_standard_process_route_header | 
 |  |  |         <trim prefix="SET" suffixOverrides=","> | 
 |  |  |             <if test="routeId != null">route_id = #{routeId},</if> | 
 |  |  | 
 |  |  |             #{id} | 
 |  |  |         </foreach> | 
 |  |  |     </delete> | 
 |  |  |  | 
 |  |  |     <select id="queryStandardProcessRouteHeaderByPlantAndItemCode" parameterType="String" resultMap="ApsStandardProcessRouteHeaderResult"> | 
 |  |  |         <include refid="selectApsStandardProcessRouteHeaderVo"/> | 
 |  |  |          where del_flag = '0' | 
 |  |  |             <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if> | 
 |  |  |             <if test="itemCode != null  and itemCode != ''"> and item_code = #{itemCode} </if> | 
 |  |  |     </select> | 
 |  |  |      | 
 |  |  |     <select id="selectProcessRouteStandardTimeData" parameterType="String" resultType="com.alibaba.fastjson2.JSONObject"> | 
 |  |  |         select  hd.item_code,sum(standard_time) as standardTime,hd.org_code | 
 |  |  |         from aps_standard_process_route_line as ln | 
 |  |  |                  left join aps_standard_process_route_header as hd on ln.route_id=hd.route_id | 
 |  |  |         where ln.del_flag='0' and hd.del_flag='0' | 
 |  |  |         <if test="orgCode != null  and orgCode != ''"> | 
 |  |  |           and hd.org_code = #{orgCode} | 
 |  |  |         </if> | 
 |  |  |         group by hd.item_code,hd.org_code | 
 |  |  |     </select> | 
 |  |  | </mapper> |