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代码 收藏 ...
随机推荐
- nginx ----> nginx配置/反向代理/负载均衡
nginx [engine x]是一个HTTP和反向代理服务器,一个邮件代理服务器和一个通用的TCP/UDP代理服务器,最初由Igor Sysoev编写. 环境: Ubuntu16.04 安装ngin ...
- Android--------内存泄露工具LeakCanary
什么是内存泄露 一些对象有着有限的生命周期.当这些对象所要做的事情完成了,我们希望他们会被回收掉.但是如果有一系列对这个对象的引用,那么在我们期待这个对象生命周期结束的时候被收回的时候,它是不会被回收 ...
- 1.numpy_overview
官网文档:https://www.numpy.org.cn/ Numpy 简介 导入numpy Numpy是Python的一个很重要的第三方库,很多其他科学计算的第三方库都是以Numpy为基础建立的. ...
- raw_input 和input 区别
raw_input() 直接读取控制台的输入(任何类型的输入它都可以接收).而对于 input() ,它希望能够读取一个合法的 python 表达式,即你输入字符串的时候必须使用引号将它括起来,否则它 ...
- (二)使用数组长度实现ADT bag(java)
目录 1.使用固定大小的数组实现ADT bag 包 1.1 一组核心方法 1.2 实现核心方法 1.3 让实现安全 1.4 测试核心方法 1.5 实现更多的方法 1.6 删除项的方法 1.7 测试 ...
- python-flask-路由匹配源码分析
@app.route('/') def hello_world(): return 'Hello World!' 第1步: class Flask(_PackageBoundObject): def ...
- python--django-admin定制页面流程:
django-admin定制页面流程: 1.自定义一个类:要继承 ModelAdmin class Cool(admin.ModelAdmin): pass 2. 在注册时,表名后加 自定 ...
- C++的面试题
1.什么是类? 类是具有相同属性和相同的方法的对象的集合,它是一种既包含数据又包含函数的抽象数据类型. 对象是类进行实体化后的产物,是一个实体. 在C++中也是先声明一个类类型,用类去定义若干个同类型 ...
- 原生JS的地区二级联动,很好理解的逻辑
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- css 使用率 清楚无用css