717 Star 2.8K Fork 763

abel533 / Mapper

 / 详情

selectByExample报错,提示没有distinct属性

已完成
创建于  
2018-06-05 11:38

Example example = new Example(CountryAreaBo.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("deletedFlag", CommonConstant.DELETED_NO);
return countryAreaDao. selectByExample (criteria);

public String selectByExample(MappedStatement ms) {
Class<?> entityClass = this.getEntityClass(ms);
this.setResultType(ms, entityClass);
StringBuilder sql = new StringBuilder("SELECT ");
if (this.isCheckExampleEntityClass()) {
sql.append(SqlHelper.exampleCheck(entityClass));
}

     **sql.append("<if test=\"distinct\">distinct</if>");** 
    sql.append(SqlHelper.exampleSelectColumns(entityClass));
    sql.append(SqlHelper.fromTable(entityClass, this.tableName(entityClass)));
    sql.append(SqlHelper.exampleWhereClause());
    sql.append(SqlHelper.exampleOrderBy(entityClass));
    sql.append(SqlHelper.exampleForUpdate());
    return sql.toString();
}

There is no getter for property named 'distinct' in 'class tk.mybatis.mapper.entity.Example$Criteria'

评论 (1)

charlee 创建了任务

你用错参数了,应该写 selectByExample(example)

abel533 关闭了任务

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
8363 free 1578914558 1049642 wjc666 1578939113
Java
1
https://gitee.com/free/Mapper.git
git@gitee.com:free/Mapper.git
free
Mapper
Mapper

搜索帮助