Controller层
@RestController
@RequestMapping("test")
public class TestFacade {
@Resource
private TestService service;
@GetMapping
public RestResponse select(@RequestParam(required = false) Map<String, Object> params) {
return service.list(params);
}
}
Service层
@Service
public classTestServiceImpl implements TestService{
@Resource
private TestMapper mapper;
@Override
public RestResponse list(Map<String, Object> params) {
PaginationUtil.paginationInit(params);
List<Test> list = mapper.list(params);
int total = mapper.count(params);
return RestResponse.success(PaginationUtil.getPageResult(total, params, list));
}
}
Mapper层
public interface TestMapper {
List<Test> list(Map<String,Object> params);
int count(Map<String, Object> params)