mybatis mapper配置文件 CustomerMapper.xml
Dao
@Repository
public interface CustomerDAO {
public void create(CustomerModel cm);
public void update(CustomerModel cm);
public void delete(CustomerModel cm);
public CustomerModel getByUuid(int uuid);
public List<CustomerModel> getByCondition(CustomerQueryModel cqm);
}
实体
public class CustomerModel {
private Integer uuid;
private String customerId;
private String pwd;
private String showName;
private String trueName;
private String registerTime;
}
<?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.exayong.architecture1.customermgr.dao.CustomerDAO">
<insert id="create" parameterType="CM">
insert into
tbl_customer(customerId,pwd,showName,trueName,registerTime)values(#{customerId},#{pwd},#{showName},#{trueName},#{registerTime})
</insert>
<update id="update" parameterType="CM">
update tbl_customer set
customerId=#{customerId},pwd=#{pwd},showName=#{showName},trueName=#{trueName},registerTime=#{registerTime}
where uuid=#{uuid}
</update>
<delete id="delete" parameterType="Int">
delete from tbl customer where uuid=#{uuid}
</delete>
<select id="getByUuid" parameterType="Int" resultType="CM">
select * from tbl_customer where uuid=#{_uuid}
</select>
<select id="getByCondition" parameterType="CQM" resultType="CM">
select * from tbl_customer
<where>
<if test="uuid=null && uuid >0">
and uuid=#{_uuid}
</if>
<if test="customerId=null">
and customerId=#{customerId}
</if>
<if test="showName=null">
and showName=#{showName}
</if>
</where>
</select>
</mapper>
mybatis mapper配置文件 CustomerMapper.xml的更多相关文章
- Mybatis学习(3)关于mybatis全局配置文件SqlMapConfig.xml
比如针对我这个项目的mybatis全局配置文件SqlMapConfig.xml做一些说明: <?xml version="1.0" encoding="UTF-8& ...
- Mybatis核心配置文件SqlMapConfig.xml
配置内容: SqlMapConfig.xml中配置的内容和顺序如下: 1.properties(属性) 2.settings(全局配置参数) 3.typeAliases(类型别名) 4.typeHan ...
- MyBatis全局配置文件MyBatis-config.xml代码
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC ...
- IDEA创建Mybatis的配置文件---sqlMapConfig.xml
Mybatis的配置文件不像Spring的配置文件,在Maven当中添加过依赖之后就可以在下面这个地方打开,需要自己去手动去编写配置文件,但是自己编写的话会记不住要引入的DTD,所以就需要自己创建一个 ...
- MyBatis全局配置文件mybatis-config.xml
1.在官方下载的mybatis-3.4.5.zip压缩包中,有我们需要的mybatis核心jar包和mybatis的快速入门的pdf文件 在mybatis的快速入门的pdf文件中,复制如下代码到我们项 ...
- Mybatis mapper接口与xml文件路径分离
为什么分离 对于Maven项目,IntelliJ IDEA默认是不处理src/main/java中的非java文件的,不专门在pom.xml中配置<resources>是会报错的,参考这里 ...
- idea Mybatis mapper配置文件删除SQL语句背景色
原样式: 看着很不爽 本文 idea 版本为:idea 2020.3.1,以下操作均基于此版本进行 解决办法 1.去除警告 Settings>Editor>Inspections>S ...
- Mybatis笔记五:Mybatis的全局配置文件Configuration.xml讲解
从 XML 中构建 SqlSessionFactory 每个基于Mybatis应用都是以一个SqlSessionFactory实例为中心.SqlSessionFactory实例可以由SqlSessio ...
- 四、MyBatis主配置文件
//备注:该博客引自:http://limingnihao.iteye.com/blog/1060764 在定义sqlSessionFactory时需要指定MyBatis主配置文件: Xml代码 收藏 ...
随机推荐
- 彻底搞懂 CPU 中的内存结构
https://www.cnblogs.com/YJK923/p/10302180.html
- English trip V1 - B 20. Likes and Dislikes 喜欢和不喜欢 Teacher:Sole Key:
In this lesson you will learn to talk about likes and dislikes. 课上内容(Lesson) # talk about hobby Do y ...
- 20180428 xlVBA自动设置成绩条行高
'自动设置行高 传入工作表Sht 和 每页打印的行数RowsInOnePage Public Sub AutoSetRowHeight(ByVal Sht As Worksheet, Optional ...
- python安装pandas和lxml
一.安装python 二.安装pip 三.安装mysql-connector(window版):下载mysql-connector-python-2.1.3,解压后进入目录,命令安装:pip inst ...
- MySQL表类型和存储引擎
一.基本介绍 从事务安全性的角度,可以把存储引擎分为两大类: 事务安全: BDB和innodb; 事务非安全性: myisam 和 memory 二.存储引擎的比较图 看你的mysql当前默认的存储引 ...
- 『计算机视觉』Mask-RCNN
一.Mask-RCNN流程 Mask R-CNN是一个实例分割(Instance segmentation)算法,通过增加不同的分支,可以完成目标分类.目标检测.语义分割.实例分割.人体姿势识别等多种 ...
- 『TensorFlow』SSD源码学习_其三:锚框生成
Fork版本项目地址:SSD 上一节中我们定义了vgg_300的网络结构,实际使用中还需要匹配SSD另一关键组件:被选取特征层的搜索网格.在项目中,vgg_300网络和网格生成都被统一进一个class ...
- 子类父类(虚函数下的 引用指针 对象)->看来没有子类指针这回事
#include<iostream> using namespace std; class Father { public: Father() { cout << " ...
- 解决spring-boot启动异常Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean
第一种: 需要在主类头加上 @EnableAutoConfiguration 第二种: pom文件是否加了 <dependency> <groupId>org.mybatis ...
- bootstrap fileinput组件的使用
组件的下载地址为:https://github.com/kartik-v/bootstrap-fileinput 比较详细的介绍可参看:http://www.jq22.com/jquery-info5 ...