摘要: 注解写sql一般写在mapper层,如果sql语句复杂建议不要写注解sql 拼接容易出错 二动态sql的话要在 main 下面创建一个resource ——mapper—— Mapper.xml 再在springMVC.xml 里面的第四个里面引入动态sql <property name="mapp 阅读全文
posted @ 2019-07-31 01:26 new海 阅读(2844) 评论(0) 推荐(0) 编辑
摘要: @Componcnt :作用就是把当前类对象存入spring容器中 属性:value 用于指定bean的id 当我们不写的时候默认就是当前类名,并且首字母要小写 @Controller 一般用在表现层@Service 一般用在业务层@Repository 一般用在持久层他们三个是spring 框架为 阅读全文
posted @ 2019-07-31 01:18 new海 阅读(557) 评论(0) 推荐(0) 编辑
摘要: 在pom中引入分页插件的jar包 <!--分页插件--><dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>4.1.6</version></depend 阅读全文
posted @ 2019-07-31 00:57 new海 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 首先是pom的配置: <dependencies> <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> <dependency> <groupId>mysql</groupId> <artifactId>mys 阅读全文
posted @ 2019-07-31 00:49 new海 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1.先创建实体类: 2.创建mapper层 package cn.kgc.mapper;import cn.kgc.Account;import org.apache.ibatis.annotations.Delete;import org.apache.ibatis.annotations.Ins 阅读全文
posted @ 2019-07-31 00:43 new海 阅读(568) 评论(0) 推荐(0) 编辑
摘要: 提示: 1.单表查询多条数据用 list<实体类名字> mapper层 1.1单表查询单条数据用 对象 2.两表关联查多条 list<map<String,Object>> 2.1两表联查查一条 map<String,Object> 一.具体步骤如下 表结构: 1.创建实体类: 2.创建mapper 阅读全文
posted @ 2019-07-31 00:35 new海 阅读(2556) 评论(2) 推荐(1) 编辑