Java Code Examples for org.jeecg.common.system.query.QueryGenerator#initQueryWrapper()

The following examples show how to use org.jeecg.common.system.query.QueryGenerator#initQueryWrapper() . 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: 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 2
Source File: SysDepartRoleController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 分页列表查询
 *
 * @param sysDepartRole
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@AutoLog(value = "部门角色-分页列表查询")
@ApiOperation(value="部门角色-分页列表查询", notes="部门角色-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(SysDepartRole sysDepartRole,
							   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
							   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
							   @RequestParam(name="deptId",required=false) String deptId,
							   HttpServletRequest req) {
	QueryWrapper<SysDepartRole> queryWrapper = QueryGenerator.initQueryWrapper(sysDepartRole, req.getParameterMap());
	Page<SysDepartRole> page = new Page<SysDepartRole>(pageNo, pageSize);
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	List<String> deptIds = null;
	if(oConvertUtils.isEmpty(deptId)){
		if(oConvertUtils.isNotEmpty(user.getIdentity()) && user.getIdentity() == CommonConstant.USER_IDENTITY_2 ){
			deptIds = sysDepartService.getMySubDepIdsByDepId(user.getDepartIds());
		}else{
			return Result.ok(null);
		}
	}else{
		deptIds = sysDepartService.getSubDepIdsByDepId(deptId);
	}
	queryWrapper.in("depart_id",deptIds);
	IPage<SysDepartRole> pageList = sysDepartRoleService.page(page, queryWrapper);
	return Result.ok(pageList);
}
 
Example 3
Source File: SysRoleController.java    From jeecg-boot 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 4
Source File: SysCategoryController.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, 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 5
Source File: SysPositionController.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<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 6
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 7
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 8
Source File: SysUserController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
    * 获取用户列表数据
    * @param user
    * @param pageNo
    * @param pageSize
    * @param req
    * @return
    */
   @PermissionData(pageComponent = "system/UserList")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysUser>> queryPageList(SysUser user,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
	QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
   	//TODO 外部模拟登陆临时账号,列表不显示
       queryWrapper.ne("username","_reserve_user_external");
	Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
	IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);

	//批量查询用户的所属部门
       //step.1 先拿到全部的 useids
       //step.2 通过 useids,一次性查询用户的所属部门名字
       List<String> userIds = pageList.getRecords().stream().map(SysUser::getId).collect(Collectors.toList());
       if(userIds!=null && userIds.size()>0){
           Map<String,String>  useDepNames = sysUserService.getDepNamesByUserIds(userIds);
           pageList.getRecords().forEach(item->{
               //TODO 临时借用这个字段用于页面展示
               item.setOrgCode(useDepNames.get(item.getId()));
           });
       }
	result.setSuccess(true);
	result.setResult(pageList);
	log.info(pageList.toString());
	return result;
}
 
Example 9
Source File: SysCategoryController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@GetMapping(value = "/childList")
public Result<List<SysCategory>> queryPageList(SysCategory sysCategory,HttpServletRequest req) {
	Result<List<SysCategory>> result = new Result<List<SysCategory>>();
	QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap());
	List<SysCategory> list = sysCategoryService.list(queryWrapper);
	result.setSuccess(true);
	result.setResult(list);
	return result;
}
 
Example 10
Source File: SysDictController.java    From jeecg-cloud 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 11
Source File: SysUserController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
    * 获取用户列表数据
    * @param user
    * @param pageNo
    * @param pageSize
    * @param req
    * @return
    */
   @PermissionData(pageComponent = "system/UserList")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysUser>> queryPageList(SysUser user,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
	QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
   	//TODO 外部模拟登陆临时账号,列表不显示
       queryWrapper.ne("username","_reserve_user_external");
	Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
	IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);

	//批量查询用户的所属部门
       //step.1 先拿到全部的 useids
       //step.2 通过 useids,一次性查询用户的所属部门名字
       List<String> userIds = pageList.getRecords().stream().map(SysUser::getId).collect(Collectors.toList());
       if(userIds!=null && userIds.size()>0){
           Map<String,String>  useDepNames = sysUserService.getDepNamesByUserIds(userIds);
           pageList.getRecords().forEach(item->{
               //TODO 临时借用这个字段用于页面展示
               item.setOrgCode(useDepNames.get(item.getId()));
           });
       }
	result.setSuccess(true);
	result.setResult(pageList);
	log.info(pageList.toString());
	return result;
}
 
Example 12
Source File: SysDictItemController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * @功能:查询字典数据
 * @param sysDictItem
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
	QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
	queryWrapper.orderByAsc("sort_order");
	Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
	IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 13
Source File: JoaDemoController.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
  * 分页列表查询
 * @param joaDemo
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/list")
public Result<IPage<JoaDemo>> queryPageList(JoaDemo joaDemo,
								  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								  HttpServletRequest req) {
	Result<IPage<JoaDemo>> result = new Result<IPage<JoaDemo>>();
	QueryWrapper<JoaDemo> queryWrapper = QueryGenerator.initQueryWrapper(joaDemo, req.getParameterMap());
	Page<JoaDemo> page = new Page<JoaDemo>(pageNo, pageSize);
	IPage<JoaDemo> pageList = joaDemoService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 14
Source File: OSSFileController.java    From teaching with Apache License 2.0 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;
}
 
Example 15
Source File: SysDictItemController.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * @功能:查询字典数据
 * @param sysDictItem
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
	Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
	QueryWrapper<SysDictItem> queryWrapper = QueryGenerator.initQueryWrapper(sysDictItem, req.getParameterMap());
	queryWrapper.orderByAsc("sort_order");
	Page<SysDictItem> page = new Page<SysDictItem>(pageNo, pageSize);
	IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
	result.setSuccess(true);
	result.setResult(pageList);
	return result;
}
 
Example 16
Source File: SysPermissionDataRuleImpl.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
/**
 * 根据前端传递的权限名称和权限值参数来查询权限数据
 */
@Override
public List<SysPermissionDataRule> queryPermissionRule(SysPermissionDataRule permRule) {
	QueryWrapper<SysPermissionDataRule> queryWrapper = QueryGenerator.initQueryWrapper(permRule, null);
	return this.list(queryWrapper);
}
 
Example 17
Source File: SysPermissionDataRuleImpl.java    From jeecg-boot with Apache License 2.0 4 votes vote down vote up
/**
 * 根据前端传递的权限名称和权限值参数来查询权限数据
 */
@Override
public List<SysPermissionDataRule> queryPermissionRule(SysPermissionDataRule permRule) {
	QueryWrapper<SysPermissionDataRule> queryWrapper = QueryGenerator.initQueryWrapper(permRule, null);
	return this.list(queryWrapper);
}
 
Example 18
Source File: JeecgOrderMainController.java    From jeecg-cloud with Apache License 2.0 3 votes vote down vote up
/**
 * 分页列表查询
 *
 * @param jeecgOrderMain
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/list")
public Result<?> queryPageList(JeecgOrderMain jeecgOrderMain, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
    QueryWrapper<JeecgOrderMain> queryWrapper = QueryGenerator.initQueryWrapper(jeecgOrderMain, req.getParameterMap());
    Page<JeecgOrderMain> page = new Page<JeecgOrderMain>(pageNo, pageSize);
    IPage<JeecgOrderMain> pageList = jeecgOrderMainService.page(page, queryWrapper);
    return Result.ok(pageList);
}
 
Example 19
Source File: SysMessageTemplateController.java    From teaching with Apache License 2.0 3 votes vote down vote up
/**
 * 分页列表查询
 * 
 * @param sysMessageTemplate
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/list")
public Result<?> queryPageList(SysMessageTemplate sysMessageTemplate, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
		@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
	QueryWrapper<SysMessageTemplate> queryWrapper = QueryGenerator.initQueryWrapper(sysMessageTemplate, req.getParameterMap());
	Page<SysMessageTemplate> page = new Page<SysMessageTemplate>(pageNo, pageSize);
	IPage<SysMessageTemplate> pageList = sysMessageTemplateService.page(page, queryWrapper);
       return Result.ok(pageList);
}
 
Example 20
Source File: SysMessageController.java    From teaching with Apache License 2.0 3 votes vote down vote up
/**
 * 分页列表查询
 * 
 * @param sysMessage
 * @param pageNo
 * @param pageSize
 * @param req
 * @return
 */
@GetMapping(value = "/list")
public Result<?> queryPageList(SysMessage sysMessage, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
		@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
	QueryWrapper<SysMessage> queryWrapper = QueryGenerator.initQueryWrapper(sysMessage, req.getParameterMap());
	Page<SysMessage> page = new Page<SysMessage>(pageNo, pageSize);
	IPage<SysMessage> pageList = sysMessageService.page(page, queryWrapper);
       return Result.ok(pageList);
}