|
|
@@ -0,0 +1,105 @@
|
|
|
+package com.lc.ibps.components.equipment.provider;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+
|
|
|
+
|
|
|
+import com.lc.ibps.api.base.constants.StateEnum;
|
|
|
+import com.lc.ibps.api.base.page.Page;
|
|
|
+import com.lc.ibps.api.base.query.FieldSort;
|
|
|
+import com.lc.ibps.api.base.query.QueryFilter;
|
|
|
+import com.lc.ibps.base.core.util.BeanUtils;
|
|
|
+import com.lc.ibps.base.core.util.string.StringUtil;
|
|
|
+import com.lc.ibps.cloud.entity.APIPageList;
|
|
|
+import com.lc.ibps.cloud.entity.APIPageResult;
|
|
|
+import com.lc.ibps.cloud.entity.APIRequest;
|
|
|
+import com.lc.ibps.cloud.entity.APIResult;
|
|
|
+import com.lc.ibps.cloud.provider.GenericProvider;
|
|
|
+import com.lc.ibps.components.equipment.api.IPerfVerificationRecordService;
|
|
|
+import com.lc.ibps.entrust.dao.PerfVerificationRecordDao;
|
|
|
+import com.lc.ibps.components.equipment.persistence.entity.PerfVerificationRecordPo;
|
|
|
+
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 《设备性能验证记录》
|
|
|
+ *
|
|
|
+ * 港大医院需求增加该页面
|
|
|
+ * 页面位置在 “设备档案卡” 页面内 新增了tab页“性能验证记录”
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+@Api(tags = "设备档案卡管理", value = "设备性能验证记录")
|
|
|
+@Service
|
|
|
+public class PerfVerificationRecordProvider extends GenericProvider implements IPerfVerificationRecordService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PerfVerificationRecordDao perfVerificationRecordDao;
|
|
|
+
|
|
|
+ @ApiOperation(value = "设备性能验证记录列表(分页条件查询)数据", notes = "设备性能验证记录列表(分页条件查询)数据")
|
|
|
+ @Override
|
|
|
+ public APIResult<APIPageList<PerfVerificationRecordPo>> query(
|
|
|
+ @ApiParam(name = "request", value = "传入查询请求json字符串", required = true)
|
|
|
+ @RequestBody(required = true) APIRequest request) {
|
|
|
+ APIResult<APIPageList<PerfVerificationRecordPo>> result = new APIResult<>();
|
|
|
+ try {
|
|
|
+ QueryFilter queryFilter = getQueryFilter(request);
|
|
|
+
|
|
|
+ // 将QueryFilter转换为Map,并生成whereSql和orderBySql
|
|
|
+ Map<String, Object> params = queryFilter.getParams();
|
|
|
+
|
|
|
+ // 构建动态条件SQL
|
|
|
+ String dynamicWhereSql = queryFilter.getFieldLogic().getSql();
|
|
|
+ if (StringUtil.isNotEmpty(dynamicWhereSql)) {
|
|
|
+ params.put("whereSql", dynamicWhereSql);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建排序SQL
|
|
|
+ if (BeanUtils.isNotEmpty(queryFilter.getFieldSortList())) {
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for (FieldSort fieldSort : queryFilter.getFieldSortList()) {
|
|
|
+ sb.append(fieldSort.getField()).append(" ").append(fieldSort.getDirection()).append(",");
|
|
|
+ }
|
|
|
+ sb.deleteCharAt(sb.length() - 1);
|
|
|
+ params.put("orderBySql", sb.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分页参数
|
|
|
+ Page page = queryFilter.getPage();
|
|
|
+ List<PerfVerificationRecordPo> data;
|
|
|
+ APIPageList<PerfVerificationRecordPo> apiPageData = new APIPageList<>();
|
|
|
+
|
|
|
+ if (page != null) {
|
|
|
+ // 先查询总数
|
|
|
+ int total = perfVerificationRecordDao.queryCount(params);
|
|
|
+
|
|
|
+ // 计算分页参数
|
|
|
+ int offset = (page.getPageNo() - 1) * page.getPageSize();
|
|
|
+ params.put("offset", offset);
|
|
|
+ params.put("limit", page.getPageSize());
|
|
|
+
|
|
|
+ // 查询数据
|
|
|
+ data = perfVerificationRecordDao.query(params);
|
|
|
+
|
|
|
+ // 设置分页结果
|
|
|
+ APIPageResult pageResult = new APIPageResult(page.getPageNo(), page.getPageSize(), total);
|
|
|
+ apiPageData.setPageResult(pageResult);
|
|
|
+ apiPageData.setDataResult(data);
|
|
|
+ } else {
|
|
|
+ // 无分页查询
|
|
|
+ data = perfVerificationRecordDao.query(params);
|
|
|
+ apiPageData.setDataResult(data);
|
|
|
+ }
|
|
|
+ result.setData(apiPageData);
|
|
|
+ } catch (Exception e) {
|
|
|
+ setExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+}
|