标签:vat names pack bsp 编写 persist rom public pwd
1 package com.offcn.pojo; 2 3 import lombok.AllArgsConstructor; 4 import lombok.Data; 5 import lombok.NoArgsConstructor; 6 7 import javax.persistence.*; 8 9 @Entity 10 @Data 11 @NoArgsConstructor 12 @AllArgsConstructor 13 @Table(name = "user") 14 public class MUser { 15 16 @Id 17 @GeneratedValue(strategy = GenerationType.IDENTITY) 18 private Integer uid; 19 private String uname; 20 private String pwd; 21 private String gender; 22 private String phone; 23 }
1 package com.offcn.mapper; 2 3 import com.offcn.pojo.MUser; 4 5 import java.util.List; 6 7 public interface MUserMapper { 8 List<MUser> getUserList(); 9 }
1 <?xml version="1.0" encoding="UTF-8" ?> 2 <!DOCTYPE mapper 3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 5 <mapper namespace="com.offcn.mapper.MUserMapper"> 6 <select id="getUserList" resultType="com.offcn.pojo.MUser"> 7 select * from user 8 </select> 9 </mapper>
1 package com.offcn; 2 3 import org.mybatis.spring.annotation.MapperScan; 4 import org.springframework.boot.SpringApplication; 5 import org.springframework.boot.autoconfigure.SpringBootApplication; 6 7 /** 8 * @author yy 9 * @date 2019/11/5 9:56 10 */ 11 @MapperScan("com.offcn.mapper") 12 @SpringBootApplication 13 public class HelloApplication { 14 public static void main(String[] args) { 15 SpringApplication.run(HelloApplication.class,args); 16 } 17 }
如果启动错误可以将映射文件放在resources文件目录下试试
标签:vat names pack bsp 编写 persist rom public pwd
原文地址:https://www.cnblogs.com/lifefamily/p/11801517.html