zoukankan      html  css  js  c++  java
  • SQL片段抽取

    Sql 中可将重复的 sql 提取出来,使用时用 include 引用即可,最终达到 sql 重用的目的

        <sql id="select_User">
             select * from User
        </sql>
        <!--    if的使用-->
        <select id="findByCondition" parameterType="com.domain.User" resultType="com.domain.User">
            <include refid="select_User"></include>
            <where>
                <if test="id!=0">
                    and id=${id}
                </if>
                <if test="username!=null">
                    and username='${username}'
                </if>
                <if test="password!=null">
                    and password='${password}'
                </if>
            </where>
        </select>
    
  • 相关阅读:
    SQL注入
    浅复制
    重构
    UML
    UML
    工业4.0
    MVC
    博客搬家(CSDN->博客园)
    BitCoin
    Java
  • 原文地址:https://www.cnblogs.com/lyd447113735/p/14431858.html
Copyright © 2011-2022 走看看