共 12 篇文章 |
|
使用Mybatis.Mybatis属于半自动ORM,在使用这个框架中,工作量最大的就是书写Mapping的映射文件,由于手动书写很容易出错,我们可以利用Mybatis-Generator来帮我们自动生成文件。DOCTYPE generatorConfiguration 3 PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" 4 "http://mybatis.org/dtd/mybatis-ge... 阅23 转0 评0 公众公开 19-04-03 10:45 |
mybatis的select、insert、update、delete语句一、select.-- 更新学生信息 --> <update id="updateStudent" parameterType="StudentEntity"> UPDATE STUDENT_TBL SET STUDENT_TBL.STUDENT_NAME = #{studentName}, STUDENT_TBL.STUDENT_SEX = #{studentSex}, STUDENT_TBL.STUDENT_BIRTHDAY = #{studentBirthday}, ... 阅571 转0 评0 公众公开 19-04-03 10:43 |
mybatis模糊查询sql.今天下午做的一个功能,要用到模糊查询,字段是description,刚开始我的写法用的是sql中的模糊查询语句,1. sql中字符串拼接。SELECT * FROM tableName WHERE name LIKE CONCAT(CONCAT(''''''''%'''''''', #{text}), '''''''... 阅23 转0 评0 公众公开 19-04-03 10:43 |
mybatis表映射文件代码自动生成器(方案一:命令行)第四步:配置generator.xml文件,直接拷贝,稍作修改就可使用,创建好后也放入E:\work\tools\mybatis,配置文件名字可随意取,这里用了generator.xml.DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis... 阅115 转1 评0 公众公开 19-04-03 10:42 |
<properties resource="org/mybatis/example/config.properties"> <property name="username" value="dev_user"/> <property name="password" value="F2Fa3!33TYyg"/></properties>-- 使用相对于类路径的资源引用 --><mappers> <mapper resource="... 阅39 转0 评0 公众公开 19-04-03 10:42 |
搭建一个简单的mybatis框架一、Mybatis介绍。DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> 3 <configuration> 4 <environments default="development"> 5 <environment id="development"> 6 <transac... 阅33 转1 评0 公众公开 19-04-03 10:41 |
阅314 转0 评0 公众公开 19-03-25 15:06 |
1、动态SQL:if 语句2、动态SQL:if+where 语句3、动态SQL:if+set 语句4、动态SQL:choose(when,otherwise) 语句5、动态SQL:trim 语句6、动态SQL: SQL 片段7、动态SQL: foreach 语句8、总结。如果第一个条件不为空,那么 sql 语句为:update user u set u.username = ?,u.sex = ?where id=?回到顶部4、动态SQL:choose(when,otherwise) 语句。sql语... 阅190 转0 评0 公众公开 19-03-25 11:38 |