Commit 450daa69 authored by 赵汉亭's avatar 赵汉亭

成本中心ES查询接口

parent 79429ee9
...@@ -30,4 +30,6 @@ public interface CostCenterApplication { ...@@ -30,4 +30,6 @@ public interface CostCenterApplication {
void saveCostCenter(CostCenter costCenter); void saveCostCenter(CostCenter costCenter);
CostCenterVo saveAndUpdate(CostCenter costCenter); CostCenterVo saveAndUpdate(CostCenter costCenter);
Map<String, Object> slicedCostCenterList(CostCenterQueryRequest queryRequest);
} }
...@@ -69,6 +69,13 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA ...@@ -69,6 +69,13 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA
} }
@Override
public Map<String, Object> slicedCostCenterList(CostCenterQueryRequest queryRequest) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "slicedCostCenterList");
QueryModel queryModel = sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest);
return this.sqlExecutorDao.executeSlicedQuery(queryModel);
}
@Override @Override
protected void onEnd(DelegateExecution delegateExecution) { protected void onEnd(DelegateExecution delegateExecution) {
super.onEnd(delegateExecution); super.onEnd(delegateExecution);
......
...@@ -8,12 +8,20 @@ import com.huigou.topsun.sap.costCenter.domain.query.CostCenterQueryRequest; ...@@ -8,12 +8,20 @@ import com.huigou.topsun.sap.costCenter.domain.query.CostCenterQueryRequest;
import com.huigou.topsun.sap.costCenter.domain.vo.CostCenterVo; import com.huigou.topsun.sap.costCenter.domain.vo.CostCenterVo;
import com.huigou.uasp.annotation.ControllerMapping; import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.BizBillStatus; import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.bmp.common.easysearch.EasySearch;
import com.huigou.uasp.bmp.common.easysearch.domain.model.EasySearchParse;
import com.huigou.uasp.bmp.common.easysearch.domain.model.QuerySchemeField;
import com.huigou.uasp.bmp.opm.application.MemEasySearcher;
import com.huigou.uasp.bmp.opm.application.impl.MemEasySearcherImpl;
import com.huigou.uasp.client.CommonController; import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO; import com.huigou.util.SDO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Auther: xin.lu * @Auther: xin.lu
...@@ -64,7 +72,7 @@ public class CostCenterController extends CommonController { ...@@ -64,7 +72,7 @@ public class CostCenterController extends CommonController {
Operator operator = getOperator(); Operator operator = getOperator();
costCenter.setDefaultValues(new OrgUnit(operator.getFullId(), operator.getFullName())); costCenter.setDefaultValues(new OrgUnit(operator.getFullId(), operator.getFullName()));
return forward("sapCostCenterDetail",costCenter); return forward("sapCostCenterDetail", costCenter);
} }
/** /**
...@@ -122,4 +130,30 @@ public class CostCenterController extends CommonController { ...@@ -122,4 +130,30 @@ public class CostCenterController extends CommonController {
return success(costCenterVo); return success(costCenterVo);
} }
/**
* 成本中心ES查询接口
*/
@EasySearch(queryName = "queryCostCenter")
public Map<String, Object> queryCostCenter(SDO sdo) {
Integer intPage = sdo.getInteger("intPage", 1);
Integer pageSize = sdo.getInteger("pageSize", 10);
PageRequest pageRequest = new PageRequest(intPage - 1, pageSize);
List<QuerySchemeField> fields =
Arrays.asList(new QuerySchemeField("id", "id", "hidden"),
new QuerySchemeField("成本中心编码", "kostl", "string", 200L),
new QuerySchemeField("名称", "ktext", "string", 200L)
);
EasySearchParse easySearchParse = new EasySearchParse();
easySearchParse.setFields(fields);
easySearchParse.setWidth(400L);
String ktext = sdo.getString("ktext");
CostCenterQueryRequest queryRequest = sdo.toQueryRequest(CostCenterQueryRequest.class);
queryRequest.setKtext(ktext);
Map<String, Object> map = costCenterApplication.slicedCostCenterList(queryRequest);
List<Map<String, Object>> mapList = (List<Map<String, Object>>) map.get("Rows");
MemEasySearcher<Map<String, Object>> memEasySearcher = new MemEasySearcherImpl<>();
Map<String, Object> model = memEasySearcher.search(mapList, easySearchParse, pageRequest, null);
return model;
}
} }
...@@ -5,4 +5,15 @@ ...@@ -5,4 +5,15 @@
select t.* from sap_cost_center t select t.* from sap_cost_center t
</sql-query> </sql-query>
</query> </query>
<query name="slicedCostCenterList" label="成本中心表" table="cost_center">
<sql-query>
select
t.id,
t.ktext,
t.kostl
from sap_cost_center t
</sql-query>
<condition column="ktext" name="ktext" type="java.lang.String" symbol="like" alias="t"/>
</query>
</query-mappings> </query-mappings>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment