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>

  • 相关阅读:
    Shell高级编程学习笔记(基础篇)
    基于Python的机器学习实战:Apriori
    基于Python的机器学习实战:AadBoost
    Theano教程:Python的内存管理
    基于theano的降噪自动编码器(Denoising Autoencoders--DA)
    基于theano的深度卷积神经网络
    推荐系统之矩阵分解及C++实现
    推荐系统之协同过滤的原理及C++实现
    一步一步详解ID3和C4.5的C++实现
    Principal components analysis(PCA):主元分析
  • 原文地址:https://www.cnblogs.com/exayong/p/6507370.html
Copyright © 2011-2022 走看看