/** * * @author shenjing * @date 2018/6/20 * * @Servicepublic class Localdispatchserviceimpl extends Serviceimpl<rep_disp Atchdao, Rep_dispatch> implements Localdispatchservice {/** * based on the domain combination of various types of queries, the general query can be completed through this, DAO completely does not exist the meaning of * * @param domain * @return */@Override public rep_dispatch findonebydomain (rep_dispatch domain) { entitywrapper<rep_dispatch> ewrapper = new entitywrapper<> (domain); Return SelectOne (Ewrapper); /** * Query According to paging parameters * * @param dispatchpageparam * @return */@Override public Page<rep_dis Patch> findlistbypage (Dispatchpageparam dispatchpageparam) {page<rep_dispatch> Page = new Page<> (di Spatchpageparam.getstartindex (), dispatchpageparam.getpagesize ()); entitywrapper<rep_dispatch> ewrapper = new entitywrapper<> (Dispatchpageparam.getobj ()); page<rep_dispatch> ret = selectpage (page, ewrapper); return ret; }}
Here, Serviceimpl, is a base class provided by Mybatisplus.
Dispatchpageparam is a package of query parameters written by himself
/** * Basic Paging parameters * @author shenjing * @date 2018/6/20 */public class Basepageparam<t> { T obj; int startIndex; int pageSize; Public T Getobj () { return obj; } public void Setobj (T obj) { this.obj = obj; } public int Getstartindex () { return startIndex; } public void Setstartindex (int startIndex) { this.startindex = StartIndex; } public int getpagesize () { return pageSize; } public void setpagesize (int pageSize) { this.pagesize = pageSize; }}
Actually, there's nothing in this, just inherit the base class.
/** * Created by shenjing on 2018/6/20. */public class Dispatchpageparam extends Basepageparam<rep_dispatch> {}
Mybatisplus's generic query can simply discard DAO and mapper.xml