714 Star 3.3K Fork 2.2K

人人开源 / renren-generator

new Query<${className}Entity>().getPage(params) 报错 ,Query不能传入一个

Backlog
王力  Opened this issue

import ${mainPath}.common.utils.Query;

import ${package}.${moduleName}.dao.${className}Dao;
import ${package}.${moduleName}.entity.${className}Entity;
import ${package}.${moduleName}.service.${className}Service;

@Service("${classname}Service")
public class ${className}ServiceImpl extends ServiceImpl<${className}Dao, ${className}Entity> implements ${className}Service {

@Override
public PageUtils queryPage(Map<String, Object> params) {
    IPage<${className}Entity> page = this.page(
            new Query<${className}Entity>().getPage(params),
            new QueryWrapper<${className}Entity>()
    );

    return new PageUtils(page);
}

}

public class Query extends LinkedHashMap<String, Object> {
private static final long serialVersionUID = 1L;
//当前页码
private int page;
//每页条数
private int limit;

 public Query(Map<String, Object> params){
    this.putAll(params);

    //分页参数
    this.page = Integer.parseInt(params.get("page").toString());
    this.limit = Integer.parseInt(params.get("limit").toString());
    this.put("offset", (page - 1) * limit);
    this.put("page", page);
    this.put("limit", limit);
}


public int getPage() {
    return page;
}

public void setPage(int page) {
    this.page = page;
}

public int getLimit() {
    return limit;
}

public void setLimit(int limit) {
    this.limit = limit;
}

}

1684253 hundanli 1578957676 total 5 participants

Comments (4)

1684253 hundanli 1578957676
~浑蛋~ 2020-05-10 12:48

应该复制一份renren-fast项目中的相关类到生成好的项目里边,比如上面使用到的Query类

IT瑞文 2020-05-11 11:15

这个解决了吗

杜建超 2020-05-18 17:34

这个怎么处理啊 我这也报错

xiongqiang521 2020-06-04 16:31

生成的PageUtils、Query对应的类是renren-fast项目中common.utils中的工具类,不是 renren-generator项目中的工具类

+1 9
-1 1

Sign in to comment

Assignees
Labels
Not set
Projects
Milestones
Branches
Planed to start
Not set
Planed to end
Not set
Top level
Priority
Java
1
https://gitee.com/renrenio/renren-generator.git
git@gitee.com:renrenio/renren-generator.git
renrenio
renren-generator
renren-generator

Search