MVC-Mapper示例
Bitgeek 2022-08-15 springspringmvc请求
# 代码包结构
cn.bitgeek.springboot.jdbc
├── rest // rest包专门放置Controller接口
├──── ClassController.java
├── service // service包专门放置Service服务类
├──── ClassService.java
├── dto // dto包放传输对象
├──── ClassDTO.java
├── entity // entity包放实体类对象
├──── ClassEntity.java
├── mapper // mapper包专门放置和数据库交互的接口类
├──── ClassMapper.java
├──── ClassMapper.xml
└── JdbcApplication.java // 服务启动类入口
# ClassMapper代码示例
package cn.bitgeek.springboot.jdbc.mapper;
import cn.bitgeek.springboot.jdbc.dto.ClassDTO;
import cn.bitgeek.springboot.jdbc.entity.Class1;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ClassMapper {
/**
* <p>新增</p>
* @author bitgeek
* @date 2022/6/26 15:06
* @exception
* @return
* @param
*
*/
int insert(@Param(value = "class") Class1 class1);
/**
* <p>删除</p>
* @author bitgeek
* @date 2022/6/26 15:06
* @exception
* @return
* @param
*
*/
int delete(@Param(value = "id") int id);
/**
* <p>修改</p>
* @author bitgeek
* @date 2022/6/26 15:06
* @exception
* @return
* @param
*
*/
int update(@Param(value = "class") Class1 class1);
/**
* <p>详情查询</p>
* @author bitgeek
* @date 2022/6/26 15:06
* @exception
* @return
* @param
*
*/
ClassDTO load(@Param(value = "id") Long id);
/**
* <p>列表分页查询</p>
* @author bitgeek
* @date 2022/6/26 15:06
* @exception
* @return
* @param
*
*/
List<ClassDTO> pageList(@Param(value = "class") Class1 class1);
}