mybatis的sqlprovider用法扩展自定义sql

SqlProvider使用
public class MemberRewardSqlProvider {
    private static final Logger log = LoggerFactory.getLogger(EappShpstoreSqlProvider.class);

    public String selectByPage(MemberReward memberReward) {
        StringBuffer sb = new StringBuffer();
        sb.append("select * from member_reward where 1=1 and status != 'D'");
        if(memberReward.getShopstoreId() != null){
            sb.append(" and shopstore_id = "+memberReward.getShopstoreId());
        }
        log.debug("selectByPage:" + sb.toString());
        return sb.toString();
    }
}
public interface XXXXMapper{
    @SelectProvider(type = MemberRewardSqlProvider.class, method = "selectByPage")
    List<MemberReward> selectByPage(MemberReward memberReward, PageBounds pageBounds);
}

  

posted @ 2019-07-03 10:11  黑魔法os  阅读(3546)  评论(0编辑  收藏  举报