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. 区间逼近 牛客寒假1 小a的排列

    做法:模拟 萌区间也就是这个区间里的数是一段连续的数 做法的话是先找出题目x,y的位置,记为l,r,然后找出l,r内的最大最小值,又因为萌区间要求数是连续的,就从这段连续数最小的开始到最大的,确定缩放 ...

  2. QPS 机器计算公式

    QPS = req/sec = 请求数/秒 QPS = 总请求数 / ( 进程总数 * 请求时间 )QPS: 单个进程每秒请求服务器的成功次数 原理:每天80%的访问集中在20%的时间里,这20%时间 ...

  3. linux配置hadoop集群

    ①安装虚拟机 ②为虚拟机添加共享文件 右击已经安装好的虚拟机 设置—>选项—>共享文件 ③配置映射 sudo nano /etc/network/interfaces   重启网络:sud ...

  4. 关于移动端rem适配

    var num = 1 / window.devicePixelRatio; var fontSize = document.documentElement.clientWidth / 10; doc ...

  5. laravel源码解析

    本专栏系列文章已经收录到 GitBooklaravel源码解析 Laravel Passport——OAuth2 API 认证系统源码解析(下)laravel源码解析 Laravel Passport ...

  6. 53. Maximum Subarray最大子序和

    网址:https://leetcode.com/problems/maximum-subarray/submissions/ 很简单的动态规划 我们可以把 dp[i] 表示为index为 i 的位置上 ...

  7. win10下使用python访问vmbox中的redis

    了解到redis没有windows的官方支持,所以在vmbox中的ubuntu装了redis#在ubuntu中 #搜索redis相关软件信息 apt-cache search ^redis #不清楚为 ...

  8. SpringBoot系列之Hikari连接池

    1.springboot 2.0 中默认连接池是Hikari,在引用parents后不用专门再添加依赖 2.application.yml中的配置 # jdbc_config datasource s ...

  9. KM算法详解[转]

    KM算法详解 原帖链接:http://www.cnblogs.com/zpfbuaa/p/7218607.html#_label0 阅读目录 二分图博客推荐 匈牙利算法步骤 匈牙利算法博客推荐 KM算 ...

  10. python之命令行参数解析模块argparse

    """argparse模块使得写用户友好性命令行接口很容易,程序定义所需要的参数,argparse会从ays.argv中提取出这些参数.argparse模块也能自动的产生 ...