修改查询sql

This commit is contained in:
yangjun 2024-01-10 14:37:56 +08:00
parent d8c056f7ab
commit 2890e7b5f6
2 changed files with 37 additions and 3 deletions

View File

@ -11,8 +11,10 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbtkxx;
import org.jeecg.modules.kc.grab.imports.service.IXxhbtkxxService;
@ -29,6 +31,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -53,6 +56,8 @@ public class XxhbtkxxController extends JeecgController<Xxhbtkxx, IXxhbtkxxServi
@Autowired
private IXxhbtkxxService xxhbtkxxService;
@Value("${jeecg.path.upload}")
private String upLoadPath;
/**
* 分页列表查询
*
@ -161,7 +166,36 @@ public class XxhbtkxxController extends JeecgController<Xxhbtkxx, IXxhbtkxxServi
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, Xxhbtkxx xxhbtkxx) {
return super.exportXls(request, xxhbtkxx, Xxhbtkxx.class, "停课信息");
return exportXls(request, xxhbtkxx, Xxhbtkxx.class, "停课信息");
}
protected ModelAndView exportXls(HttpServletRequest request, Xxhbtkxx object, Class<Xxhbtkxx> clazz, String title) {
// Step.1 组装查询条件
QueryWrapper<Xxhbtkxx> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.in("id",selectionList);
}
queryWrapper.eq(StringUtils.isNotBlank(object.getXqxn()),"b.title",object.getXqxn());
// Step.2 获取导出数据
List<Xxhbtkxx> exportList = service.list(queryWrapper);
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, title);
mv.addObject(NormalExcelConstants.CLASS, clazz);
//update-begin--Author:liusq Date:20210126 for图片导出报错ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
exportParams.setImageBasePath(upLoadPath);
//update-end--Author:liusq Date:20210126 for图片导出报错ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
/**

View File

@ -43,7 +43,7 @@
left join xxhbjxljbxx jxljbxx on jsjbxx.jxlh = jxljbxx.jzwh
left join kc_jieci jc on ktb.hh = jc.jieci
left join kc_kechengbiao kcb on kcb.kcmc = ktb.kcmc and kcb.kcxz = ktb.kcxz and kcb.skjs = ktb.skjs and kcb.skdd=ktb.skdd and kcb.kkdw = ktb.kkdw and kcb.kcbh = ktb.kcbh and kcb.id = ktb.kechengbiaoid
left join (select distinct tkxx.xm,tkxx.kcmc,concat(substring(tkxx.skrq,1,4),'-',substring(tkxx.skrq,5,2),'-',substring(tkxx.skrq,7,2)) as skrq,tkxx.skjs,tkxx.tksy from xxhbtkxx tkxx where tkxx.skrq is not null) tkxx
left join (select distinct tkxx.xm,tkxx.kcmc,concat(substring(tkxx.skrq,1,4),'-',substring(tkxx.skrq,5,2),'-',substring(tkxx.skrq,7,2)) as skrq,tkxx.skjs,tkxx.tksy from xxhbtkxx tkxx where tkxx.tklx != '3' and tkxx.skrq is not null) tkxx
on ktb.kcmc =tkxx.kcmc and ktb.skrq = tkxx.skrq and ktb.skdd=tkxx.skjs and ktb.skjs = tkxx.xm
left join kc_kkdw kkdw on ktb.kkdw = kkdw.kkdw
<where>