MybatisPlus数据层与业务层快速开发

MybatisPlus数据层与业务层快速开发

package com.vmware.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vmware.domain.Book;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface BookMapper extends BaseMapper<Book> {

}
  • MyBatisPlus向数据层提供了快速开发工具类:BaseMapper 包含了基本的增删改查操作
package com.vmware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.vmware.domain.Book;

public interface BookService extends IService<Book>{
}
  • MybatisPlus向业务层提供了通用接口IService,包含了常用的业务接口
package com.vmware.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vmware.domain.Book;
import com.vmware.mapper.BookMapper;
import com.vmware.service.BookService;
import org.springframework.stereotype.Service;

@Service
public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements BookService{
}
  • MybatisPlus向业务层提供了通用实现类ServiceImpl,实现了通用接口IService的方法

你可能感兴趣的:(MyBatis,java,mybatis)