org.jeecg.common.system.query.QueryGenerator Java Examples

The following examples show how to use org.jeecg.common.system.query.QueryGenerator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SysUserController.java    From jeecg-cloud with Apache License 2.0 8 votes vote down vote up
/**
   * 导出excel
   *
   * @param request
   */
  @RequestMapping(value = "/exportXls")
  public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
      // Step.1 组装查询条件
      QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap());
      //Step.2 AutoPoi 导出Excel
      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
      //update-begin--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据--------------------
      String selections = request.getParameter("selections");
     if(!oConvertUtils.isEmpty(selections)){
         queryWrapper.in("id",selections.split(","));
     }
      //update-end--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据----------------------
      List<SysUser> pageList = sysUserService.list(queryWrapper);

      //导出文件名称
      mv.addObject(NormalExcelConstants.FILE_NAME, "用户列表");
      mv.addObject(NormalExcelConstants.CLASS, SysUser.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
      ExportParams exportParams = new ExportParams("用户列表数据", "导出人:"+user.getRealname(), "导出信息");
      exportParams.setImageBasePath(upLoadPath);
      mv.addObject(NormalExcelConstants.PARAMS, exportParams);
      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
      return mv;
  }
 
Example #2
Source File: SysUserController.java    From jeecg-boot with Apache License 2.0 8 votes vote down vote up
/**
   * 导出excel
   *
   * @param request
   * @param response
   */
  @RequestMapping(value = "/exportXls")
  public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
      // Step.1 组装查询条件
      QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap());
      //Step.2 AutoPoi 导出Excel
      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
      //update-begin--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据--------------------
      String selections = request.getParameter("selections");
     if(!oConvertUtils.isEmpty(selections)){
         queryWrapper.in("id",selections.split(","));
     }
      //update-end--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据----------------------
      List<SysUser> pageList = sysUserService.list(queryWrapper);

      //导出文件名称
      mv.addObject(NormalExcelConstants.FILE_NAME, "用户列表");
      mv.addObject(NormalExcelConstants.CLASS, SysUser.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
      ExportParams exportParams = new ExportParams("用户列表数据", "导出人:"+user.getRealname(), "导出信息");
      exportParams.setImageBasePath(upLoadPath);
      mv.addObject(NormalExcelConstants.PARAMS, exportParams);
      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
      return mv;
  }
 
Example #3
Source File: SysLogController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:查询日志记录
 * @param syslog
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysLog>> queryPageList(SysLog syslog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysLog>> result = new Result<IPage<SysLog>>();
	QueryWrapper<SysLog> queryWrapper = QueryGenerator.initQueryWrapper(syslog, req.getParameterMap());
	Page<SysLog> page = new Page<SysLog>(pageNo, pageSize);
	//日志关键词
	String keyWord = req.getParameter("keyWord");
	if(oConvertUtils.isNotEmpty(keyWord)) {
		queryWrapper.like("log_content",keyWord);
	}
	//TODO 过滤逻辑处理
	//TODO begin、end逻辑处理
	//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
	//创建时间/创建人的赋值
	IPage<SysLog> pageList = sysLogService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #4
Source File: JeecgDemoController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 分页列表查询
 *
 * @param jeecgDemo
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表")
@GetMapping(value = "/list")
@PermissionData(pageComponent = "jeecg/JeecgDemoList")
public Result<?> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                      HttpServletRequest req) {
    QueryWrapper<JeecgDemo> queryWrapper = QueryGenerator.initQueryWrapper(jeecgDemo, req.getParameterMap());
    Page<JeecgDemo> page = new Page<JeecgDemo>(pageNo, pageSize);

    IPage<JeecgDemo> pageList = jeecgDemoService.page(page, queryWrapper);
    log.info("查询当前页:" + pageList.getCurrent());
    log.info("查询当前页数量:" + pageList.getSize());
    log.info("查询结果数量:" + pageList.getRecords().size());
    log.info("数据总数:" + pageList.getTotal());
    return Result.ok(pageList);
}
 
Example #5
Source File: SysRoleController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysRole sysRole,HttpServletRequest request) {
	// Step.1 组装查询条件
	QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
	//Step.2 AutoPoi 导出Excel
	ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
	List<SysRole> pageList = sysRoleService.list(queryWrapper);
	//导出文件名称
	mv.addObject(NormalExcelConstants.FILE_NAME,"角色列表");
	mv.addObject(NormalExcelConstants.CLASS,SysRole.class);
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	mv.addObject(NormalExcelConstants.PARAMS,new ExportParams("角色列表数据","导出人:"+user.getRealname(),"导出信息"));
	mv.addObject(NormalExcelConstants.DATA_LIST,pageList);
	return mv;
}
 
Example #6
Source File: JeecgDemoController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 分页列表查询
 *
 * @param jeecgDemo
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表")
@GetMapping(value = "/list")
@PermissionData(pageComponent = "jeecg/JeecgDemoList")
public Result<?> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                      HttpServletRequest req) {
    QueryWrapper<JeecgDemo> queryWrapper = QueryGenerator.initQueryWrapper(jeecgDemo, req.getParameterMap());
    Page<JeecgDemo> page = new Page<JeecgDemo>(pageNo, pageSize);

    IPage<JeecgDemo> pageList = jeecgDemoService.page(page, queryWrapper);
    log.info("查询当前页:" + pageList.getCurrent());
    log.info("查询当前页数量:" + pageList.getSize());
    log.info("查询结果数量:" + pageList.getRecords().size());
    log.info("数据总数:" + pageList.getTotal());
    return Result.ok(pageList);
}
 
Example #7
Source File: SysCategoryController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, SysCategory sysCategory) {
    // Step.1 组装查询条件查询数据
    QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, request.getParameterMap());
    List<SysCategory> pageList = sysCategoryService.list(queryWrapper);
    // Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    // 过滤选中数据
    String selections = request.getParameter("selections");
    if(oConvertUtils.isEmpty(selections)) {
  	  mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    }else {
  	  List<String> selectionList = Arrays.asList(selections.split(","));
  	  List<SysCategory> exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
  	  mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
    }
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "分类字典列表");
    mv.addObject(NormalExcelConstants.CLASS, SysCategory.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("分类字典列表数据", "导出人:"+user.getRealname(), "导出信息"));
    return mv;
}
 
Example #8
Source File: JeecgDemoController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 分页列表查询
 *
 * @param jeecgDemo
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表")
@GetMapping(value = "/list")
@PermissionData(pageComponent = "jeecg/JeecgDemoList")
public Result<?> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                      HttpServletRequest req) {
    QueryWrapper<JeecgDemo> queryWrapper = QueryGenerator.initQueryWrapper(jeecgDemo, req.getParameterMap());
    Page<JeecgDemo> page = new Page<JeecgDemo>(pageNo, pageSize);

    IPage<JeecgDemo> pageList = jeecgDemoService.page(page, queryWrapper);
    log.info("查询当前页:" + pageList.getCurrent());
    log.info("查询当前页数量:" + pageList.getSize());
    log.info("查询结果数量:" + pageList.getRecords().size());
    log.info("数据总数:" + pageList.getTotal());
    return Result.ok(pageList);
}
 
Example #9
Source File: JoaDemoController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<JoaDemo> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            JoaDemo joaDemo = JSON.parseObject(deString, JoaDemo.class);
            queryWrapper = QueryGenerator.initQueryWrapper(joaDemo, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<JoaDemo> pageList = joaDemoService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "流程测试列表");
    mv.addObject(NormalExcelConstants.CLASS, JoaDemo.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("流程测试列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #10
Source File: SysDepartController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
  * 导出excel
  *
  * @param request
  */
 @RequestMapping(value = "/exportXls")
 public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) {
     // Step.1 组装查询条件
     QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
     //Step.2 AutoPoi 导出Excel
     ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
     List<SysDepart> pageList = sysDepartService.list(queryWrapper);
     //按字典排序
     Collections.sort(pageList, new Comparator<SysDepart>() {
         @Override
public int compare(SysDepart arg0, SysDepart arg1) {
         	return arg0.getOrgCode().compareTo(arg1.getOrgCode());
         }
     });
     //导出文件名称
     mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表");
     mv.addObject(NormalExcelConstants.CLASS, SysDepart.class);
     LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
     mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息"));
     mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
     return mv;
 }
 
Example #11
Source File: SysLogController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * @功能:查询日志记录
 * @param syslog
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysLog>> queryPageList(SysLog syslog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysLog>> result = new Result<IPage<SysLog>>();
	QueryWrapper<SysLog> queryWrapper = QueryGenerator.initQueryWrapper(syslog, req.getParameterMap());
	Page<SysLog> page = new Page<SysLog>(pageNo, pageSize);
	//日志关键词
	String keyWord = req.getParameter("keyWord");
	if(oConvertUtils.isNotEmpty(keyWord)) {
		queryWrapper.like("log_content",keyWord);
	}
	//TODO 过滤逻辑处理
	//TODO begin、end逻辑处理
	//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
	//创建时间/创建人的赋值
	IPage<SysLog> pageList = sysLogService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #12
Source File: SysPositionController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<SysPosition> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            SysPosition sysPosition = JSON.parseObject(deString, SysPosition.class);
            queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysPosition> pageList = sysPositionService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "职务表列表");
    mv.addObject(NormalExcelConstants.CLASS, SysPosition.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("职务表列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #13
Source File: SysCategoryController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, SysCategory sysCategory) {
    // Step.1 组装查询条件查询数据
    QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, request.getParameterMap());
    List<SysCategory> pageList = sysCategoryService.list(queryWrapper);
    // Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    // 过滤选中数据
    String selections = request.getParameter("selections");
    if(oConvertUtils.isEmpty(selections)) {
  	  mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    }else {
  	  List<String> selectionList = Arrays.asList(selections.split(","));
  	  List<SysCategory> exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
  	  mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
    }
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "分类字典列表");
    mv.addObject(NormalExcelConstants.CLASS, SysCategory.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("分类字典列表数据", "导出人:"+user.getRealname(), "导出信息"));
    return mv;
}
 
Example #14
Source File: SysUserAgentController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param sysUserAgent
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysUserAgent sysUserAgent,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysUserAgent> queryWrapper = QueryGenerator.initQueryWrapper(sysUserAgent, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysUserAgent> pageList = sysUserAgentService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "用户代理人设置列表");
    mv.addObject(NormalExcelConstants.CLASS, SysUserAgent.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 ExportParams exportParams = new ExportParams("用户代理人设置列表数据", "导出人:"+user.getRealname(), "导出信息");
 exportParams.setImageBasePath(upLoadPath);
    mv.addObject(NormalExcelConstants.PARAMS, exportParams);
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #15
Source File: JoaDemoController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<JoaDemo> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            JoaDemo joaDemo = JSON.parseObject(deString, JoaDemo.class);
            queryWrapper = QueryGenerator.initQueryWrapper(joaDemo, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<JoaDemo> pageList = joaDemoService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "流程测试列表");
    mv.addObject(NormalExcelConstants.CLASS, JoaDemo.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("流程测试列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #16
Source File: SysLogController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:查询日志记录
 * @param syslog
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysLog>> queryPageList(SysLog syslog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysLog>> result = new Result<IPage<SysLog>>();
	QueryWrapper<SysLog> queryWrapper = QueryGenerator.initQueryWrapper(syslog, req.getParameterMap());
	Page<SysLog> page = new Page<SysLog>(pageNo, pageSize);
	//日志关键词
	String keyWord = req.getParameter("keyWord");
	if(oConvertUtils.isNotEmpty(keyWord)) {
		queryWrapper.like("log_content",keyWord);
	}
	//TODO 过滤逻辑处理
	//TODO begin、end逻辑处理
	//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
	//创建时间/创建人的赋值
	IPage<SysLog> pageList = sysLogService.page(page, queryWrapper);
	log.info("查询当前页:"+pageList.getCurrent());
	log.info("查询当前页数量:"+pageList.getSize());
	log.info("查询结果数量:"+pageList.getRecords().size());
	log.info("数据总数:"+pageList.getTotal());
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example #17
Source File: TeachingWorkController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
	 * 分页列表查询
	 *
	 * @param studentWorkModel
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	@AutoLog(value = "作业列表-分页列表查询")
	@ApiOperation(value="作业列表-分页列表查询", notes="作业列表-分页列表查询")
	@GetMapping(value = "/list")
	@PermissionData(pageComponent = "teaching/TeachingWorkList")
	public Result<?> queryPageList(StudentWorkModel studentWorkModel,
								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								   HttpServletRequest req) {
//		QueryWrapper<TeachingWork> queryWrapper = QueryGenerator.initQueryWrapper(teachingWork, req.getParameterMap());
		Page<TeachingWork> page = new Page<TeachingWork>(pageNo, pageSize);
		QueryWrapper<StudentWorkModel> queryWrapper = new QueryWrapper<>();
		queryWrapper.eq(null != studentWorkModel.getUsername(), "teaching_work.create_by", studentWorkModel.getUsername())
				.like(null != studentWorkModel.getWorkName(), "work_name", studentWorkModel.getWorkName())
				.like(null != studentWorkModel.getRealname(), "realname", studentWorkModel.getRealname());
		QueryGenerator.installMplus(queryWrapper, studentWorkModel, req.getParameterMap());
		//获取时间参数
		Map<String, String[]> param = req.getParameterMap();
		String updateTime_begin =  param.containsKey("teaching_work.updateTime_begin")?param.get("teaching_work.updateTime_begin")[0]:null;
		String updateTime_end = param.containsKey("teaching_work.updateTime_end")?param.get("teaching_work.updateTime_end")[0]:null;
		queryWrapper.ge(null != updateTime_begin, "teaching_work.create_time", updateTime_begin).
				le(null != updateTime_end, "teaching_work.create_time",updateTime_end);
		IPage<StudentWorkModel> pageList = teachingWorkService.listWorkModel(new Page<>(pageNo, pageSize), queryWrapper);
		return Result.ok(pageList);
	}
 
Example #18
Source File: SysAnnouncementController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysAnnouncement sysAnnouncement,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysAnnouncement> queryWrapper = QueryGenerator.initQueryWrapper(sysAnnouncement, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysAnnouncement> pageList = sysAnnouncementService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "系统通告列表");
    mv.addObject(NormalExcelConstants.CLASS, SysAnnouncement.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("系统通告列表数据", "导出人:"+user.getRealname(), "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #19
Source File: SysDepartController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
  * 导出excel
  *
  * @param request
  * @param response
  */
 @RequestMapping(value = "/exportXls")
 public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) {
     // Step.1 组装查询条件
     QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
     //Step.2 AutoPoi 导出Excel
     ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
     List<SysDepart> pageList = sysDepartService.list(queryWrapper);
     //按字典排序
     Collections.sort(pageList, new Comparator<SysDepart>() {
         @Override
public int compare(SysDepart arg0, SysDepart arg1) {
         	return arg0.getOrgCode().compareTo(arg1.getOrgCode());
         }
     });
     //导出文件名称
     mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表");
     mv.addObject(NormalExcelConstants.CLASS, SysDepart.class);
     LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
     mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息"));
     mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
     return mv;
 }
 
Example #20
Source File: SysRoleController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysRole sysRole,HttpServletRequest request) {
	// Step.1 组装查询条件
	QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
	//Step.2 AutoPoi 导出Excel
	ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
	List<SysRole> pageList = sysRoleService.list(queryWrapper);
	//导出文件名称
	mv.addObject(NormalExcelConstants.FILE_NAME,"角色列表");
	mv.addObject(NormalExcelConstants.CLASS,SysRole.class);
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	mv.addObject(NormalExcelConstants.PARAMS,new ExportParams("角色列表数据","导出人:"+user.getRealname(),"导出信息"));
	mv.addObject(NormalExcelConstants.DATA_LIST,pageList);
	return mv;
}
 
Example #21
Source File: SysPositionController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 分页列表查询
 *
 * @param sysPosition
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@AutoLog(value = "职务表-分页列表查询")
@ApiOperation(value = "职务表-分页列表查询", notes = "职务表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<SysPosition>> queryPageList(SysPosition sysPosition,
                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                HttpServletRequest req) {
    Result<IPage<SysPosition>> result = new Result<IPage<SysPosition>>();
    QueryWrapper<SysPosition> queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, req.getParameterMap());
    Page<SysPosition> page = new Page<SysPosition>(pageNo, pageSize);
    IPage<SysPosition> pageList = sysPositionService.page(page, queryWrapper);
    result.setSuccess(true);
    result.setResult(pageList);
    return result;
}
 
Example #22
Source File: JoaDemoController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<JoaDemo> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            JoaDemo joaDemo = JSON.parseObject(deString, JoaDemo.class);
            queryWrapper = QueryGenerator.initQueryWrapper(joaDemo, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<JoaDemo> pageList = joaDemoService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "流程测试列表");
    mv.addObject(NormalExcelConstants.CLASS, JoaDemo.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("流程测试列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #23
Source File: SysUserAgentController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysUserAgent sysUserAgent,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysUserAgent> queryWrapper = QueryGenerator.initQueryWrapper(sysUserAgent, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysUserAgent> pageList = sysUserAgentService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "用户代理人设置列表");
    mv.addObject(NormalExcelConstants.CLASS, SysUserAgent.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户代理人设置列表数据", "导出人:"+user.getRealname(), "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #24
Source File: JeecgDemoController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 分页列表查询
 *
 * @param jeecgDemo
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表")
@GetMapping(value = "/list")
@PermissionData(pageComponent = "jeecg/JeecgDemoList")
public Result<?> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                      HttpServletRequest req) {
    QueryWrapper<JeecgDemo> queryWrapper = QueryGenerator.initQueryWrapper(jeecgDemo, req.getParameterMap());
    Page<JeecgDemo> page = new Page<JeecgDemo>(pageNo, pageSize);

    IPage<JeecgDemo> pageList = jeecgDemoService.page(page, queryWrapper);
    log.info("查询当前页:" + pageList.getCurrent());
    log.info("查询当前页数量:" + pageList.getSize());
    log.info("查询结果数量:" + pageList.getRecords().size());
    log.info("数据总数:" + pageList.getTotal());
    return Result.ok(pageList);
}
 
Example #25
Source File: SysPositionController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<SysPosition> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            SysPosition sysPosition = JSON.parseObject(deString, SysPosition.class);
            queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysPosition> pageList = sysPositionService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "职务表列表");
    mv.addObject(NormalExcelConstants.CLASS, SysPosition.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("职务表列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #26
Source File: SysCategoryController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, SysCategory sysCategory) {
    // Step.1 组装查询条件查询数据
    QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, request.getParameterMap());
    List<SysCategory> pageList = sysCategoryService.list(queryWrapper);
    // Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    // 过滤选中数据
    String selections = request.getParameter("selections");
    if(oConvertUtils.isEmpty(selections)) {
  	  mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    }else {
  	  List<String> selectionList = Arrays.asList(selections.split(","));
  	  List<SysCategory> exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
  	  mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
    }
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "分类字典列表");
    mv.addObject(NormalExcelConstants.CLASS, SysCategory.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("分类字典列表数据", "导出人:"+user.getRealname(), "导出信息"));
    return mv;
}
 
Example #27
Source File: SysPositionController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 分页列表查询
 *
 * @param sysPosition
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@AutoLog(value = "职务表-分页列表查询")
@ApiOperation(value = "职务表-分页列表查询", notes = "职务表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<SysPosition>> queryPageList(SysPosition sysPosition,
                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                HttpServletRequest req) {
    Result<IPage<SysPosition>> result = new Result<IPage<SysPosition>>();
    QueryWrapper<SysPosition> queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, req.getParameterMap());
    Page<SysPosition> page = new Page<SysPosition>(pageNo, pageSize);
    IPage<SysPosition> pageList = sysPositionService.page(page, queryWrapper);
    result.setSuccess(true);
    result.setResult(pageList);
    return result;
}
 
Example #28
Source File: SysDictController.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysDict sysDict,HttpServletRequest request) {
	// Step.1 组装查询条件
	QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap());
	//Step.2 AutoPoi 导出Excel
	ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
	List<SysDictPage> pageList = new ArrayList<SysDictPage>();

	List<SysDict> sysDictList = sysDictService.list(queryWrapper);
	for (SysDict dictMain : sysDictList) {
		SysDictPage vo = new SysDictPage();
		BeanUtils.copyProperties(dictMain, vo);
		// 查询机票
		List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByMainId(dictMain.getId());
		vo.setSysDictItemList(sysDictItemList);
		pageList.add(vo);
	}

	// 导出文件名称
	mv.addObject(NormalExcelConstants.FILE_NAME, "数据字典");
	// 注解对象Class
	mv.addObject(NormalExcelConstants.CLASS, SysDictPage.class);
	// 自定义表格参数
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("数据字典列表", "导出人:"+user.getRealname(), "数据字典"));
	// 导出数据列表
	mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
	return mv;
}
 
Example #29
Source File: SysDataSourceController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@GetMapping(value = "/options")
public Result<?> queryOptions(SysDataSource sysDataSource, HttpServletRequest req) {
    QueryWrapper<SysDataSource> queryWrapper = QueryGenerator.initQueryWrapper(sysDataSource, req.getParameterMap());
    List<SysDataSource> pageList = sysDataSourceService.list(queryWrapper);
    JSONArray array = new JSONArray(pageList.size());
    for (SysDataSource item : pageList) {
        JSONObject option = new JSONObject(3);
        option.put("value", item.getCode());
        option.put("label", item.getName());
        option.put("text", item.getName());
        array.add(option);
    }
    return Result.ok(array);
}
 
Example #30
Source File: OSSFileController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
@ResponseBody
@GetMapping("/list")
public Result<IPage<OSSFile>> queryPageList(OSSFile file,
		@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
		@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
	Result<IPage<OSSFile>> result = new Result<>();
	QueryWrapper<OSSFile> queryWrapper = QueryGenerator.initQueryWrapper(file, req.getParameterMap());
	Page<OSSFile> page = new Page<>(pageNo, pageSize);
	IPage<OSSFile> pageList = ossFileService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}