org.hsweb.web.bean.common.QueryParam类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.hsweb.web.bean.common.QueryParam类的一些代码示例,展示了QueryParam类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryParam类的具体详情如下:
包路径:org.hsweb.web.bean.common.QueryParam
类名称:QueryParam

QueryParam介绍

暂无

代码示例

代码示例来源:origin: org.hsweb/hsweb-web-service-api

default UserProfile selectByUserIdAndType(String userId, String type) {
    return selectSingle(QueryParam.build().where("userId", userId).and("type", type));
  }
}

代码示例来源:origin: org.hsweb/hsweb-web-service-api

default List<ModuleMeta> selectByKey(String key) {
  QueryParam queryParam = new QueryParam();
  queryParam.where("key", key);
  return this.select(queryParam);
}

代码示例来源:origin: org.hsweb/hsweb-web-service-api

/**
 * 查询只返回单个结果
 *
 * @param param 查询条件
 * @return 单个结果
 * @see this#select(QueryParam)
 */
default Po selectSingle(QueryParam param) {
  param.doPaging(0, 1);
  List<Po> list = this.select(param);
  if (list.size() == 0) return null;
  else return list.get(0);
}

代码示例来源:origin: org.hsweb/hsweb-web-controller

@RequestMapping(value = "/type/{type}", method = RequestMethod.GET)
@AccessLogger("当前用户对应的类型")
public ResponseMessage byLoginUserAndType(@PathVariable("type") String type) {
  User user = WebUtil.getLoginUser();
  // where type=#{type} and (create_id=#{user.id} or sharing=1)
  QueryParam param = QueryParam.build().noPaging();
  param.where("type", type)
      .nest("creatorId", user.getId()).or("sharing", 1);
  return ResponseMessage.ok(queryPlanService.select(param)).onlyData();
}

代码示例来源:origin: org.hsweb/hsweb-web-controller

/**
 * 获取最新版本的表单列表
 *
 * @param param 查询参数
 * @return {@link GenericController#list(QueryParam)}
 */
@RequestMapping(value = "/~latest", method = RequestMethod.GET)
@AccessLogger("获取最新版列表")
public ResponseMessage latestList(QueryParam param) {
  ResponseMessage message;
  if (!param.isPaging()) {
    message = ok(formService.selectLatestList(param));
  } else {
    param.setPaging(false);
    int total = formService.countLatestList(param);
    param.rePaging(total);
    List<Form> list = formService.selectLatestList(param);
    PagerResult<Form> result = new PagerResult<>();
    result.setData(list).setTotal(total);
    message = ok(result);
  }
  message.include(Form.class, param.getIncludes())
      .exclude(Form.class, param.getExcludes())
      .onlyData();
  return message;
}

代码示例来源:origin: org.hsweb/hsweb-web-controller

/**
 * 根据类型查询分类 {@link GenericController#list(QueryParam)}
 * 已过时,在正式版中删除 todo
 *
 * @param type  分类类型
 * @param param 查询参数
 * @return 查询结果
 */
@RequestMapping(value = "/byType/{type}")
@Deprecated
@AccessLogger(value = "根据类别请求", describe = "已弃用")
public ResponseMessage listByTypeOld(@PathVariable("type") String type, QueryParam param) {
  param.where("type", type);
  return list(param);
}

代码示例来源:origin: org.hsweb/hsweb-web-dao-mybatis

public String buildOrder(String resultMapId, String tableName, QueryParam param) throws Exception {
  Map<String, Object> fieldConfig = createConfig(resultMapId);
  QueryParam tmp = new QueryParam();
  tmp.setSorts(param.getSorts());
  Map<String, String> propertyMapper = getPropertyMapper(fieldConfig, tmp);
  if (tmp.getSorts().isEmpty()) return "";
  Set<Sort> sorts = new LinkedHashSet<>();
  param.getSorts().forEach(sort -> {
    String fieldName = sort.getName();
    if (StringUtils.isNullOrEmpty(fieldName)) return;

代码示例来源:origin: org.hsweb/hsweb-web-service-api

/**
   * 指定一个dao映射接口,接口需继承{@link GenericMapper}创建dsl数据查询对象<br>
   * 可通过返回的Query对象进行dsl方式操作如:<br>
   * <code>
   * createQuery(userMapper).where("id",1).single();
   * </code>
   *
   * @param mapper dao映射结构
   * @param <PO>   PO泛型
   * @param <PK>   主键泛型
   * @return {@link Query}
   * @see Query
   * @see org.hsweb.ezorm.core.Conditional
   * @since 2.2
   */
  static <PO, PK> Query<PO, QueryParam> createQuery(GenericMapper<PO, PK> mapper) {
    Query<PO, QueryParam> query = new Query<>(new QueryParam());
    query.setListExecutor(mapper::select);
    query.setTotalExecutor(mapper::total);
    query.setSingleExecutor((param) -> {
      param.doPaging(0, 1);
      List<PO> list = mapper.select(param);
      if (null == list || list.size() == 0) return null;
      else return list.get(0);
    });
    return query;
  }
}

代码示例来源:origin: org.hsweb/hsweb-web-service-simple

@Override
@ReadLock
@LockName(value = "'form.lock.'+#name", isExpression = true)
@Transactional(readOnly = true)
public <T> PagerResult<T> selectPager(String name, QueryParam param) throws SQLException {
  PagerResult<T> result = new PagerResult<>();
  RDBTable<T> table = getTableByName(name);
  RDBQuery<T> query = table.createQuery();
  query.setParam(param);
  int total = query.total();
  result.setTotal(total);
  if (total == 0) {
    result.setData(new ArrayList<>());
  } else {
    //根据实际记录数量重新指定分页参数
    param.rePaging(total);
    result.setData(query.list(param.getPageIndex(), param.getPageSize()));
  }
  return result;
}

代码示例来源:origin: org.hsweb/hsweb-web-service-simple

@Override
default PagerResult<Po> selectPager(QueryParam param) {
  PagerResult<Po> pagerResult = new PagerResult<>();
  param.setPaging(false);
  int total = getQueryMapper().total(param);
  pagerResult.setTotal(total);
  if (total == 0) {
    pagerResult.setData(new ArrayList<>());
  } else {
    //根据实际记录数量重新指定分页参数
    param.rePaging(total);
    pagerResult.setData(getQueryMapper().select(param));
  }
  return pagerResult;
}

代码示例来源:origin: org.hsweb/hsweb-web-service-api

/**
 * 创建本服务的dsl查询操作对象
 * 可通过返回的Query对象进行dsl方式操作如:<br>
 * <code>
 * createQuery().where("id",1).single();
 * </code>
 *
 * @return {@link Query}
 * @see Query
 * @see org.hsweb.ezorm.core.Conditional
 * @since 2.2
 */
default Query<Po, QueryParam> createQuery() {
  Query<Po, QueryParam> query = Query.empty(new QueryParam());
  query.setListExecutor(this::select);
  query.setTotalExecutor(this::total);
  query.setSingleExecutor(this::selectSingle);
  return query;
}

代码示例来源:origin: org.hsweb/hsweb-web-service-simple

@Override
public PagerResult<QuartzJobHistory> selectPager(QueryParam param) {
  PagerResult<QuartzJobHistory> result = new PagerResult<>();
  int total = total(param);
  result.setTotal(total);
  param.rePaging(total);
  result.setData(select(param));
  return result;
}

代码示例来源:origin: org.hsweb/hsweb-web-controller

@Override
public ResponseMessage list(QueryParam param) {
  param.excludes(password);
  return super.list(param)
      .exclude(User.class, password, modules, userRoles)
      .onlyData();
}

代码示例来源:origin: org.hsweb/hsweb-web-controller

/**
   * 根据类型查询分类 {@link GenericController#list(QueryParam)}
   *
   * @param type  分类类型
   * @param param 查询参数
   * @return 查询结果
   */
  @RequestMapping(value = "/type/{type}")
  @AccessLogger("根据类别请求")
  public ResponseMessage listByType(@PathVariable("type") String type, QueryParam param) {
    param.where("type", type);
    return list(param);
  }
}

代码示例来源:origin: org.hsweb/hsweb-web-oauth2-controller

@RequestMapping(value = "/user", method = RequestMethod.GET)
@AccessLogger("获取当前用户持有的客户端信息")
@Authorize
protected ResponseMessage loginUserClient() {
  User user = WebUtil.getLoginUser();
  OAuth2Client client = oAuth2ClientService.selectSingle(QueryParam.build().where("userId", user.getId()));
  if (client == null) {
    throw new NotFoundException("未绑定客户端");
  }
  return ResponseMessage.ok(client);
}

代码示例来源:origin: org.hsweb/hsweb-web-service-simple

@Override
  public List<Module> selectByPid(String pid) throws Exception {
    return this.select(new QueryParam().where("parentId", pid));
  }
}

代码示例来源:origin: org.hsweb/hsweb-web-controller

@RequestMapping(value = "/history/{jobId}", method = RequestMethod.GET)
@AccessLogger("执行历史")
@Authorize(action = "history")
public ResponseMessage history(@PathVariable("jobId") String jobId, QueryParam param) {
  param.where("jobId", jobId);
  return ResponseMessage.ok(quartzJobHistoryService.selectPager(param)).onlyData();
}

代码示例来源:origin: org.hsweb/hsweb-web-service-simple

@Override
public String insert(DynamicScript data) {
  DynamicScript old = selectSingle(QueryParam.build().where("name", data.getName()).and("type", data.getType()));
  if (old != null) throw new BusinessException("已存在相同名称和类型的脚本!", 400);
  data.setStatus(1);
  return super.insert(data);
}

代码示例来源:origin: org.hsweb/hsweb-web-service-simple

/**
 * 根据资源md5 查询资源信息
 *
 * @param md5 md5值
 * @return 资源对象
 * @throws Exception
 */
@Cacheable(value = CACHE_KEY, key = "'md5.'+#md5")
@Transactional(readOnly = true)
public Resources selectByMd5(String md5) {
  return this.selectSingle(new QueryParam().where("md5", md5));
}

代码示例来源:origin: org.hsweb/hsweb-web-oauth2-controller

@RequestMapping(value = "/secret", method = RequestMethod.PUT)
@AccessLogger("刷新当前用户密钥")
@Authorize
protected ResponseMessage refreshLoginUserSecret() {
  User user = WebUtil.getLoginUser();
  OAuth2Client client = oAuth2ClientService.selectSingle(QueryParam.build().where("userId", user.getId()));
  if (client == null) {
    throw new NotFoundException("未绑定客户端");
  }
  return ResponseMessage.ok(oAuth2ClientService.refreshSecret(client.getId()));
}

相关文章