|  |  | 
 |  |  |  | 
 |  |  |     </resultMap> | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     <sql id="pageCondition"> | 
 |  |  |         <if test="matnr != null and matnr != ''"> | 
 |  |  |             and mp.matnr like concat('%',#{matnr},'%') | 
 |  |  |         </if> | 
 |  |  |         <if test="node_id != null and node_id != ''"> | 
 |  |  |             and mp.node_id like concat('%',#{node_id},'%') | 
 |  |  |         </if> | 
 |  |  |     </sql> | 
 |  |  |  | 
 |  |  |     <select id="selectSafeStoPage" resultType="zy.cloud.wms.manager.entity.SafeStoDo"> | 
 |  |  |         select | 
 |  |  |         mp.node_id, | 
 |  |  |         mp.matnr, | 
 |  |  |         mp.safe_qua, | 
 |  |  |         ls.amount, | 
 |  |  |         (cast(round((ls.amount/(mp.safe_qua*1.0))*100,2) as varchar)+'%') as pe | 
 |  |  |         from man_prior mp | 
 |  |  |         inner join | 
 |  |  |         select * from | 
 |  |  |         ( | 
 |  |  |             select | 
 |  |  |             node_id, | 
 |  |  |             matnr, | 
 |  |  |             sum(anfme) as amount | 
 |  |  |             from man_loc_detl | 
 |  |  |             group by node_id, matnr | 
 |  |  |             ROW_NUMBER() over (order by isnull(round((ls.amount/mp.safe_qua),2),0) asc) as row, | 
 |  |  |             mp.node_id, | 
 |  |  |             mp.node_name, | 
 |  |  |             mp.matnr, | 
 |  |  |             mp.maktx, | 
 |  |  |             mp.safe_qua, | 
 |  |  |             ISNULL(ls.amount, 0) as amount, | 
 |  |  |             ISNULL((cast(round((ls.amount/(mp.safe_qua*1.0))*100,2) as varchar)+'%'), '0.00%') as progress, | 
 |  |  |             case | 
 |  |  |             when isnull(round((ls.amount/mp.safe_qua),2),0) > 1 then 1 | 
 |  |  |             when isnull(round((ls.amount/mp.safe_qua),2),0) > 0.75 then 2 | 
 |  |  |             else 3 | 
 |  |  |             end as status | 
 |  |  |             from man_prior mp | 
 |  |  |             left join | 
 |  |  |             ( | 
 |  |  |                 select | 
 |  |  |                 node_id, | 
 |  |  |                 matnr, | 
 |  |  |                 sum(anfme) as amount | 
 |  |  |                 from man_loc_detl | 
 |  |  |                 group by node_id, matnr | 
 |  |  |             ) as ls on ls.node_id = mp.node_id and ls.matnr = mp.matnr | 
 |  |  |             where 1=1 | 
 |  |  |             <include refid="pageCondition"></include> | 
 |  |  |        ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize}) | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectSafeStoPageCount" resultType="java.lang.Integer"> | 
 |  |  |         select | 
 |  |  |         count(1) as count | 
 |  |  |         from man_prior mp | 
 |  |  |         left join | 
 |  |  |         ( | 
 |  |  |         select | 
 |  |  |         node_id, | 
 |  |  |         matnr, | 
 |  |  |         sum(anfme) as amount | 
 |  |  |         from man_loc_detl | 
 |  |  |         group by node_id, matnr | 
 |  |  |         ) as ls on ls.node_id = mp.node_id and ls.matnr = mp.matnr | 
 |  |  |         where 1=1 | 
 |  |  |         <include refid="pageCondition"></include> | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  | </mapper> |