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代码 收藏 ...
随机推荐
- C#后台Post提交XML 及接收该XML的方法
//发送XML public void Send(object sender, System.EventArgs e) { string WebUrl = "http:/ ...
- Python自学:第二章 合并(拼接字符串)
first_name = "ada" last_name = "lovelace" full_name = first_name + " " ...
- You Don't Know JS: this & Object Prototypes (第6章 Behavior Delegation)附加的ES6 class未读
本章深挖原型机制. [[Prototype]]比类更直接和简单! https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%2 ...
- Can't find kernel text map area from kcore
kernel : 4.9.51kexec-tools : 2.0.4 1.~ # ./kexec -p /boot/vmlinuz --initrd=/boot/initrd --command-li ...
- 非常可乐 HDU - 1495
大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为.因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多.但see ...
- Luffy之Xadmin以及首页搭建(轮播图,导航)
1. 首页 1.1 轮播图 admin站点配置支持图片上传 pip install Pillow 默认情况下,Django会将上传的图片保存在本地服务器上,需要配置保存的路径.我们可以将上传的文件保存 ...
- python基础之循环语句,格式化输出以及编码
1.while循环语句 1.1 常见的几种结构 1. while+判断条件 循环体 2. while+判断条件 循环体 else 语句 tips:while循环如果满足条件的话,会一直循环循环体 ...
- 2018-2019 ACM-ICPC Brazil Subregional Programming Contest
A:留坑 B:二维sg函数,特判边界情况 //#pragma GCC optimize(2) //#pragma GCC optimize(3) //#pragma GCC optimize(4) / ...
- win php安装 oracle11 g
1.下载plsql和oracle11g plsql安装比较简单,就是普通的安装.oracle11 g不用安装, 下面我讲解一下win 64位的系统配置oracle: (1).首先我使用的是warpse ...
- windows 系统分布式版本控制 git 使用学习
1. 在 Windows 上安装 Git 在Windows上使用Git,可以从Git官网直接下载安装程序,(网速慢的同学请移步国内镜像),然后按默认选项安装即可. 安装完成后,在开始菜单里找到“Git ...