package com.example.mapper;
import com.example.pojo.Peot;
import org.apache.ibatis.annotations.*;
import java.util.List;
@Mapper
public interface PeotMapper {
@Select("select * from peom")
public List<Peot> findAll();
@Select("select * from peom where id=#{id}")
public Peot peotfindById(Integer ID);
/* //获取当前页的结果列表---用于分页
@Select("select * from peom")
public List<Peot> page(Integer start, Integer pageSize);*/
//查询所有
@Select("select * from peom")
public List<Peot> list();
@Delete("delete from peom where id=#{id}")
public int deletePeot(Integer id);
@Update("update peom set author=#{author},gender=#{gender},dynasty=#{dynasty},title=#{title} ,style=#{style} where id=#{id} ")
public boolean updatePeot(Peot peot);
@Insert("insert into peom(author, gender, dynasty, title, style) values (#{author}, #{gender}, #{dynasty}, #{title}, #{style})")
public int insert(Peot peot);
//查询
//select * from peom where author like '%陶%'
//@Select("select * from peom where author like %#{author}% and style like %#{style}%")
@Select("SELECT * FROM peom WHERE author LIKE CONCAT('%', #{author}, '%') AND style LIKE CONCAT('%', #{style}, '%')")
public List<Peot> peotSearch(String author, String style);
}
2、service
package com.example.service;
import com.example.pojo.PageBean;
import com.example.pojo.Peot;
public interface PeotService {
public PageBean page(Integer page, Integer pageSize);
public int deletePeot(Integer id);
public Peot peotfindById(Integer id);
public boolean updatePeot(Peot peot);
public boolean insertUser(Peot peot);
public PageBean pageSearch(Integer page, Integer pageSize,String author, String style);
}