第一篇:1、Mybatis-Plus 创建SpringBoot项目
第二篇:2、Mybatis-Plus 测试增、删、改、查
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.zyz.mybatisplus.mapper.UserMapper">
<!-- Map<String,Object> selectMapById(Long id);-->
<select id="selectMapById" resultType="map">
select id,name,age,email from mybatis_plus.user where id =#{id}
</select>
</mapper>
@Repository
public interface UserMapper extends BaseMapper<User> {
/**
* 根据id查询用户信息为map集合
* @param id
* @return
*/
Map<String,Object> selectMapById(Long id);
}
//自定义sql语句查询用户信息
Map<String,Object> map = userMapper.selectMapById(1L);
System.out.println(map);