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>
最新文章
- Linux下C语言编程实现spwd函数
- mysql create db utf8 character
- go 入门之环境搭建-Windows
- 前端开发规范之html编码规范
- ActiveMQ集成到Spring
- Owasp Top 10 Security Risks for 2014
- 组态Log4j(非常具体的)
- vuethink 配置
- k8s-jenkins 自动化1
- HBuilder git使用-环境配置
- .net core 2.x - 日志 - to elasticsearch - (2)
- C# 把byte[]输出为图片文件
- Jenkins配置自动化构建
- 树莓派操控SG90舵机
- MySQL主从常见的架构
- raise语句
- PSR2规范
- TortoiseGit学习系列之TortoiseGit基本操作拉取项目(图文详解)
- 【转+修改】容联云通讯api调用短信发送调用
- [翻译] TLMotionEffect 重力感应