博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mybatis配置
阅读量:5077 次
发布时间:2019-06-12

本文共 6957 字,大约阅读时间需要 23 分钟。

一、创建Maven工程并编辑pom.xml

pom.xml

4.0.0
mabatis_v1.0
mabatis_v1.0
0.0.1-SNAPSHOT
war
src
maven-compiler-plugin
3.3
1.8
1.8
maven-war-plugin
2.6
WebContent
false
org.mybatis
mybatis
3.2.8
junit
junit
4.10

  

二、创建java类

三、创建java对象与数据库之间的xml文件

NewsMapper.xml

and ${criterion.condition}
and ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
and ${criterion.condition}
#{listItem}
and ${criterion.condition}
and ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
and ${criterion.condition}
#{listItem}
newsID, newsType, newsTitle, newsWriter, newsTime
newsContent
delete from news_tb where newsID = #{newsid,jdbcType=INTEGER}
delete from news_tb
insert into news_tb (newsID, newsType, newsTitle, newsWriter, newsTime, newsContent ) values (#{newsid,jdbcType=INTEGER}, #{newstype,jdbcType=VARCHAR}, #{newstitle,jdbcType=VARCHAR}, #{newswriter,jdbcType=VARCHAR}, #{newstime,jdbcType=TIMESTAMP}, #{newscontent,jdbcType=LONGVARCHAR} )
insert into news_tb
newsID,
newsType,
newsTitle,
newsWriter,
newsTime,
newsContent,
#{newsid,jdbcType=INTEGER},
#{newstype,jdbcType=VARCHAR},
#{newstitle,jdbcType=VARCHAR},
#{newswriter,jdbcType=VARCHAR},
#{newstime,jdbcType=TIMESTAMP},
#{newscontent,jdbcType=LONGVARCHAR},
update news_tb
newsID = #{record.newsid,jdbcType=INTEGER},
newsType = #{record.newstype,jdbcType=VARCHAR},
newsTitle = #{record.newstitle,jdbcType=VARCHAR},
newsWriter = #{record.newswriter,jdbcType=VARCHAR},
newsTime = #{record.newstime,jdbcType=TIMESTAMP},
newsContent = #{record.newscontent,jdbcType=LONGVARCHAR},
update news_tb set newsID = #{record.newsid,jdbcType=INTEGER}, newsType = #{record.newstype,jdbcType=VARCHAR}, newsTitle = #{record.newstitle,jdbcType=VARCHAR}, newsWriter = #{record.newswriter,jdbcType=VARCHAR}, newsTime = #{record.newstime,jdbcType=TIMESTAMP}, newsContent = #{record.newscontent,jdbcType=LONGVARCHAR}
update news_tb set newsID = #{record.newsid,jdbcType=INTEGER}, newsType = #{record.newstype,jdbcType=VARCHAR}, newsTitle = #{record.newstitle,jdbcType=VARCHAR}, newsWriter = #{record.newswriter,jdbcType=VARCHAR}, newsTime = #{record.newstime,jdbcType=TIMESTAMP}
update news_tb
newsType = #{newstype,jdbcType=VARCHAR},
newsTitle = #{newstitle,jdbcType=VARCHAR},
newsWriter = #{newswriter,jdbcType=VARCHAR},
newsTime = #{newstime,jdbcType=TIMESTAMP},
newsContent = #{newscontent,jdbcType=LONGVARCHAR},
where newsID = #{newsid,jdbcType=INTEGER}
update news_tb set newsType = #{newstype,jdbcType=VARCHAR}, newsTitle = #{newstitle,jdbcType=VARCHAR}, newsWriter = #{newswriter,jdbcType=VARCHAR}, newsTime = #{newstime,jdbcType=TIMESTAMP}, newsContent = #{newscontent,jdbcType=LONGVARCHAR} where newsID = #{newsid,jdbcType=INTEGER}
update news_tb set newsType = #{newstype,jdbcType=VARCHAR}, newsTitle = #{newstitle,jdbcType=VARCHAR}, newsWriter = #{newswriter,jdbcType=VARCHAR}, newsTime = #{newstime,jdbcType=TIMESTAMP} where newsID = #{newsid,jdbcType=INTEGER}

四、创建confg.xml文件

 

五、创建SqlSessionFactory,获取session

 

转载于:https://www.cnblogs.com/h2503652646/p/10800601.html

你可能感兴趣的文章
Three typical types of Data Mining applications
查看>>
通过rsync+inotify实现数据实时备份
查看>>
四种第三方登录(附源码)(转)
查看>>
20145305 《信息安全系统设计基础》第12周学习总结
查看>>
【OpenCV应用笔记】(彩色/灰度)图像像素值读取并保存到txt文件
查看>>
一句话输出NGINX日志访问IP前十位排行
查看>>
Linux SendMail 使用外部SMTP服务发送邮件
查看>>
thinkPHP5.0 获取域名
查看>>
PKU P2411 Mondriaan's Dream
查看>>
策略模式
查看>>
分布式Hadoop安装(一)
查看>>
204. Count Primes
查看>>
Laravel 下生成验证码的类
查看>>
Linux基础命令---cal
查看>>
四种线程池使用
查看>>
第一次阅读作业
查看>>
使用python备份文件
查看>>
ARM编程进阶之一 —— ARM汇编伪指令
查看>>
贪婪法
查看>>
oracle学习之bulk collect用法
查看>>