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 &amp;&amp; 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的更多相关文章

  1. Mybatis学习(3)关于mybatis全局配置文件SqlMapConfig.xml

    比如针对我这个项目的mybatis全局配置文件SqlMapConfig.xml做一些说明: <?xml version="1.0" encoding="UTF-8& ...

  2. Mybatis核心配置文件SqlMapConfig.xml

    配置内容: SqlMapConfig.xml中配置的内容和顺序如下: 1.properties(属性) 2.settings(全局配置参数) 3.typeAliases(类型别名) 4.typeHan ...

  3. MyBatis全局配置文件MyBatis-config.xml代码

    <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC ...

  4. IDEA创建Mybatis的配置文件---sqlMapConfig.xml

    Mybatis的配置文件不像Spring的配置文件,在Maven当中添加过依赖之后就可以在下面这个地方打开,需要自己去手动去编写配置文件,但是自己编写的话会记不住要引入的DTD,所以就需要自己创建一个 ...

  5. MyBatis全局配置文件mybatis-config.xml

    1.在官方下载的mybatis-3.4.5.zip压缩包中,有我们需要的mybatis核心jar包和mybatis的快速入门的pdf文件 在mybatis的快速入门的pdf文件中,复制如下代码到我们项 ...

  6. Mybatis mapper接口与xml文件路径分离

    为什么分离 对于Maven项目,IntelliJ IDEA默认是不处理src/main/java中的非java文件的,不专门在pom.xml中配置<resources>是会报错的,参考这里 ...

  7. idea Mybatis mapper配置文件删除SQL语句背景色

    原样式: 看着很不爽 本文 idea 版本为:idea 2020.3.1,以下操作均基于此版本进行 解决办法 1.去除警告 Settings>Editor>Inspections>S ...

  8. Mybatis笔记五:Mybatis的全局配置文件Configuration.xml讲解

    从 XML 中构建 SqlSessionFactory 每个基于Mybatis应用都是以一个SqlSessionFactory实例为中心.SqlSessionFactory实例可以由SqlSessio ...

  9. 四、MyBatis主配置文件

    //备注:该博客引自:http://limingnihao.iteye.com/blog/1060764 在定义sqlSessionFactory时需要指定MyBatis主配置文件: Xml代码 收藏 ...

随机推荐

  1. MapReduce处理气象数据

    老师:MissDu 提交作业 1. 用Python编写WordCount程序并提交任务 程序 WordCount 输入 一个包含大量单词的文本文件 输出 文件中每个单词及其出现次数(频数),并按照单 ...

  2. webpack热更新

    文件地址:https://pan.baidu.com/s/1kUOwFkV 从昨天下午到今天上午搞了大半天终于把热更新搞好了,之前热更新有两个问题,第一个是不能保存表单状态.第二个是更新太慢,这次主要 ...

  3. hadoop ssh 端口-ssh-copy-id详解

    ssh-copy-id详解 http://www.blogdaren.com/post-1815.html 服务器时常需要配置无密码的登录方式,最一般的设置方式如下: 使用ssh-keygen和ssh ...

  4. Confluence 6 创建你的个人空间

    作为一个项目中的新手,你可能希望将一些工作保存为你自己可见,直到你准备将你的工作分享出去.同时你可能会收到任务指挥中心发送的只针对你的任务,你也希望这些任务能存储在一个安全的地方. 针对类似这样任务需 ...

  5. lanmp环境中php版本的升级为7.1

    查看php版本的信息 vim  ./lib/phps.sh 设置权限   chmod 755 ./lib/phps.sh 下载版本  ./lib/phps.sh  7.1.4 查看版本 php -v ...

  6. vue嵌套路由--params传递参数

    在嵌套路由中,父路由向子路由传值除了query外,还有params,params传值有两种情况,一种是值在url中显示,另一种是值不显示在url中. 1.显示在url中index.html <d ...

  7. Java异常及错误

    java提供了两种异常机制,可以分为运行时异常(RuntimeException)与检查式异常(checked Exception). 检查式异常:java编译器对于这种异常需要我们对其用try... ...

  8. C# 4.0 可选参数 和 命名参数

    可选参数 可选参数是 C# 4.0 提出来的,当我们调用方法,不给这个参数(可选参数)赋值时,它会使用我们定义的默认值. 需要注意的是: (1)可选参数必须位于所有必选参数的后面: (2)可选参数必须 ...

  9. cogs448

    ☆   输入文件:1.in   输出文件:1.out   简单对比时间限制:1 s   内存限制:128 MB [题目描述] 在某次膜拜大会上,一些神牛被要求集体膜拜.这些神牛被奖励每人吃一些神牛果. ...

  10. [LeetCode] 191. Number of 1 Bits ☆(位 1 的个数)

    描述 Write a function that takes an unsigned integer and return the number of '1' bits it has (also kn ...