Java Code Examples for org.jeecg.common.api.vo.Result#setSuccess()
The following examples show how to use
org.jeecg.common.api.vo.Result#setSuccess() .
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: SysLogController.java From jeecg-boot with Apache License 2.0 | 6 votes |
/** * @功能:查询日志记录 * @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 2
Source File: SysCategoryController.java From jeecg-boot with Apache License 2.0 | 6 votes |
/** * 分类字典控件数据回显[表单页面] * @param key * @return */ @RequestMapping(value = "/loadDictItem", method = RequestMethod.GET) public Result<List<String>> loadDictItem(@RequestParam(name="ids") String ids) { Result<List<String>> result = new Result<>(); LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>().in(SysCategory::getId,ids); List<SysCategory> list = this.sysCategoryService.list(query); List<String> textList = new ArrayList<String>(); for (String id : ids.split(",")) { for (SysCategory c : list) { if(id.equals(c.getId())){ textList.add(c.getName()); break; } } } result.setSuccess(true); result.setResult(textList); return result; }
Example 3
Source File: SysUserController.java From jeecg-boot with Apache License 2.0 | 6 votes |
/** * 校验用户账号是否唯一<br> * 可以校验其他 需要检验什么就传什么。。。 * * @param sysUser * @return */ @RequestMapping(value = "/checkOnlyUser", method = RequestMethod.GET) public Result<Boolean> checkOnlyUser(SysUser sysUser) { Result<Boolean> result = new Result<>(); //如果此参数为false则程序发生异常 result.setResult(true); try { //通过传入信息查询新的用户信息 SysUser user = sysUserService.getOne(new QueryWrapper<SysUser>(sysUser)); if (user != null) { result.setSuccess(false); result.setMessage("用户账号已存在"); return result; } } catch (Exception e) { result.setSuccess(false); result.setMessage(e.getMessage()); return result; } result.setSuccess(true); return result; }
Example 4
Source File: SysUserController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 校验用户账号是否唯一<br> * 可以校验其他 需要检验什么就传什么。。。 * * @param sysUser * @return */ @RequestMapping(value = "/checkOnlyUser", method = RequestMethod.GET) public Result<Boolean> checkOnlyUser(SysUser sysUser) { Result<Boolean> result = new Result<>(); //如果此参数为false则程序发生异常 result.setResult(true); try { //通过传入信息查询新的用户信息 SysUser user = sysUserService.getOne(new QueryWrapper<SysUser>(sysUser)); if (user != null) { result.setSuccess(false); result.setMessage("用户账号已存在"); return result; } } catch (Exception e) { result.setSuccess(false); result.setMessage(e.getMessage()); return result; } result.setSuccess(true); return result; }
Example 5
Source File: SysUserController.java From teaching with Apache License 2.0 | 6 votes |
/** * 查询当前用户的所有部门/当前部门编码 * @return */ @RequestMapping(value = "/getCurrentUserDeparts", method = RequestMethod.GET) public Result<Map<String,Object>> getCurrentUserDeparts() { Result<Map<String,Object>> result = new Result<Map<String,Object>>(); try { LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal(); List<SysDepart> list = this.sysDepartService.queryUserDeparts(sysUser.getId()); Map<String,Object> map = new HashMap<String,Object>(); map.put("list", list); map.put("orgCode", sysUser.getOrgCode()); result.setSuccess(true); result.setResult(map); }catch(Exception e) { log.error(e.getMessage(), e); result.error500("查询失败!"); } return result; }
Example 6
Source File: SysRoleController.java From jeecg-cloud with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/queryall", method = RequestMethod.GET) public Result<List<SysRole>> queryall() { Result<List<SysRole>> result = new Result<>(); List<SysRole> list = sysRoleService.list(); if(list==null||list.size()<=0) { result.error500("未找到角色信息"); }else { result.setResult(list); result.setSuccess(true); } return result; }
Example 7
Source File: SysCategoryController.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * 分类字典树控件 加载节点 * @param pid * @param pcode * @param condition * @return */ @RequestMapping(value = "/loadTreeData", method = RequestMethod.GET) public Result<List<TreeSelectModel>> loadDict(@RequestParam(name="pid",required = false) String pid,@RequestParam(name="pcode",required = false) String pcode, @RequestParam(name="condition",required = false) String condition) { Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>(); //pid如果传值了 就忽略pcode的作用 if(oConvertUtils.isEmpty(pid)){ if(oConvertUtils.isEmpty(pcode)){ result.setSuccess(false); result.setMessage("加载分类字典树参数有误.[null]!"); return result; }else{ if(ISysCategoryService.ROOT_PID_VALUE.equals(pcode)){ pid = ISysCategoryService.ROOT_PID_VALUE; }else{ pid = this.sysCategoryService.queryIdByCode(pcode); } if(oConvertUtils.isEmpty(pid)){ result.setSuccess(false); result.setMessage("加载分类字典树参数有误.[code]!"); return result; } } } Map<String, String> query = null; if(oConvertUtils.isNotEmpty(condition)) { query = JSON.parseObject(condition, Map.class); } List<TreeSelectModel> ls = sysCategoryService.queryListByPid(pid,query); result.setSuccess(true); result.setResult(ls); return result; }
Example 8
Source File: SysPermissionController.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 根据菜单id来获取其对应的权限数据 * * @param sysPermissionDataRule * @return */ @RequestMapping(value = "/getPermRuleListByPermId", method = RequestMethod.GET) public Result<List<SysPermissionDataRule>> getPermRuleListByPermId(SysPermissionDataRule sysPermissionDataRule) { List<SysPermissionDataRule> permRuleList = sysPermissionDataRuleService.getPermRuleListByPermId(sysPermissionDataRule.getPermissionId()); Result<List<SysPermissionDataRule>> result = new Result<>(); result.setSuccess(true); result.setResult(permRuleList); return result; }
Example 9
Source File: SysAnnouncementController.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * @功能:补充用户数据,并返回系统消息 * @return */ @RequestMapping(value = "/listByUser", method = RequestMethod.GET) public Result<Map<String,Object>> listByUser() { Result<Map<String,Object>> result = new Result<Map<String,Object>>(); LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal(); String userId = sysUser.getId(); // 1.将系统消息补充到用户通告阅读标记表中 Collection<String> anntIds = sysAnnouncementSendService.queryByUserId(userId); LambdaQueryWrapper<SysAnnouncement> querySaWrapper = new LambdaQueryWrapper<SysAnnouncement>(); querySaWrapper.eq(SysAnnouncement::getMsgType,CommonConstant.MSG_TYPE_ALL); // 全部人员 querySaWrapper.eq(SysAnnouncement::getDelFlag,CommonConstant.DEL_FLAG_0.toString()); // 未删除 querySaWrapper.eq(SysAnnouncement::getSendStatus, CommonConstant.HAS_SEND); //已发布 querySaWrapper.ge(SysAnnouncement::getEndTime, sysUser.getCreateTime()); //新注册用户不看结束通知 if(anntIds!=null&&anntIds.size()>0) { querySaWrapper.notIn(SysAnnouncement::getId, anntIds); } List<SysAnnouncement> announcements = sysAnnouncementService.list(querySaWrapper); if(announcements.size()>0) { for(int i=0;i<announcements.size();i++) { SysAnnouncementSend announcementSend = new SysAnnouncementSend(); announcementSend.setAnntId(announcements.get(i).getId()); announcementSend.setUserId(userId); announcementSend.setReadFlag(CommonConstant.NO_READ_FLAG); sysAnnouncementSendService.save(announcementSend); } } // 2.查询用户未读的系统消息 Page<SysAnnouncement> anntMsgList = new Page<SysAnnouncement>(0,5); anntMsgList = sysAnnouncementService.querySysCementPageByUserId(anntMsgList,userId,"1");//通知公告消息 Page<SysAnnouncement> sysMsgList = new Page<SysAnnouncement>(0,5); sysMsgList = sysAnnouncementService.querySysCementPageByUserId(sysMsgList,userId,"2");//系统消息 Map<String,Object> sysMsgMap = new HashMap<String, Object>(); sysMsgMap.put("sysMsgList", sysMsgList.getRecords()); sysMsgMap.put("sysMsgTotal", sysMsgList.getTotal()); sysMsgMap.put("anntMsgList", anntMsgList.getRecords()); sysMsgMap.put("anntMsgTotal", anntMsgList.getTotal()); result.setSuccess(true); result.setResult(sysMsgMap); return result; }
Example 10
Source File: SysDataLogController.java From teaching with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/list", method = RequestMethod.GET) public Result<IPage<SysDataLog>> queryPageList(SysDataLog dataLog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) { Result<IPage<SysDataLog>> result = new Result<IPage<SysDataLog>>(); QueryWrapper<SysDataLog> queryWrapper = QueryGenerator.initQueryWrapper(dataLog, req.getParameterMap()); Page<SysDataLog> page = new Page<SysDataLog>(pageNo, pageSize); IPage<SysDataLog> pageList = service.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 11
Source File: OSSFileController.java From jeecg-boot-with-activiti with MIT License | 5 votes |
/** * 通过id查询. */ @ResponseBody @GetMapping("/queryById") public Result<OSSFile> queryById(@RequestParam(name = "id") String id) { Result<OSSFile> result = new Result<>(); OSSFile file = ossFileService.getById(id); if (file == null) { result.error500("未找到对应实体"); } else { result.setResult(file); result.setSuccess(true); } return result; }
Example 12
Source File: SysUserController.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * @功能:根据id 批量查询 * @param userIds * @return */ @RequestMapping(value = "/queryByIds", method = RequestMethod.GET) public Result<Collection<SysUser>> queryByIds(@RequestParam String userIds) { Result<Collection<SysUser>> result = new Result<>(); String[] userId = userIds.split(","); Collection<String> idList = Arrays.asList(userId); Collection<SysUser> userRole = sysUserService.listByIds(idList); result.setSuccess(true); result.setResult(userRole); return result; }
Example 13
Source File: SysUserController.java From teaching with Apache License 2.0 | 5 votes |
/** * 根据部门id查询用户信息 * * @param id * @return */ @RequestMapping(value = "/queryUserByDepId", method = RequestMethod.GET) public Result<List<SysUser>> queryUserByDepId(@RequestParam(name = "id", required = true) String id) { Result<List<SysUser>> result = new Result<>(); //List<SysUser> userList = sysUserDepartService.queryUserByDepId(id); SysDepart sysDepart = sysDepartService.getById(id); List<SysUser> userList = sysUserDepartService.queryUserByDepCode(sysDepart.getOrgCode()); //批量查询用户的所属部门 //step.1 先拿到全部的 useids //step.2 通过 useids,一次性查询用户的所属部门名字 List<String> userIds = userList.stream().map(SysUser::getId).collect(Collectors.toList()); if(userIds!=null && userIds.size()>0){ Map<String,String> useDepNames = sysUserService.getDepNamesByUserIds(userIds); userList.forEach(item->{ //TODO 临时借用这个字段用于页面展示 item.setOrgCode(useDepNames.get(item.getId())); }); } try { result.setSuccess(true); result.setResult(userList); return result; } catch (Exception e) { log.error(e.getMessage(), e); result.setSuccess(false); return result; } }
Example 14
Source File: SysDepartController.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * 查询所有部门信息 * @return */ @GetMapping("listAll") public Result<List<SysDepart>> listAll(@RequestParam(name = "id", required = false) String id) { Result<List<SysDepart>> result = new Result<>(); LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>(); query.orderByAsc(SysDepart::getOrgCode); if(oConvertUtils.isNotEmpty(id)){ String arr[] = id.split(","); query.in(SysDepart::getId,arr); } List<SysDepart> ls = this.sysDepartService.list(query); result.setSuccess(true); result.setResult(ls); return result; }
Example 15
Source File: SysRoleController.java From jeecg-boot with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/queryall", method = RequestMethod.GET) public Result<List<SysRole>> queryall() { Result<List<SysRole>> result = new Result<>(); List<SysRole> list = sysRoleService.list(); if(list==null||list.size()<=0) { result.error500("未找到角色信息"); }else { result.setResult(list); result.setSuccess(true); } return result; }
Example 16
Source File: SysDictController.java From jeecg-cloud with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/list", method = RequestMethod.GET) public Result<IPage<SysDict>> queryPageList(SysDict sysDict,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) { Result<IPage<SysDict>> result = new Result<IPage<SysDict>>(); QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, req.getParameterMap()); Page<SysDict> page = new Page<SysDict>(pageNo, pageSize); IPage<SysDict> pageList = sysDictService.page(page, queryWrapper); log.debug("查询当前页:"+pageList.getCurrent()); log.debug("查询当前页数量:"+pageList.getSize()); log.debug("查询结果数量:"+pageList.getRecords().size()); log.debug("数据总数:"+pageList.getTotal()); result.setSuccess(true); result.setResult(pageList); return result; }
Example 17
Source File: OSSFileController.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 通过id查询. */ @ResponseBody @GetMapping("/queryById") public Result<OSSFile> queryById(@RequestParam(name = "id") String id) { Result<OSSFile> result = new Result<>(); OSSFile file = ossFileService.getById(id); if (file == null) { result.error500("未找到对应实体"); } else { result.setResult(file); result.setSuccess(true); } return result; }
Example 18
Source File: SysRoleController.java From teaching with Apache License 2.0 | 5 votes |
/** * 校验角色编码唯一 */ @RequestMapping(value = "/checkRoleCode", method = RequestMethod.GET) public Result<Boolean> checkUsername(String id,String roleCode) { Result<Boolean> result = new Result<>(); result.setResult(true);//如果此参数为false则程序发生异常 log.info("--验证角色编码是否唯一---id:"+id+"--roleCode:"+roleCode); try { SysRole role = null; if(oConvertUtils.isNotEmpty(id)) { role = sysRoleService.getById(id); } SysRole newRole = sysRoleService.getOne(new QueryWrapper<SysRole>().lambda().eq(SysRole::getRoleCode, roleCode)); if(newRole!=null) { //如果根据传入的roleCode查询到信息了,那么就需要做校验了。 if(role==null) { //role为空=>新增模式=>只要roleCode存在则返回false result.setSuccess(false); result.setMessage("角色编码已存在"); return result; }else if(!id.equals(newRole.getId())) { //否则=>编辑模式=>判断两者ID是否一致- result.setSuccess(false); result.setMessage("角色编码已存在"); return result; } } } catch (Exception e) { result.setSuccess(false); result.setResult(false); result.setMessage(e.getMessage()); return result; } result.setSuccess(true); return result; }
Example 19
Source File: SysDictItemController.java From teaching with Apache License 2.0 | 5 votes |
/** * @功能:查询字典数据 * @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 20
Source File: OSSFileController.java From teaching with Apache License 2.0 | 5 votes |
/** * 通过id查询. */ @ResponseBody @GetMapping("/queryById") public Result<OSSFile> queryById(@RequestParam(name = "id") String id) { Result<OSSFile> result = new Result<>(); OSSFile file = ossFileService.getById(id); if (file == null) { result.error500("未找到对应实体"); } else { result.setResult(file); result.setSuccess(true); } return result; }