Mysql语句是:select * from Product as p order by p.addtime desc limit 6
Hibernate的DAO类中的语句是:from Product as p order by p.addtime desc limit 6
在mybtis映射可以这样写:
/**
* @version 创建时间:2018年4月19日17:03:35
* @introduction 主页查找最新的六条新闻
*/
@Select("select * from Makeup_news where mdelete=0 order by pubdate desc limit 6 ")
@Results(value={
@Result(column="newsid",property="newsid"),
@Result(column="content",property="content"),
@Result(one=@One(select="com.lnsf.warehouse.dao.Makeup_userDao.getOneUserByUserId"),column="userId",property="makeup_user"),
@Result(column="mdelete",property="mdelete"),
@Result(column="picture",property="picture"),
@Result(column="pointquantity",property="pointquantity"),
@Result(column="pubdate",property="pubdate"),
@Result(column="title",property="title"),
@Result(one=@One(select="com.lnsf.warehouse.dao.Makeup_newstypeDao.getOneNewstypebyTypeId"),column="typeid",property="makeup_newstype")
})
public List<Makeup_news> getSixNewsDescLimitTime();