(1)简单搭建方式
Mapper层
@Mapper
public interface HospitalSetMapper extends BaseMapper {
}
Service层接口
public interface HospitalSetService extends IService {
}
Service实现类
@Service
public class HospitalSetServiceImpl extends ServiceImpl implements HospitalSetService {
}
注意:原来service调用mappe需要把mapper注入到service,但是我们继承了ServiceImpl,里面已经帮助我们完成了注入,直接使用BaseMapper完成调用
Controller层
@RestController
@RequestMapping("/admin/hosp/hospitalSet")
public class HospitalSetController {
@Autowired
private HospitalSetService hospitalSetService;
}
在MyBatis-Plus不仅在Mapper中给我们封装了方法,在Service也进行了封装,在写代码是会非常的方便,直接通过controller去掉service中的方服务器托管网法,很方便的实现对数据库的操作
(2)复杂搭建方式
Mapper层
public interface AppUserMapper extends BaseMapper {
}
Service层接口
public interface BaseService extends IService {
}
实现类BaseServiceImpl
@Slf4j 继承了ServiceImpl,里面已经帮助我们完成了注入BaseMapper
public class BaseServiceImpl, T extends Object> extends ServiceImpl implements BaseService{
}
业务层公共接口
public interface IAppUserService extends BaseService {
}
业务层实现类AppUserServiceImpl
@Service
public class AppUserServiceImpl extends BaseServiceImpl
implements IAppUserService {
}
Controller层
@Slf4j
@Api(tags="App用户")
@RestController
@RequestMapping("/bus/user")
public class AppUserController extends BaseController {
@Autowired
private IAppUserService appUserService;
}
(3)MyBatis-Plus分页接口代码
Controller接口
@AutoLog(value = "用户管理-分页列表查询")
@ApiOperation(value = "App用户-分页列表查询", notes = "App用户-分页列表查询")
@GetMapping(value = "/list")
public Result queryPageList(AppUserReq appUserReq, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page page = new Page(pageNo, pageSize);
IPage pageList = appUserService.queryPageList(page, appUserReq);
return Result.ok(pageList);
}
Service接口
public interface IAppUserService extends BaseService {
IPage queryPageList(IPage page, AppUserReq appUserReq);
}
实现类:
@Service
public class AppUserServiceImpl extends BaseServiceImpl implements IAppUserService {
@Override
public IPage queryPageList(IPage page, AppUserReq appUserReq) {
Map reqParam = new HashMap();
reqParam.put("companyName", appUserReq.getCompanyName());
reqParam.put("userMobile", appUserReq.getPhone());
IPage resultList = this.baseMapper.queryPage(page, re服务器托管网qParam);
return resultList;
}
Mapper接口
public interface AppUserMapper extends BaseMapper {
IPage queryPage(IPage page, @Param(value = "p") Map reqParam);
}
Mapper.xml:写sql
select
id,
user_name,
company_name,
phone user_mobile,
user_type,
company_review_type companyReviewType,
user_level,
company_name companyName,
locked,
signup_time signupTime
from app_user
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
相关推荐: 《最新出炉》系列初窥篇-Python+Playwright自动化测试-17-处理鼠标悬停
1.简介 有些测试场景或者事件,playwright根本就没有直接提供方法去操作,而且也不可能把各种测试场景都全面覆盖提供方法去操作。比如:就像鼠标悬停,一般测试场景鼠标悬停分两种常见,一种是鼠标悬停在某一个元素上方,然后会出现下拉子菜单,第二种就是在搜索输入…