首页 > 编程语言 >java分页查询后端代码

java分页查询后端代码

时间:2022-11-04 00:45:46浏览次数:42  
标签:java 分页 demo springframework 查询 org import com annotation

package com.example.demo;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.w3c.dom.ls.LSOutput;

import com.example.demo.gs.Teacher;

@Mapper
public interface TeacherMapper {

@Select("select * from edu_teacher limit #{id},10 ")
List<Teacher>SelectFromWhere(int id);


}	

 

package com.example.demo;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.demo.gs.Teacher;

@Service
public interface TeacherService {
	
List<Teacher>SelectFromService(int id) ;
 

}

 

 

package com.example.demo.gs;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.demo.TeacherMapper;
import com.example.demo.TeacherService;

@Service
public class TeacherServiceImple implements TeacherService {
	@Autowired
	TeacherMapper Mapper;
	 

	
	@Override
	@Transactional
	public List<Teacher> SelectFromService(int id) {
		 
		return this.Mapper.SelectFromWhere((id-1)*10);
	}
	
	
	
	
}

 

package com.example.demo.gs;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.ognl.ASTThisVarRef;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.TeacherMapper;
import com.example.demo.TeacherService;

@RestController
public class TeacherContorller {
	@Autowired
	private TeacherService ServiceMapper;
	
	@GetMapping("/GetSelect")
	@ResponseBody
	List<Teacher>SelectFromGod(int id){
		 
	return this.ServiceMapper.SelectFromService( id );
	};
	
	 
}

 

标签:java,分页,demo,springframework,查询,org,import,com,annotation
From: https://www.cnblogs.com/ZhuAo/p/16856374.html

相关文章

  • java操作文件
    三种方式publicFile(Stringpathname)--通过指定的路径名字符串创建一个File对象。--若pathname指向的是文件,创建的File对象就表示文件;--若pathname指向的是目录......
  • leetcode java 杨辉三角
    简介杨辉三角是一道简单题,可以通过类似一层推下一层的方式进行计算,但是好像看过一个题解,采用的方式是组合数。本来想采用组合数,尝试了double溢出尝试了long溢出,尝试......
  • 发起HTTP请求方式汇总(Java)
    Java发起HTTP请求方式汇总Java发起HTTP请求方式汇总2021-01-07T16:31:40+08:00作为一个Java后端,需要通过HTTP请求其他的网络资源可以说是一个比较常见的case了;一般怎......
  • 【Java复健指南09】项目练习全解--房屋出租系统
    一个基于文本界面的综合练习,主要用于串联和回忆知识点,比较简单各个界面的设计样式主菜单=============房屋出租系统菜单============ 1新增房源 2查找房......
  • java.lang.IllegalArgumentException: Request header is too large
    该问题出现于接口使用get请求,参数的长度太长导致的问题,修复方案,将该接口的请求方式又get请求换成post请求即可进一步分析,两者都是http的请求方式,根本原因是浏览器和web服......
  • 如何判断Javascript函数是否是Async函数
     zhangfisher发布于 2021-04-13判断Javascript函数是否是Async函数有好几种方法:调用Object.prototype.toString.call(asyncfunction(){}),如果返回[objectAsy......
  • NHibernate1.2 执行多表查询
    个人写法可能有点傻···在改进先贴出来!让大家找点思路····目的:将两个表的内容综合到一个集合里,然后邦定到GridView上解决方法:1.创建一个综合了两个实体类的一个新的......
  • C# .Net MVC Razor 视图静态分页导航栏生成器
    这里贴出3个重要组成部分1.分页导航栏主算法代码(包括@Html扩展方法)2.HTML页面调用代码(包括导航栏样式)3.Controller控制器代码4.测试路径:http://www.****.com/EBusines......
  • 07_查询数据_系统数据字典_SQL值表达式
    一、系统数据字典 代码:select*fromgp_pgdatabase;(查看数据字典) 二、SQL值表达式值表达式包括查询条件中的各种命令;值表达式的结果称为标量;表达式语法允许从原......
  • 模糊查询并且对HBase进行CRUD的操作
     我这是两次的实验用的一个项目,第二次的实验是在第一次上的实验的基础上增加而来     pom.xml<?xmlversion="1.0"encoding="UTF-8"?><projectxmlns="......