mybatisPlus简介
mybatisplus简化了dao层
package com.example.mp_01.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.mp_01.domain.User;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface Userdao extends BaseMapper<User> {
}
dao层中不用写一般的sql语句了
这是一个测试
package com.example.mp_01;
import com.example.mp_01.dao.Userdao;
import com.example.mp_01.domain.User;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
@SpringBootTest
class Mp01ApplicationTests {
@Autowired(required = false)
private Userdao userdao;
@Test
void testGetAll() {
List<User> users = userdao.selectList(null);
System.out.println(users);
}
}