zoukankan      html  css  js  c++  java
  • 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 &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>

  • 相关阅读:
    zabbix 3.2.2 server端添加客户端主机配置 (四)
    zabbix 3.2.2 server web展示如何显示中文 (三)
    zabbix 3.2.2 agent端(源码包)安装部署 (二)
    zabbix 3.2.2 server端(源码包)安装部署 (一)
    centos执行apt-get提示不存在
    用简单的方法学习ES6
    PHP+MySQL存储数据出现中文乱码的问题
    CentOS 6.0 系统 LAMP(Apache+MySQL+PHP)安装步骤
    mysql查询索引
    线程和进程
  • 原文地址:https://www.cnblogs.com/exayong/p/6507370.html
Copyright © 2011-2022 走看看