package com.ssm.mapper; import com.ssm.entity.Demo; import org.apache.ibatis.annotations.Param; import java.util.List; //操作mybatis的接口 public interface DemoMapper { /* * 约定1:方法名和mapper.xml中标签的id值相同 * 约定2:方法的输入参数和mapper.xml中标签的parameterType的类型一致 * 约定3:方法的返回值和mapper.xml中标签的resultType的类型一致 * 还需:namespace值是接口全类名(接口中的方法和mapper.xml中SQL标签一一对应) * 匹配(约定)过程: * 1.根据接口类名找到mapper.xml文件(namespace=接口全类名) * 2.根据接口的方法名找到mapper.xml文件中SQL标签(方法名=SQL标签id值) * 习惯:SQL映射文件(studentMapper.xml)和接口放在同一个包下(注意修改config.xml) */ //方法的三要素:返回值 方法名(参数列表) Demo getDemoById(Integer id); List getDemoAll(@Param("param1") int beginPage, @Param("param2") int limitpage); void addDemo(Demo demo); void updateDemo(Demo demo); void deleteDemoById(Integer id); void deleteDemoAll(); Integer countTotlePage(); Demo findDemoByDid(Integer id); List searchDemoByCondition(String condition); List findDemoByDId(Integer did); }