|  |  | 
 |  |  | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
 |  |  | <mapper namespace="com.vincent.rsf.server.manager.mapper.LocItemMapper"> | 
 |  |  |  | 
 |  |  |     <select id="pageByStock" resultType="com.vincent.rsf.server.manager.entity.LocItem"> | 
 |  |  |         SELECT * | 
 |  |  |         FROM (SELECT id, | 
 |  |  |                      loc_id, | 
 |  |  |                      loc_code, | 
 |  |  |                      type, | 
 |  |  |                      order_item_id, | 
 |  |  |                      wk_type, | 
 |  |  |                      matnr_id, | 
 |  |  |                      maktx, | 
 |  |  |                      matnr_code, | 
 |  |  |                      unit, | 
 |  |  |                      SUM(anfme)    anfme, | 
 |  |  |                      SUM(qty)      qty, | 
 |  |  |                      SUM(work_qty) work_qty, | 
 |  |  |                      batch, | 
 |  |  |                      spec, | 
 |  |  |                      model, | 
 |  |  |                      fields_index, | 
 |  |  |                      update_by, | 
 |  |  |                      create_by, | 
 |  |  |                      update_time, | 
 |  |  |                      create_time | 
 |  |  |               FROM man_loc_item | 
 |  |  |               GROUP BY matnr_id | 
 |  |  |               UNION ALL | 
 |  |  |               SELECT id, | 
 |  |  |                      ''          AS loc_id, | 
 |  |  |                      ''          AS loc_code, | 
 |  |  |                      type, | 
 |  |  |                      asn_item_id AS order_item_id, | 
 |  |  |                      wk_type, | 
 |  |  |                      matnr_id, | 
 |  |  |                      maktx, | 
 |  |  |                      matnr_code, | 
 |  |  |                      unit, | 
 |  |  |                      SUM(anfme)     anfme, | 
 |  |  |                      SUM(qty)       qty, | 
 |  |  |                      SUM(work_qty)  work_qty, | 
 |  |  |                      batch, | 
 |  |  |                      spec, | 
 |  |  |                      model, | 
 |  |  |                      fields_index, | 
 |  |  |                      update_by, | 
 |  |  |                      create_by, | 
 |  |  |                      update_time, | 
 |  |  |                      create_time | 
 |  |  |               FROM man_warehouse_areas_item | 
 |  |  |               GROUP BY matnr_id) t | 
 |  |  |                 ${ew.customSqlSegment} | 
 |  |  |     </select> | 
 |  |  | </mapper> |