ChamberRecipeTransHistoryAction.java
package com.mycim.webapp.actions.equipment.recipe;
import com.fa.sesa.threadlocal.LocalContext;
import com.mycim.framework.jdbc.Page;
import com.mycim.framework.utils.lang.StringUtils;
import com.mycim.framework.utils.lang.collections.MapUtils;
import com.mycim.valueobject.ObjectList;
import com.mycim.valueobject.ems.Entity;
import com.mycim.webapp.actions.EmsSetupAction;
import java.util.HashMap;
import java.util.Map;
public class ChamberRecipeTransHistoryAction extends EmsSetupAction {
public Map<String, Object> query(Map<String, Object> params) {
String entityId = StringUtils.trimToUpperCase(MapUtils.getString(params, "instanceId"));
Entity theEntity = emsService.getEntity(
new Entity(entityId, getNamedSpace(ObjectList.ENTITY_KEY, LocalContext.getFacilityRrn()),
ObjectList.ENTITY_KEY));
int pageNo = MapUtils.getInteger(params, "currentPage");
if (pageNo <= 0) {
pageNo = 1;
}
int pageSize = 10;
Map<String, Object> condition = new HashMap<>();
condition.put("recipeId", MapUtils.getString(params, "recipeId"));
condition.put("chamberList", MapUtils.getString(params, "chamberList"));
condition.put("startTransDate", MapUtils.getString(params, "startTransDate"));
condition.put("endTransDate", MapUtils.getString(params, "endTransDate"));
condition.put("chamberMode", theEntity.getChamberMode());
Page page = baseService.getRelationHistoryByEntityForRecipe(LocalContext.getFacilityRrn(), pageSize, pageNo,
theEntity.getInstanceRrn(), condition);
Map<String, Object> result = new HashMap<>();
result.put("pageSize", page.getNextPage());
result.put("pageNum", page.getPageNo());
result.put("maxPage", page.getTotalPages());
result.put("startRowNum", page.getStartRow());
result.put("isFirstPage", page.isFirstPage());
result.put("hasPreviousPage", page.isHasPrePage());
result.put("isLastPage", page.getTotalPages() == 0 || page.isLastPage());
result.put("hasNextPage", page.isHasNextPage());
result.put("list", page.getResults());
return result;
}
}