com.baomidou.mybatisplus.core.toolkit.ObjectUtils Java Examples
The following examples show how to use
com.baomidou.mybatisplus.core.toolkit.ObjectUtils.
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: SmsRecordServiceImpl.java From hdw-dubbo with Apache License 2.0 | 6 votes |
public PageVo selectSmsRecordPageList(SmsRecordDTO smsRecordDTO) { QueryWrapper<SmsRecord> wrapper = new QueryWrapper(smsRecordDTO); wrapper.like(ObjectUtils.isNotEmpty(smsRecordDTO.getUserName()), "t3.name", smsRecordDTO.getUserName()) .ge(ObjectUtils.isNotEmpty(smsRecordDTO.getStartTime()), "t.push_time", smsRecordDTO.getStartTime()) .le(ObjectUtils.isNotEmpty(smsRecordDTO.getEndTime()), "t.push_time", smsRecordDTO.getEndTime()) .eq(ObjectUtils.isNotEmpty(smsRecordDTO.getUserId()), "t.user_id", smsRecordDTO.getUserId()); if (ObjectUtils.isNotEmpty(smsRecordDTO.getStatus())){ if(smsRecordDTO.getStatus() == "-1"){ wrapper.and(i -> i.ne("t.status", "0").ne("t.status", "3")); }else{ wrapper.eq(ObjectUtils.isNotEmpty(smsRecordDTO.getStatus()), "t.status", smsRecordDTO.getStatus()); } } wrapper.orderByDesc("t.push_time"); Page page = new Page(); // 设置当前页码 page.setCurrent(smsRecordDTO.getPage()); // 设置页大小 page.setSize(smsRecordDTO.getLimit()); IPage ipage = this.baseMapper.selectSmsRecordPageList(page, wrapper); return new PageVo(ipage); }
Example #2
Source File: EntityMap.java From open-cloud with MIT License | 6 votes |
public EntityMap put(String key, Object value) { /* List<Object> dictKeys = redisUtils.getList("DICT_KEYS"); *//*判断字段是否是字典类型*//* if (dictKeys.contains(key) && ObjectUtils.isNotEmpty(value)) { Object dictValue = dataMaps.get(key + "_" + value.toString()); *//*返回数据中添加字典显示值*//* super.put(key + "Title", dictValue); }*/ if (ObjectUtils.isNotEmpty(interceptors)) { interceptors.convert(this, key, value); } if (ObjectUtils.isNotNull(value)) { super.put(key, value); } else { super.put(key, ""); } return this; }
Example #3
Source File: BaseAppServiceImpl.java From open-cloud with MIT License | 6 votes |
/** * 查询应用列表 * * @param pageParams * @return */ @Override public IPage<BaseApp> findListPage(PageParams pageParams) { BaseApp query = pageParams.mapToObject(BaseApp.class); CriteriaQuery<BaseApp> cq = new CriteriaQuery(pageParams); cq.lambda() .eq(ObjectUtils.isNotEmpty(query.getDeveloperId()), BaseApp::getDeveloperId, query.getDeveloperId()) .eq(ObjectUtils.isNotEmpty(query.getAppType()), BaseApp::getAppType, query.getAppType()) .eq(ObjectUtils.isNotEmpty(pageParams.getRequestMap().get("aid")), BaseApp::getAppId, pageParams.getRequestMap().get("aid")) .likeRight(ObjectUtils.isNotEmpty(query.getAppName()), BaseApp::getAppName, query.getAppName()) .likeRight(ObjectUtils.isNotEmpty(query.getAppNameEn()), BaseApp::getAppNameEn, query.getAppNameEn()); cq.select("app.*,developer.user_name"); //关联BaseDeveloper表 cq.createAlias(BaseDeveloper.class); cq.orderByDesc("create_time"); return pageList(cq); }
Example #4
Source File: BaseServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 自定义sql查询List<EntityMap> */ public List<EntityMap> selectListEntityMap(EntityMap map) { if (ObjectUtils.isEmpty(map)) { return null; } return sqlSession.selectList(getMapperName() + "selectListEntityMapByMap", map); }
Example #5
Source File: SysSmsServiceImpl.java From hdw-dubbo with Apache License 2.0 | 5 votes |
public PageVo selectSmsPageList(SmsDTO smsDTO) { QueryWrapper<SysSms> queryWrapper = new QueryWrapper<>(); queryWrapper.lambda() .like(ObjectUtils.isNotEmpty(smsDTO.getTitle()), SysSms::getTitle, smsDTO.getTitle()) .eq(ObjectUtils.isNotEmpty(smsDTO.getSmsTypeId()), SysSms::getSmsTypeId, smsDTO.getSmsTypeId()); queryWrapper.like(ObjectUtils.isNotEmpty(smsDTO.getTypeName()), "t2.type_name", smsDTO.getTypeName()); queryWrapper.orderByDesc("create_time"); Page page = new Page(); // 设置当前页码 page.setCurrent(smsDTO.getPage()); // 设置页大小 page.setSize(smsDTO.getLimit()); IPage ipage = this.baseMapper.selectSmsPageList(page, queryWrapper); return new PageVo(ipage); }
Example #6
Source File: SmsTypeServiceImpl.java From hdw-dubbo with Apache License 2.0 | 5 votes |
public PageVo selectSmsTypePageList(SmsTypeDTO smsTypeDTO) { QueryWrapper<SmsType> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .like(ObjectUtils.isNotEmpty(smsTypeDTO.getTypeName()), SmsType::getTypeName, smsTypeDTO.getTypeName()); queryWrapper.orderByDesc("create_time"); Page page = new Page(); // 设置当前页码 page.setCurrent(smsTypeDTO.getPage()); // 设置页大小 page.setSize(smsTypeDTO.getLimit()); IPage ipage = this.baseMapper.selectPage(page, queryWrapper); return new PageVo(ipage); }
Example #7
Source File: RedisUtils.java From open-cloud with MIT License | 5 votes |
/** * 普通缓存获取 * * @param key 键 * @return 值 */ public String getString(String key) { String str=""; Object obj=redisTemplate.opsForValue().get(key); if(ObjectUtils.isNotNull(obj)){ str=obj.toString(); } return key == null ? null :str; }
Example #8
Source File: EntityMap.java From open-cloud with MIT License | 5 votes |
@SuppressWarnings("unchecked") public <T> T get(String key, T def) { Object obj = super.get(key); if (ObjectUtils.isNotEmpty(obj)) { return (T) obj; } else { return def; } }
Example #9
Source File: EntityMap.java From open-cloud with MIT License | 5 votes |
@SuppressWarnings("unchecked") public <T> T get(String key) { T t = null; Object obj = super.get(key); if (ObjectUtils.isNotEmpty(obj)) { t = (T) obj; } return t; }
Example #10
Source File: CriteriaQuery.java From open-cloud with MIT License | 5 votes |
public String getSelect() { StringBuffer str = new StringBuffer(); String sqlSelect = getSqlSelect(); if (ObjectUtils.isNotEmpty(sqlSelect)) { select.add(String.join(",", sqlSelect)); } if (CollectionUtils.isEmpty(select)) { select.add("*"); } return String.join(",", select); }
Example #11
Source File: CriteriaQuery.java From open-cloud with MIT License | 5 votes |
/** * 创建外键表关联对象,需要在mapper(xml)中编写join */ public void createAlias(Class cla) { TableAlias tableAlias = AnnotationUtils.getAnnotation(cla, TableAlias.class); if (ObjectUtils.isNotEmpty(tableAlias)) { this.aliasMap.put(tableAlias.value(), tableAlias.value()); } }
Example #12
Source File: CriteriaQuery.java From open-cloud with MIT License | 5 votes |
public CriteriaQuery(PageParams pageParams) { this.pageParams = pageParams; String sort = pageParams.getSort(); apply("1=1"); if (ObjectUtils.isNotEmpty(sort)) { //自动添加ordery by String order = pageParams.getOrder(); Boolean isAsc = StringUtils.equalsIgnoreCase(SqlKeyword.ASC.name(), order); sort = StringUtils.camelToUnderline(sort); orderBy(true, isAsc, sort); } }
Example #13
Source File: BaseServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 自定义sql查询List<EntityMap> */ public List<EntityMap> selectListEntityMap(String statement, EntityMap map) { if (ObjectUtils.isEmpty(map)) { return null; } return sqlSession.selectList(getMapperName() + statement, map); }
Example #14
Source File: BaseServiceImpl.java From open-cloud with MIT License | 5 votes |
public EntityMap getEntityMap(CriteriaQuery<?> cq) { List<EntityMap> maps = baseMapper.getEntityMap(cq); if (ObjectUtils.isEmpty(maps)) { //避免空对象输出"" return new EntityMap(); } return maps.get(0); }
Example #15
Source File: WebHookLogsServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<WebHookLogs> findListPage(PageParams pageParams) { WebHookLogs query = pageParams.mapToObject(WebHookLogs.class); QueryWrapper<WebHookLogs> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .likeRight(ObjectUtils.isNotEmpty(query.getUrl()), WebHookLogs::getUrl, query.getUrl()) .eq(ObjectUtils.isNotEmpty(query.getType()), WebHookLogs::getType, query.getType()) .eq(ObjectUtils.isNotEmpty(query.getResult()), WebHookLogs::getResult, query.getResult()); return webHookLogsMapper.selectPage(new Page(pageParams.getPage(), pageParams.getLimit()), queryWrapper); }
Example #16
Source File: GatewayAccessLogsServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<GatewayAccessLogs> findListPage(PageParams pageParams) { GatewayAccessLogs query = pageParams.mapToObject(GatewayAccessLogs.class); QueryWrapper<GatewayAccessLogs> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .likeRight(ObjectUtils.isNotEmpty(query.getPath()),GatewayAccessLogs::getPath, query.getPath()) .eq(ObjectUtils.isNotEmpty(query.getIp()),GatewayAccessLogs::getIp, query.getIp()) .eq(ObjectUtils.isNotEmpty(query.getServiceId()),GatewayAccessLogs::getServiceId, query.getServiceId()); queryWrapper.orderByDesc("request_time"); return gatewayLogsMapper.selectPage(pageParams,queryWrapper); }
Example #17
Source File: GatewayRateLimitServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<GatewayRateLimit> findListPage(PageParams pageParams) { GatewayRateLimit query = pageParams.mapToObject(GatewayRateLimit.class); QueryWrapper<GatewayRateLimit> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .likeRight(ObjectUtils.isNotEmpty(query.getPolicyName()),GatewayRateLimit::getPolicyName, query.getPolicyName()) .eq(ObjectUtils.isNotEmpty(query.getPolicyType()),GatewayRateLimit::getPolicyType, query.getPolicyType()); queryWrapper.orderByDesc("create_time"); return gatewayRateLimitMapper.selectPage(pageParams,queryWrapper); }
Example #18
Source File: BaseDeveloperServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<BaseDeveloper> findListPage(PageParams pageParams) { BaseDeveloper query = pageParams.mapToObject(BaseDeveloper.class); QueryWrapper<BaseDeveloper> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .eq(ObjectUtils.isNotEmpty(query.getUserId()), BaseDeveloper::getUserId, query.getUserId()) .eq(ObjectUtils.isNotEmpty(query.getUserType()), BaseDeveloper::getUserType, query.getUserType()) .eq(ObjectUtils.isNotEmpty(query.getUserName()), BaseDeveloper::getUserName, query.getUserName()) .eq(ObjectUtils.isNotEmpty(query.getMobile()), BaseDeveloper::getMobile, query.getMobile()); queryWrapper.orderByDesc("create_time"); return baseDeveloperMapper.selectPage(pageParams, queryWrapper); }
Example #19
Source File: TaskJobLogsServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<TaskJobLogs> findListPage(PageParams pageParams) { TaskJobLogs query = pageParams.mapToObject(TaskJobLogs.class); QueryWrapper<TaskJobLogs> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .likeRight(ObjectUtils.isNotEmpty(query.getJobName()), TaskJobLogs::getJobName, query.getJobName()); queryWrapper.orderByDesc("create_time"); return schedulerJobLogsMapper.selectPage(new Page(pageParams.getPage(),pageParams.getLimit()),queryWrapper); }
Example #20
Source File: BaseUserServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<BaseUser> findListPage(PageParams pageParams) { BaseUser query = pageParams.mapToObject(BaseUser.class); QueryWrapper<BaseUser> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .eq(ObjectUtils.isNotEmpty(query.getUserId()), BaseUser::getUserId, query.getUserId()) .eq(ObjectUtils.isNotEmpty(query.getUserType()), BaseUser::getUserType, query.getUserType()) .eq(ObjectUtils.isNotEmpty(query.getUserName()), BaseUser::getUserName, query.getUserName()) .eq(ObjectUtils.isNotEmpty(query.getMobile()), BaseUser::getMobile, query.getMobile()); queryWrapper.orderByDesc("create_time"); return baseUserMapper.selectPage(pageParams, queryWrapper); }
Example #21
Source File: GatewayIpLimitServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<GatewayIpLimit> findListPage(PageParams pageParams) { GatewayIpLimit query = pageParams.mapToObject(GatewayIpLimit.class); QueryWrapper<GatewayIpLimit> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .likeRight(ObjectUtils.isNotEmpty(query.getPolicyName()),GatewayIpLimit::getPolicyName, query.getPolicyName()) .eq(ObjectUtils.isNotEmpty(query.getPolicyType()),GatewayIpLimit::getPolicyType, query.getPolicyType()); queryWrapper.orderByDesc("create_time"); return gatewayIpLimitMapper.selectPage(pageParams,queryWrapper); }
Example #22
Source File: BaseRoleServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<BaseRole> findListPage(PageParams pageParams) { BaseRole query = pageParams.mapToObject(BaseRole.class); QueryWrapper<BaseRole> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .likeRight(ObjectUtils.isNotEmpty(query.getRoleCode()),BaseRole::getRoleCode, query.getRoleCode()) .likeRight(ObjectUtils.isNotEmpty(query.getRoleName()),BaseRole::getRoleName, query.getRoleName()); queryWrapper.orderByDesc("create_time"); return baseRoleMapper.selectPage(pageParams,queryWrapper); }
Example #23
Source File: BaseApiServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<BaseApi> findListPage(PageParams pageParams) { BaseApi query = pageParams.mapToObject(BaseApi.class); QueryWrapper<BaseApi> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .likeRight(ObjectUtils.isNotEmpty(query.getPath()), BaseApi::getPath, query.getPath()) .likeRight(ObjectUtils.isNotEmpty(query.getApiName()), BaseApi::getApiName, query.getApiName()) .likeRight(ObjectUtils.isNotEmpty(query.getApiCode()), BaseApi::getApiCode, query.getApiCode()) .eq(ObjectUtils.isNotEmpty(query.getServiceId()), BaseApi::getServiceId, query.getServiceId()) .eq(ObjectUtils.isNotEmpty(query.getStatus()), BaseApi::getStatus, query.getStatus()) .eq(ObjectUtils.isNotEmpty(query.getIsAuth()), BaseApi::getIsAuth, query.getIsAuth()); queryWrapper.orderByDesc("create_time"); return baseApiMapper.selectPage(pageParams, queryWrapper); }
Example #24
Source File: BaseApiServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 查询列表 * * @return */ @Override public List<BaseApi> findAllList(String serviceId) { QueryWrapper<BaseApi> queryWrapper = new QueryWrapper(); queryWrapper.lambda().eq(ObjectUtils.isNotEmpty(serviceId), BaseApi::getServiceId, serviceId); List<BaseApi> list = baseApiMapper.selectList(queryWrapper); return list; }
Example #25
Source File: BaseActionServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<BaseAction> findListPage(PageParams pageParams) { BaseAction query = pageParams.mapToObject(BaseAction.class); QueryWrapper<BaseAction> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .likeRight(ObjectUtils.isNotEmpty(query.getActionCode()), BaseAction::getActionCode, query.getActionCode()) .likeRight(ObjectUtils.isNotEmpty(query.getActionName()), BaseAction::getActionName, query.getActionName()); queryWrapper.orderByDesc("create_time"); return baseActionMapper.selectPage(new Page(pageParams.getPage(), pageParams.getLimit()), queryWrapper); }
Example #26
Source File: BaseMenuServiceImpl.java From open-cloud with MIT License | 5 votes |
/** * 分页查询 * * @param pageParams * @return */ @Override public IPage<BaseMenu> findListPage(PageParams pageParams) { BaseMenu query = pageParams.mapToObject(BaseMenu.class); QueryWrapper<BaseMenu> queryWrapper = new QueryWrapper(); queryWrapper.lambda() .likeRight(ObjectUtils.isNotEmpty(query.getMenuCode()), BaseMenu::getMenuCode, query.getMenuCode()) .likeRight(ObjectUtils.isNotEmpty(query.getMenuName()), BaseMenu::getMenuName, query.getMenuName()); return baseMenuMapper.selectPage(new Page(pageParams.getPage(), pageParams.getLimit()), queryWrapper); }
Example #27
Source File: Assert.java From supplierShop with MIT License | 4 votes |
public static void notNull(IErrorCode errorCode, Object... conditions) { if (ObjectUtils.isNull(conditions)) { Assert.fail(errorCode); } }
Example #28
Source File: Assert.java From supplierShop with MIT License | 4 votes |
public static void notEmpty(Object[] array, IErrorCode errorCode) { if (ObjectUtils.isEmpty(array)) { Assert.fail(errorCode); } }
Example #29
Source File: Assert.java From supplierShop with MIT License | 4 votes |
public static void notEmpty(Map<?, ?> map, IErrorCode errorCode) { if (ObjectUtils.isEmpty(map)) { Assert.fail(errorCode); } }
Example #30
Source File: CriteriaQuery.java From open-cloud with MIT License | 4 votes |
/** * likeRight */ @Override public QueryWrapper<T> likeRight(String column, Object val) { return likeRight(ObjectUtils.isNotEmpty(val), column, val); }