Java Code Examples for com.baomidou.mybatisplus.mapper.EntityWrapper#eq()
The following examples show how to use
com.baomidou.mybatisplus.mapper.EntityWrapper#eq() .
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: RoleController.java From mysiteforme with Apache License 2.0 | 6 votes |
@RequiresPermissions("sys:role:list") @PostMapping("list") @ResponseBody public LayerData<Role> list(@RequestParam(value = "page",defaultValue = "1")Integer page, @RequestParam(value = "limit",defaultValue = "10")Integer limit, ServletRequest request){ Map map = WebUtils.getParametersStartingWith(request, "s_"); LayerData<Role> roleLayerData = new LayerData<>(); EntityWrapper<Role> roleEntityWrapper = new EntityWrapper<>(); roleEntityWrapper.eq("del_flag",false); if(!map.isEmpty()){ String keys = (String) map.get("key"); if(StringUtils.isNotBlank(keys)) { roleEntityWrapper.like("name", keys); } } Page<Role> rolePage = roleService.selectPage(new Page<>(page,limit),roleEntityWrapper); roleLayerData.setCount(rolePage.getTotal()); roleLayerData.setData(setUserToRole(rolePage.getRecords())); return roleLayerData; }
Example 2
Source File: DefaultOrderServiceImpl.java From MeetingFilm with Apache License 2.0 | 6 votes |
@Override public Page<OrderVO> getOrderByUserId(Integer userId, Page<OrderVO> page) { Page<OrderVO> result = new Page<>(); if (userId == null) { log.error("订单查询业务失败,用户编号未传入"); return null; } else { List<OrderVO> ordersByUserId = moocOrderTMapper.getOrdersByUserId(userId, page); if (ordersByUserId == null && ordersByUserId.size() == 0) { result.setTotal(0); result.setRecords(new ArrayList<>()); return result; } else { // 获取订单总数 EntityWrapper<MoocOrderT> entityWrapper = new EntityWrapper<>(); entityWrapper.eq("order_user", userId); Integer counts = moocOrderTMapper.selectCount(entityWrapper); // 将结果放入Page result.setTotal(counts); result.setRecords(ordersByUserId); return result; } } }
Example 3
Source File: QuartzTaskLogController.java From mysiteforme with Apache License 2.0 | 6 votes |
@RequiresPermissions("quartz:log:list") @PostMapping("list") @ResponseBody public LayerData<QuartzTaskLog> list(@RequestParam(value = "page",defaultValue = "1")Integer page, @RequestParam(value = "limit",defaultValue = "10")Integer limit, ServletRequest request){ Map map = WebUtils.getParametersStartingWith(request, "s_"); LayerData<QuartzTaskLog> layerData = new LayerData<>(); EntityWrapper<QuartzTaskLog> wrapper = new EntityWrapper<>(); wrapper.eq("del_flag",false); if(!map.isEmpty()){ String name = (String) map.get("name"); if(StringUtils.isNotBlank(name)) { wrapper.like("name",name); }else{ map.remove("name"); } } Page<QuartzTaskLog> pageData = quartzTaskLogService.selectPage(new Page<>(page,limit),wrapper); layerData.setData(pageData.getRecords()); layerData.setCount(pageData.getTotal()); return layerData; }
Example 4
Source File: SysLogController.java From cola-cloud with MIT License | 6 votes |
/** * 查找系统日志 */ @GetMapping(value = "/list") @ApiOperation("查找系统日志") public Result<Page<List<SysLog>>> list(Integer type, String name, Date startDate, Date endDate) { EntityWrapper wrapper = new EntityWrapper<>(); wrapper.like("name", name); if (type != null) { wrapper.eq("type", type); } if (startDate != null) { wrapper.andNew("create_time >= {0}", startDate); } // if (endDate != null) { wrapper.andNew("create_time <= {0}", endDate); } wrapper.orderBy("id"); return this.success(sysLogService.selectPage(this.getPagination(), wrapper)); }
Example 5
Source File: AdminCouponServiceImpl.java From unimall with Apache License 2.0 | 5 votes |
@Override @Transactional(rollbackFor = Exception.class) public Boolean deleteCoupon(Long adminId, Long id) throws ServiceException { EntityWrapper wrapperC = new EntityWrapper(); wrapperC.eq("id", id); if (couponMapper.delete(wrapperC) <= 0) { throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION); } EntityWrapper wrapperUC = new EntityWrapper(); wrapperUC.eq("coupon_id", id); userCouponMapper.delete(wrapperUC); return true; }
Example 6
Source File: SiteServiceImpl.java From mysiteforme with Apache License 2.0 | 5 votes |
@Cacheable(value = "currentSite",key = "'currentSite'") @Override public Site getCurrentSite() { EntityWrapper<Site> wrapper = new EntityWrapper<>(); wrapper.eq("del_flag",false); return selectOne(wrapper); }
Example 7
Source File: QiniuUploadServiceImpl.java From mysiteforme with Apache License 2.0 | 5 votes |
@Override public String uploadNetFile(String url) throws IOException, NoSuchAlgorithmException { String fileName = RandomUtil.randomUUID(); EntityWrapper<Rescource> wrapper = new EntityWrapper<>(); wrapper.eq("source","qiniu"); wrapper.eq("original_net_url",url); wrapper.eq("del_flag",false); Rescource rescource = rescourceService.selectOne(wrapper); if(rescource != null){ return rescource.getWebUrl(); } StringBuffer key = new StringBuffer(); StringBuffer returnUrl = new StringBuffer(getUploadInfo().getQiniuBasePath()); try { String qiniuDir = getUploadInfo().getQiniuDir(); if(StringUtils.isNotBlank(qiniuDir)){ key.append(qiniuDir).append("/"); returnUrl.append(qiniuDir).append("/"); } key.append(fileName); returnUrl.append(fileName); FetchRet fetchRet = getBucketManager().fetch(url, getUploadInfo().getQiniuBucketName(),key.toString()); rescource = new Rescource(); rescource.setFileName(fetchRet.key); rescource.setFileSize(new java.text.DecimalFormat("#.##").format(fetchRet.fsize/1024)+"kb"); rescource.setHash(fetchRet.hash); rescource.setFileType(fetchRet.mimeType); rescource.setWebUrl(returnUrl.toString()); rescource.setSource("qiniu"); rescource.setOriginalNetUrl(url); rescource.insert(); } catch (QiniuException e) { e.printStackTrace(); } return returnUrl.toString(); }
Example 8
Source File: RescourceController.java From mysiteforme with Apache License 2.0 | 5 votes |
@RequiresPermissions("sys:rescource:list") @PostMapping("list") @ResponseBody public LayerData<Rescource> list(@RequestParam(value = "page",defaultValue = "1")Integer page, @RequestParam(value = "limit",defaultValue = "10")Integer limit, ServletRequest request){ Map map = WebUtils.getParametersStartingWith(request, "s_"); LayerData<Rescource> layerData = new LayerData<>(); EntityWrapper<Rescource> wrapper = new EntityWrapper<>(); if(!map.isEmpty()){ String type = (String) map.get("type"); if(StringUtils.isNotBlank(type)) { wrapper.like("file_type", type); } String hash = (String)map.get("hash"); if(StringUtils.isNotBlank(hash)){ wrapper.eq("hash",hash); } String source = (String)map.get("source"); if(StringUtils.isNotBlank(source)){ wrapper.eq("source",source); } } Page<Rescource> dataPage = rescourceService.selectPage(new Page<>(page,limit),wrapper); layerData.setCount(dataPage.getTotal()); layerData.setData(dataPage.getRecords()); return layerData; }
Example 9
Source File: SysTenantServiceImpl.java From cola-cloud with MIT License | 5 votes |
private void assertDuplication(SysTenant sysTenant){ EntityWrapper<SysTenant> wrapper = this.newEntityWrapper(); wrapper.eq("code",sysTenant.getCode()); if(sysTenant.getId() != null){ wrapper.ne("id",sysTenant.getId()); } Assert.isTrue(CollectionUtils.isEmpty(this.selectList(wrapper)),"租户编号已存在"); }
Example 10
Source File: DictServiceImpl.java From mysiteforme with Apache License 2.0 | 5 votes |
@Override public Integer getCountByAll(String type, String label, String value) { EntityWrapper<Dict> wrapper = new EntityWrapper<>(); wrapper.eq("type",type); if(StringUtils.isNotBlank(label)){ wrapper.eq("label",label); } if(StringUtils.isNotBlank(value)){ wrapper.eq("value",value); } wrapper.eq("del_flag",false); return selectCount(wrapper); }
Example 11
Source File: UserServiceImpl.java From app-version with Apache License 2.0 | 5 votes |
@Override public ServiceResult register(String phone, String password) { if (StringUtilsExt.hasEmpty(password, phone)) { return ServiceResultConstants.NEED_PARAMS; } EntityWrapper<User> userEntityWrapper = new EntityWrapper<>(); userEntityWrapper.eq("phone", phone); Integer integer = userMapper.selectCount(userEntityWrapper); if (integer > 0) { return ServiceResultConstants.USER_EXISTS; } Integer count = userMapper.selectCount(new EntityWrapper<>()); User user = new User(); if (count > 0) { user.setIsAdmin(0); } else { user.setIsAdmin(1); } user.setUserId($.field.createUUID()); user.setFirstLoginTime(new Date()); user.setPhone(phone); user.setNickName(phone); try { String md5 = $.security.digest.digest(password + phone, ALGORITHM); // 加盐算法 user.setPassword(md5); Integer insert = userMapper.insert(user); if (insert > 0) { return ServiceResult.ok(null); } else { return ServiceResultConstants.DB_ERROR; } } catch (NoSuchAlgorithmException e) { logger.error("密码加密出错", e); return ServiceResultConstants.ERROR_500; } }
Example 12
Source File: MenuServiceImpl.java From mysiteforme with Apache License 2.0 | 5 votes |
@Override public List<ZtreeVO> showTreeMenus() { EntityWrapper<Menu> wrapper = new EntityWrapper<>(); wrapper.eq("del_flag",false); wrapper.eq("is_show",true); wrapper.orderBy("sort",false); List<Menu> totalMenus = baseMapper.selectList(wrapper); List<ZtreeVO> ztreeVOs = Lists.newArrayList(); return getZTree(null,totalMenus,ztreeVOs); }
Example 13
Source File: GlobalFunction.java From express-ssm with Apache License 2.0 | 5 votes |
/** * 构造筛选条件 * @author jitwxs * @since 2018/5/13 15:50 */ public EntityWrapper<Express> getExpressWrapper(ExpressSelectWrapper esw) { EntityWrapper<Express> entityWrapper = new EntityWrapper<>(); // 前台传递,状态-1表示所有状态 if(esw.getStatus() != null && esw.getStatus() != -1) { entityWrapper.eq("status", esw.getStatus()); } if(StringUtils.isNotBlank(esw.getId())) { entityWrapper.eq("id", esw.getId()); } if(StringUtils.isNotBlank(esw.getTel())){ entityWrapper.eq("tel", esw.getTel()); } if(StringUtils.isNotBlank(esw.getName())){ entityWrapper.like("name", esw.getName()); } if(StringUtils.isNotBlank(esw.getStaffName())){ SysUser user = userService.getByUserName(esw.getStaffName()); entityWrapper.eq("staff", user.getId()); } if(StringUtils.isNotBlank(esw.getAddress())){ entityWrapper.like("address", esw.getAddress()); } if(esw.getHasDelete() != null) { entityWrapper.eq("has_delete", esw.getHasDelete()); } if(esw.getIncludeDay() != null && esw.getIncludeDay() != -1) { Date nowDate = new Date(); Date startDate = DateUtils.addDays(nowDate,-1 * esw.getIncludeDay()); entityWrapper.between("create_date", startDate, nowDate); } if(esw.getStartDate() != null && esw.getEndDate() != null) { entityWrapper.between("create_date", esw.getStartDate(), esw.getEndDate()); } return entityWrapper; }
Example 14
Source File: DictServiceImpl.java From mysiteforme with Apache License 2.0 | 5 votes |
@CacheEvict(value = "dictCache",key = "#type",beforeInvocation = false) @Transactional(readOnly = false, rollbackFor = Exception.class) @Override public void deleteByType(String type) { EntityWrapper<Dict> wrapper = new EntityWrapper<>(); wrapper.eq("type",type); delete(wrapper); }
Example 15
Source File: SysAuthorizeServiceImpl.java From cola-cloud with MIT License | 5 votes |
@Override public List<SysAuthorize> getAuthorizesByTargetAndType(Long target,String type){ EntityWrapper<SysAuthorize> wrapper = this.newEntityWrapper(); wrapper.eq("authorize_target",target); wrapper.eq("authorize_type",type); return this.selectList(wrapper); }
Example 16
Source File: UploadInfoServiceImpl.java From mysiteforme with Apache License 2.0 | 5 votes |
@Cacheable(value = "uploadInfoCache",key = "'getinfo'",unless = "#result == null") @Override public UploadInfo getOneInfo() { EntityWrapper<UploadInfo> wrapper = new EntityWrapper<>(); wrapper.eq("del_flag",false); return selectOne(wrapper); }
Example 17
Source File: BlogArticleController.java From mysiteforme with Apache License 2.0 | 4 votes |
@RequiresPermissions("blog:article:list") @PostMapping("list") @ResponseBody public LayerData<BlogArticle> list(@RequestParam(value = "page",defaultValue = "1")Integer page, @RequestParam(value = "limit",defaultValue = "10")Integer limit, ServletRequest request){ Map<String,Object> map = WebUtils.getParametersStartingWith(request, "s_"); LayerData<BlogArticle> layerData = new LayerData<>(); EntityWrapper<BlogArticle> wrapper = new EntityWrapper<>(); wrapper.eq("del_flag",false); if(!map.isEmpty()){ String title = (String) map.get("title"); if(StringUtils.isBlank(title)) { map.remove("title"); } String category = (String) map.get("category"); if(StringUtils.isBlank(category)) { map.remove("category"); } String beginPublistTime = (String) map.get("beginPublistTime"); String endPublistTime = (String) map.get("endPublistTime"); if(StringUtils.isNotBlank(beginPublistTime)) { Date begin = DateUtil.parse(beginPublistTime); map.put("publist_time",begin); }else{ map.remove("beginPublistTime"); } if(StringUtils.isNotBlank(endPublistTime)) { Date end = DateUtil.parse(endPublistTime); map.put("publist_time",end); }else{ map.remove("endPublistTime"); } String content = (String) map.get("content"); if(StringUtils.isBlank(content)) { map.remove("content"); } String channelId = (String) map.get("channelId"); if(StringUtils.isBlank(channelId)){ map.remove("channelId"); } } Page<BlogArticle> pageData = blogArticleService.selectDetailArticle(map,new Page<>(page,limit)); layerData.setData(pageData.getRecords()); layerData.setCount(pageData.getTotal()); return layerData; }
Example 18
Source File: RoleServiceImpl.java From mysiteforme with Apache License 2.0 | 4 votes |
@Override public Integer getRoleNameCount(String name) { EntityWrapper<Role> wrapper = new EntityWrapper<>(); wrapper.eq("name",name); return baseMapper.selectCount(wrapper); }
Example 19
Source File: BlogCommentController.java From mysiteforme with Apache License 2.0 | 4 votes |
@RequiresPermissions("blog:comment:list") @PostMapping("list") @ResponseBody public LayerData<BlogComment> list(@RequestParam(value = "page",defaultValue = "1")Integer page, @RequestParam(value = "limit",defaultValue = "10")Integer limit, ServletRequest request){ Map map = WebUtils.getParametersStartingWith(request, "s_"); LayerData<BlogComment> layerData = new LayerData<>(); EntityWrapper<BlogComment> wrapper = new EntityWrapper<>(); wrapper.eq("del_flag",false); if(!map.isEmpty()){ String content = (String) map.get("content"); if(StringUtils.isNotBlank(content)) { wrapper.like("content",content); }else{ map.remove("content"); } String ip = (String) map.get("ip"); if(StringUtils.isNotBlank(ip)) { wrapper.like("ip",ip); }else{ map.remove("ip"); } String isAdminReply = (String) map.get("isAdminReply"); if(StringUtils.isNotBlank(isAdminReply)) { if(isAdminReply.equalsIgnoreCase("true")){ wrapper.eq("is_admin_reply",true); }else if(isAdminReply.equalsIgnoreCase("false")){ wrapper.eq("is_admin_reply",false); }else{ map.remove("isAdminReply"); } }else{ map.remove("isAdminReply"); } } Page<BlogComment> pageData = blogCommentService.selectPage(new Page<>(page,limit),wrapper); layerData.setData(pageData.getRecords()); layerData.setCount(pageData.getTotal()); return layerData; }
Example 20
Source File: SysPostServiceImpl.java From cola-cloud with MIT License | 4 votes |
/** * 判断是否分配给员工 * * @param id */ private void assertUsedByEmployee(Serializable id) { EntityWrapper<SysEmployee> wrapper = new EntityWrapper<>(); wrapper.eq("sys_post_id", id); Assert.isTrue(CollectionUtils.isEmpty(this.sysEmployeeMapper.selectList(wrapper)), "岗位已分配给员工,无法删除"); }