com.baomidou.mybatisplus.core.conditions.query.QueryWrapper Java Examples
The following examples show how to use
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper.
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: PictureServiceImpl.java From yshopmall with Apache License 2.0 | 6 votes |
@Override public void synchronize() { //链式构建请求 String result = HttpRequest.get(YshopConstant.Url.SM_MS_URL + "/v2/upload_history") //头信息,多个头信息多次调用此方法即可 .header("Authorization", token) .timeout(20000) .execute().body(); JSONObject jsonObject = JSONUtil.parseObj(result); List<Picture> pictures = JSON.parseArray(jsonObject.get("data").toString(), Picture.class); for (Picture picture : pictures) { if(this.getOne(new QueryWrapper<Picture>().eq("url",picture.getUrl()))==null){ picture.setSize(FileUtil.getSize(Integer.parseInt(picture.getSize()))); picture.setUsername("System Sync"); picture.setMd5code(null); this.save(picture); } } }
Example #2
Source File: SysAnnouncementController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 导出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 #3
Source File: PermissionServiceImpl.java From sophia_scaffolding with Apache License 2.0 | 6 votes |
@Transactional(rollbackFor = CommonException.class) @Override public boolean deletePermission(String id) { boolean flag = false; List<Permission> permissions = baseMapper.selectList(new QueryWrapper<Permission>().eq("STATUS", 1).orderByAsc("SORT").orderByDesc("CREATE_TIME")); if (permissions.size() > 0) { List<Permission> chilrenPermissionList = new LinkedList<>(); childPermissionList(permissions, id, chilrenPermissionList); chilrenPermissionList = chilrenPermissionList.parallelStream().distinct().collect(Collectors.toList()); if (chilrenPermissionList.size() > 0) { List<String> ids = chilrenPermissionList.parallelStream().map(Permission::getId).collect(Collectors.toList()); if (ids.size() > 0) { List<RolePermission> list = rolePermissionMapper.selectBatchPerIds(ids); if (list.size() > 0) { rolePermissionMapper.deleteBatchIds(list.stream().map(RolePermission::getId).collect(Collectors.toList())); } flag = baseMapper.updateBatchIds(ids) > 0; } } } return flag; }
Example #4
Source File: SysLogController.java From jeecg-cloud 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 #5
Source File: SysDepartController.java From jeecg-cloud with Apache License 2.0 | 6 votes |
/** * 导出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 #6
Source File: AppWxPayController.java From charging_pile_cloud with MIT License | 6 votes |
/** * 微信充值回调 */ @ResponseBody @RequestMapping("/wxBack") public String payNotify(HttpServletRequest request, HttpServletResponse response) { try { String xmlResult = IOUtils.toString(request.getInputStream(), request.getCharacterEncoding()); WxPayOrderNotifyResult result = wxPayService.parseOrderNotifyResult(xmlResult); // 结果正确 String orderId = result.getOutTradeNo(); String tradeNo = result.getTransactionId(); //自己处理订单的业务逻辑,需要判断订单是否已经支付过,否则可能会重复调用 StockUserCharge stockUserCharge = stockUserChargeService.getOne(new QueryWrapper<StockUserCharge>() .eq("swift_no",orderId)); if(stockUserCharge.getWithdrawStatus() == WithdrawStatusEnum.STATUS_4.getCode().byteValue()){ //更新付款状态 用户付款成功 stockUserCharge.setTranId(tradeNo); stockUserChargeService.withdrawStatusSuccess(stockUserCharge); } return WxPayNotifyResponse.success("处理成功!"); } catch (Exception e) { log.error("微信回调结果异常,异常原因{}", e.getMessage()); return WxPayNotifyResponse.fail(e.getMessage()); } }
Example #7
Source File: JeecgDemoController.java From jeecg-boot with Apache License 2.0 | 6 votes |
/** * 分页列表查询 * * @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 #8
Source File: SysUserAgentController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 导出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 #9
Source File: SysDepartRolePermissionServiceImpl.java From jeecg-boot with Apache License 2.0 | 6 votes |
@Override public void saveDeptRolePermission(String roleId, String permissionIds, String lastPermissionIds) { List<String> add = getDiff(lastPermissionIds,permissionIds); if(add!=null && add.size()>0) { List<SysDepartRolePermission> list = new ArrayList<SysDepartRolePermission>(); for (String p : add) { if(oConvertUtils.isNotEmpty(p)) { SysDepartRolePermission rolepms = new SysDepartRolePermission(roleId, p); list.add(rolepms); } } this.saveBatch(list); } List<String> delete = getDiff(permissionIds,lastPermissionIds); if(delete!=null && delete.size()>0) { for (String permissionId : delete) { this.remove(new QueryWrapper<SysDepartRolePermission>().lambda().eq(SysDepartRolePermission::getRoleId, roleId).eq(SysDepartRolePermission::getPermissionId, permissionId)); } } }
Example #10
Source File: DictServiceImpl.java From Moss with Apache License 2.0 | 6 votes |
@Override public PageResult<DictTypeListVO> findByPageVague(DictTypeListRequest dictTypeListRequest) { Page pageRequest = new Page(dictTypeListRequest.getPageNo(),dictTypeListRequest.getPageSize()); QueryWrapper<DictType> queryWrapper = new QueryWrapper<>(); if(StringUtils.isNotEmpty(dictTypeListRequest.getDictCode())){ queryWrapper.like("dict_code",dictTypeListRequest.getDictCode()); } if(StringUtils.isNotEmpty(dictTypeListRequest.getDictName())){ queryWrapper.like("dict_name",dictTypeListRequest.getDictName()); } queryWrapper.eq("is_deleted",Constants.IS_DELETE_FALSE); IPage<DictType> page=dictTypeMapper.selectPage(pageRequest, queryWrapper); List<DictTypeListVO> list= BeanMapper.mapList(page.getRecords(),DictType.class,DictTypeListVO.class); for (DictTypeListVO dictTypeListVO:list) { List<DictData> dictDataList= dictDataMapper.findDictDataByDictCode(dictTypeListVO.getDictCode()); dictTypeListVO.setDictDataModelList(BeanMapper.mapList(dictDataList,DictData.class,DictDataModel.class)); } PageResult<DictTypeListVO> pageResult=new PageResult<DictTypeListVO>(); pageResult.setCurrentPage(page.getCurrent()); pageResult.setTotalCount(page.getTotal()); pageResult.setList(list); pageResult.setTotalPage(page.getSize()); return pageResult; }
Example #11
Source File: SysDataLogController.java From teaching with Apache License 2.0 | 6 votes |
/** * 查询版本信息 * @param req * @return */ @RequestMapping(value = "/queryDataVerList", method = RequestMethod.GET) public Result<List<SysDataLog>> queryDataVerList(HttpServletRequest req) { Result<List<SysDataLog>> result = new Result<>(); String dataTable = req.getParameter("dataTable"); String dataId = req.getParameter("dataId"); QueryWrapper<SysDataLog> queryWrapper = new QueryWrapper<SysDataLog>(); queryWrapper.eq("data_table", dataTable); queryWrapper.eq("data_id", dataId); List<SysDataLog> list = service.list(queryWrapper); if(list==null||list.size()<=0) { result.error500("未找到版本信息"); }else { result.setResult(list); result.setSuccess(true); } return result; }
Example #12
Source File: CrudTest.java From spring-boot-demo with MIT License | 6 votes |
@Test public void testTableFieldExistFalse() { QueryWrapper<User> wrapper = new QueryWrapper<>(); wrapper.select("age, count(age) as count") .groupBy("age"); List<User> list = mapper.selectList(wrapper); list.forEach(System.out::println); list.forEach(x -> { Assert.assertNull(x.getId()); Assert.assertNotNull(x.getAge()); Assert.assertNotNull(x.getCount()); }); mapper.insert( new User().setId(10088L) .setName("miemie") .setEmail("[email protected]") .setAge(3)); User miemie = mapper.selectById(10088L); Assert.assertNotNull(miemie); }
Example #13
Source File: SysRolePermissionServiceImpl.java From teaching with Apache License 2.0 | 6 votes |
@Override public void saveRolePermission(String roleId, String permissionIds, String lastPermissionIds) { List<String> add = getDiff(lastPermissionIds,permissionIds); if(add!=null && add.size()>0) { List<SysRolePermission> list = new ArrayList<SysRolePermission>(); for (String p : add) { if(oConvertUtils.isNotEmpty(p)) { SysRolePermission rolepms = new SysRolePermission(roleId, p); list.add(rolepms); } } this.saveBatch(list); } List<String> delete = getDiff(permissionIds,lastPermissionIds); if(delete!=null && delete.size()>0) { for (String permissionId : delete) { this.remove(new QueryWrapper<SysRolePermission>().lambda().eq(SysRolePermission::getRoleId, roleId).eq(SysRolePermission::getPermissionId, permissionId)); } } }
Example #14
Source File: DeptController.java From yshopmall with Apache License 2.0 | 6 votes |
@Log("删除部门") @ApiOperation("删除部门") @DeleteMapping @PreAuthorize("@el.check('admin','dept:del')") public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){ List<Long> deptIds = new ArrayList<>(); for (Long id : ids) { List<Dept> deptList = deptService.findByPid(id); Dept dept = deptService.getOne(new QueryWrapper<Dept>().eq("id",id)); if(null!=dept){ deptIds.add(dept.getId()); } if(CollectionUtil.isNotEmpty(deptList)){ for(Dept d:deptList){ deptIds.add(d.getId()); } } } try { deptService.removeByIds(deptIds); }catch (Throwable e){ throw new BadRequestException( "所选部门中存在岗位或者角色关联,请取消关联后再试"); } return new ResponseEntity<>(HttpStatus.OK); }
Example #15
Source File: SysDictTypeServiceImpl.java From mogu_blog_v2 with Apache License 2.0 | 6 votes |
@Override public String addSysDictType(SysDictTypeVO sysDictTypeVO) { HttpServletRequest request = RequestHolder.getRequest(); // 判断添加的字典类型是否存在 QueryWrapper<SysDictType> queryWrapper = new QueryWrapper<>(); queryWrapper.eq(SQLConf.DICT_TYPE, sysDictTypeVO.getDictType()); queryWrapper.eq(SQLConf.STATUS, EStatus.ENABLE); queryWrapper.last("LIMIT 1"); SysDictType temp = sysDictTypeService.getOne(queryWrapper); if (temp != null) { return ResultUtil.result(SysConf.ERROR, MessageConf.ENTITY_EXIST); } SysDictType sysDictType = new SysDictType(); sysDictType.setDictName(sysDictTypeVO.getDictName()); sysDictType.setDictType(sysDictTypeVO.getDictType()); sysDictType.setRemark(sysDictTypeVO.getRemark()); sysDictType.setIsPublish(sysDictTypeVO.getIsPublish()); sysDictType.setSort(sysDictTypeVO.getSort()); sysDictType.setCreateByUid(request.getAttribute(SysConf.ADMIN_UID).toString()); sysDictType.setUpdateByUid(request.getAttribute(SysConf.ADMIN_UID).toString()); sysDictType.insert(); return ResultUtil.result(SysConf.SUCCESS, MessageConf.INSERT_SUCCESS); }
Example #16
Source File: UserService.java From Guns with GNU Lesser General Public License v3.0 | 6 votes |
/** * 修改用户 * * @author fengshuonan * @Date 2018/12/24 22:53 */ @Transactional(rollbackFor = Exception.class) public void editUser(UserDto user) { User oldUser = this.getById(user.getUserId()); if (LoginContextHolder.getContext().hasRole(Const.ADMIN_NAME)) { this.updateById(UserFactory.editUser(user, oldUser)); } else { this.assertAuth(user.getUserId()); LoginUser shiroUser = LoginContextHolder.getContext().getUser(); if (shiroUser.getId().equals(user.getUserId())) { this.updateById(UserFactory.editUser(user, oldUser)); } else { throw new ServiceException(BizExceptionEnum.NO_PERMITION); } } //删除职位关联 userPosService.remove(new QueryWrapper<UserPos>().eq("user_id", user.getUserId())); //添加职位关联 addPosition(user.getPosition(), user.getUserId()); }
Example #17
Source File: UserServiceImpl.java From sophia_scaffolding with Apache License 2.0 | 6 votes |
@Override public boolean updateRole(UserDto userDto) { UserRole userRole = userRoleMapper.selectOne(new QueryWrapper<UserRole>().eq("USER_ID", userDto.getId())); if (null == userRole) { UserRole userRole1 = new UserRole(); userRole1.setId(UuidUtil.getUuid()); userRole1.setUserId(userDto.getId()); userRole1.setRoleId(userDto.getRoleId()); return userRoleMapper.insert(userRole1) > 0; } else { if (!(userRole.getRoleId().equals(userDto.getRoleId()))) { userRole.setRoleId(userDto.getRoleId()); return userRoleMapper.updateById(userRole) > 0; } return true; } }
Example #18
Source File: SysRoleController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 导出excel * @param request * @param response */ @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 #19
Source File: SysCategoryController.java From jeecg-cloud with Apache License 2.0 | 6 votes |
/** * 分页列表查询 * @param sysCategory * @param pageNo * @param pageSize * @param req * @return */ @GetMapping(value = "/rootList") public Result<IPage<SysCategory>> queryPageList(SysCategory sysCategory, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { if(oConvertUtils.isEmpty(sysCategory.getPid())){ sysCategory.setPid("0"); } Result<IPage<SysCategory>> result = new Result<IPage<SysCategory>>(); //--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------start //QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, req.getParameterMap()); QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>(); queryWrapper.eq("pid", sysCategory.getPid()); //--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------end Page<SysCategory> page = new Page<SysCategory>(pageNo, pageSize); IPage<SysCategory> pageList = sysCategoryService.page(page, queryWrapper); result.setSuccess(true); result.setResult(pageList); return result; }
Example #20
Source File: SysDepartController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 导出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 #21
Source File: GoodsServiceImpl.java From supplierShop with MIT License | 6 votes |
/** * 购物车列表 * @param pageVO * @param userId * @return */ @Override public List<CartDTO> cartList(PageVO pageVO,int userId) { QueryWrapper<StoreCart> cartQueryWrapper = new QueryWrapper<>(); cartQueryWrapper.eq("user_id",userId).groupBy("goods_id"); Page<StoreCart> pageModel = new Page<>(pageVO.getPage(), pageVO.getLimit()); IPage<StoreCart> storeCarts = storeCartMapper .selectPage(pageModel,cartQueryWrapper); List<StoreCart> storeCartList = storeCarts.getRecords(); List<CartDTO> carts = new ArrayList<>(); for (StoreCart storeCart : storeCartList) { CartDTO cartDTO = new CartDTO(); StoreGoods storeGoods = getById(storeCart.getGoodsId()); cartDTO.setGoodsId(storeCart.getGoodsId()); cartDTO.setGoodsName(storeGoods.getGoodsName()); cartDTO.setGoodsSn(storeGoods.getGoodsSn()); cartDTO.setGoodsLogo(storeGoods.getGoodsLogo()); QueryWrapper<StoreCart> wrapper = new QueryWrapper<>(); wrapper.eq("user_id",userId).eq("goods_id",storeCart.getGoodsId()); cartDTO.setSpecList(cartMapper.toDto(storeCartMapper.selectList(wrapper))); carts.add(cartDTO); } return carts; }
Example #22
Source File: SysUserController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 批量删除指定角色的用户关系 * * @param * @return */ @RequestMapping(value = "/deleteUserRoleBatch", method = RequestMethod.DELETE) public Result<SysUserRole> deleteUserRoleBatch( @RequestParam(name="roleId") String roleId, @RequestParam(name="userIds",required=true) String userIds) { Result<SysUserRole> result = new Result<SysUserRole>(); try { QueryWrapper<SysUserRole> queryWrapper = new QueryWrapper<SysUserRole>(); queryWrapper.eq("role_id", roleId).in("user_id",Arrays.asList(userIds.split(","))); sysUserRoleService.remove(queryWrapper); result.success("删除成功!"); }catch(Exception e) { log.error(e.getMessage(), e); result.error500("删除失败!"); } return result; }
Example #23
Source File: QueryGenerator.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 获取查询条件构造器QueryWrapper实例 通用查询条件已被封装完成 * @param searchObj 查询实体 * @param parameterMap request.getParameterMap() * @return QueryWrapper实例 */ public static <T> QueryWrapper<T> initQueryWrapper(T searchObj,Map<String, String[]> parameterMap){ long start = System.currentTimeMillis(); QueryWrapper<T> queryWrapper = new QueryWrapper<T>(); installMplus(queryWrapper, searchObj, parameterMap); log.debug("---查询条件构造器初始化完成,耗时:"+(System.currentTimeMillis()-start)+"毫秒----"); return queryWrapper; }
Example #24
Source File: TagServiceImpl.java From SENS with GNU General Public License v3.0 | 5 votes |
@Override public QueryWrapper<Tag> getQueryWrapper(Tag tag) { //对指定字段查询 QueryWrapper<Tag> queryWrapper = new QueryWrapper<>(); if (tag != null) { if (StrUtil.isNotBlank(tag.getTagName())) { queryWrapper.eq("tag_name", tag.getTagName()); } if (tag.getUserId() != null) { queryWrapper.eq("user_id", tag.getUserId()); } } return queryWrapper; }
Example #25
Source File: JobLogResource.java From albedo with GNU Lesser General Public License v3.0 | 5 votes |
/** * GET / : get all jobLog. * * @param pm the pagination information * @return the Result with status 200 (OK) and with body all jobLog */ @PreAuthorize("@pms.hasPermission('quartz_jobLog_view')") @GetMapping @Log(value = "任务日志查看") public Result getPage(PageModel pm, JobLogQueryCriteria jobLogQueryCriteria) { QueryWrapper wrapper = QueryWrapperUtil.getWrapper(pm, jobLogQueryCriteria); return Result.buildOkData(jobLogService.page(pm, wrapper)); }
Example #26
Source File: JeecgOrderTabMainController.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * 通过id查询 * * @param jeecgOrderTicket * @return */ @GetMapping(value = "/listOrderTicketByMainId") public Result<?> queryOrderTicketListByMainId(JeecgOrderTicket jeecgOrderTicket, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { QueryWrapper<JeecgOrderTicket> queryWrapper = QueryGenerator.initQueryWrapper(jeecgOrderTicket, req.getParameterMap()); Page<JeecgOrderTicket> page = new Page<JeecgOrderTicket>(pageNo, pageSize); IPage<JeecgOrderTicket> pageList = jeecgOrderTicketService.page(page, queryWrapper); return Result.ok(pageList); }
Example #27
Source File: ItemCartServiceImpl.java From poseidon with Apache License 2.0 | 5 votes |
@Override public boolean clear(@NonNull String nickName) { try { List<ItemCart> itemCartList = list(new QueryWrapper<ItemCart>() .eq("member_nickname", nickName).eq("status", 0)); itemCartList.forEach(itemCart -> itemCart.setItemCartStatus(1)); updateBatchById(itemCartList); return true; } catch (Exception e) { e.printStackTrace(); } return false; }
Example #28
Source File: SysUserServiceImpl.java From teaching with Apache License 2.0 | 5 votes |
@Override public IPage<SysUser> getUserByDepartIdAndQueryWrapper(Page<SysUser> page, String departId, QueryWrapper<SysUser> queryWrapper) { LambdaQueryWrapper<SysUser> lambdaQueryWrapper = queryWrapper.lambda(); lambdaQueryWrapper.eq(SysUser::getDelFlag, "0"); lambdaQueryWrapper.inSql(SysUser::getId, "SELECT user_id FROM sys_user_depart WHERE dep_id = '" + departId + "'"); return userMapper.selectPage(page, lambdaQueryWrapper); }
Example #29
Source File: MyBatisAccessor.java From jstarcraft-core with Apache License 2.0 | 5 votes |
@Override public <K extends Comparable, T extends IdentityObject<K>> long countInstances(Class<T> clazz) { MyBatisMetadata metadata = metadatas.get(clazz); BaseMapper mapper = template.getMapper(metadata.getMapperClass()); QueryWrapper<?> query = new QueryWrapper<>(); return mapper.selectCount(query); }
Example #30
Source File: MyBlogController.java From My-Blog-layui with Apache License 2.0 | 5 votes |
/** * 文章详情 * * @param request * @param blogId * @return java.lang.String * @date 2019/9/6 13:09 */ @GetMapping({"/blog/{blogId}", "/article/{blogId}"}) public String detail(HttpServletRequest request, @PathVariable("blogId") Long blogId) { // 获得文章info BlogInfo blogInfo = blogInfoService.getById(blogId); List<BlogTagRelation> blogTagRelations = blogTagRelationService.list(new QueryWrapper<BlogTagRelation>() .lambda() .eq(BlogTagRelation::getBlogId, blogId)); blogInfoService.updateById(new BlogInfo() .setBlogId(blogInfo.getBlogId()) .setBlogViews(blogInfo.getBlogViews() + 1) ); // 获得关联的标签列表 List<Integer> tagIds; List<BlogTag> tagList = new ArrayList<>(); if (!blogTagRelations.isEmpty()) { tagIds = blogTagRelations.stream() .map(BlogTagRelation::getTagId).collect(Collectors.toList()); tagList = blogTagService.list(new QueryWrapper<BlogTag>().lambda().in(BlogTag::getTagId, tagIds)); } // 关联评论的Count Integer blogCommentCount = blogCommentService.count(new QueryWrapper<BlogComment>() .lambda() .eq(BlogComment::getCommentStatus, BlogStatusConstants.ONE) .eq(BlogComment::getIsDeleted,BlogStatusConstants.ZERO) .eq(BlogComment::getBlogId, blogId)); BlogDetailVO blogDetailVO = new BlogDetailVO(); BeanUtils.copyProperties(blogInfo,blogDetailVO); blogDetailVO.setCommentCount(blogCommentCount); request.setAttribute("blogDetailVO", blogDetailVO); request.setAttribute("tagList", tagList); request.setAttribute("pageName", "详情"); request.setAttribute("configurations", blogConfigService.getAllConfigs()); return "blog/" + theme + "/detail"; }