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); }