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. Linux中sudo的用法

    一.用户在/etc/sudoers文件中的写法语法规则:授权用户 主机=命令动作 这三个要素缺一不可,但在动作之前也可以指定切换到特定用户下,在这里指定切换的用户要用括号括起来,如果不需要密码直接运行 ...

  2. 静默安装/ 普通安装与root权限获取相关

    静默安装 有时候使用第三方的插件时我们需要静默安装其提供的apk包,静默安装时我们需要获取root权限,如下代码 Process process = Runtime.getRuntime().exec ...

  3. Kali安装nessus

    下载 在官方网站下载对应的 Nessus 版本:http://www.tenable.com/products/nessus/select-your-operating-system 这里选择 Kal ...

  4. 微信小程序分享

    点击链接查看详情:(转发的路径的必须写正确) https://mp.weixin.qq.com/debug/wxadoc/dev/api/share.html

  5. chrome 自动加载flash

    class Login(unittest.TestCase): #初始 def setUp(self): chromeOpitons = Options() prefs = { # "pro ...

  6. Linux中计划任务、周期性任务设置

    Linux中计划任务.周期性任务设置 计划任务:指在未来的特定时间里,执行一次某一特定任务.当然,如果同一任务需要在不同时间点执行执行两次.三次或多次,可以视为多个一次看待. 周期性任务:指某一任务需 ...

  7. leetcode-algorithms-2 Add Two Numbers

    leetcode-algorithms-2 Add Two Numbers You are given two non-empty linked lists representing two non- ...

  8. Shell里面获取路径的方式

    1. $0 #!/bin/sh echo $0 2.shFile=$(readlink -f $0) #!/bin/sh shFile=$() shDir=$(dirname ${shFile})ec ...

  9. 快速学习HTML

    1.先写基本的框架标签 2.HTML基本标签 段落标签 <p></p> 空格标签   标题标签 <h1></h1>……<h6></h6 ...

  10. 如何使a标签打开新页面并阻止刷新当前页面

    错误: HTML中,使用href属性时,当前页面和新页面均跳转到URL指定的页面,即当前页面也刷新: <li id='goToBack'><a href='**.action' ta ...