通用Mapper的select(T t)的使用

通用mapper类:

public interface CategoryMapper extends Mapper<Category> {
}

使用select(T t)

public List<Category> queryCategoryListByParentId(Long pid) {
	// select(T t) 将对象c中的非空字段当作查询的条件参数
	Category record = new Category();
	record.setParentId(pid);
	return this.categoryMapper.select(record);
}

select(T t) 将实例对象t中的非空字段作为条件参数
上面实例转换的sql语句:select * from category c where c.pid = #{pid}

猜你喜欢

转载自blog.csdn.net/tian_ci/article/details/85138467
T