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