自定义报表 调用调整

yun-zuoyi
wei.peng 5 years ago
parent 22c1e27131
commit c29b5c7a87

@ -30,12 +30,4 @@ public interface IReportService {
@ApiOperation(value = "HQL 执行",notes = "执行 HQL")
List selectTemplateModel(TemplateModel model) throws Exception;
/**
* HQL
* @param model HQL Model
* @return
* @throws Exception
*/
@ApiOperation(value = "HQL 执行",notes = "执行 HQL")
Long countTemplateModel(TemplateModel model) throws Exception;
}

@ -76,7 +76,7 @@ public class ReportPojoCloudController {
* @param model
* @return
*/
@PostMapping(value = "/hql/run")
@PostMapping(value = "/query")
@ApiOperation(value = "查询管理后台所有类", notes = "根据核心包路径列出所有类")
public BaseResultBean runHql(@RequestBody TemplateModel model) {
LOGGER.info("【执行 HQL】TemplateModel{}", model);
@ -90,22 +90,4 @@ public class ReportPojoCloudController {
}
}
/**
*
*
* @param model
* @return
*/
@PostMapping(value = "/hql/run-count")
@ApiOperation(value = "查询管理后台所有类", notes = "根据核心包路径列出所有类")
public BaseResultBean runHqlCount(@RequestBody TemplateModel model) {
LOGGER.info("【执行 HQL】TemplateModel{}", model);
try {
Long count = reportService.countTemplateModel(model);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultObject(count);
} catch (Exception e) {
return ResultBean.fail("操作失败").setMsg(e.getMessage()).setErrorMsg(e.getLocalizedMessage());
}
}
}

@ -30,7 +30,7 @@ public class ReportDaoImpl implements IReportDao {
@Override
public List<Object[]> findByHqlObjects(String hql, Map<String,Object> findParam) throws Exception {
LOGGER.info(" find HQL:{} \n find params :{}", hql, findParam);
Query queryObject = entityManager.createQuery(hql);
Query queryObject = entityManager.createNativeQuery(hql);
if(!CollectionUtils.isEmpty(findParam)){
findParam.forEach((K, V) -> queryObject.setParameter(K, V));

@ -35,14 +35,8 @@ public class ReportService implements IReportService {
}
@Override
public Long countTemplateModel(TemplateModel model) throws Exception {
LOGGER.info("报表执行 model :{}",model);
return reportDao.findByHqlCount(model.getCountHql(), model.getFindParam());
}
@Override
public List selectTemplateModel(TemplateModel model) throws Exception{
LOGGER.info("报表执行 model :{}",model);
return reportDao.findByHqlObjects(model.getSelectHql(), model.getFindParam());
return reportDao.findByHqlObjects(model.getQuerySql(), model.getFindParam());
}
}

Loading…
Cancel
Save