zoukankan      html  css  js  c++  java
  • MyBatis(一)select语句拼接方式

    <select id="selectByForm" parameterType="com.xxx.controller.request.DeliveryQueryForm" resultMap="FullResultMap">
    
        select
        <if test="distinct">
            distinct
        </if>
        'true' as QUERYID,
        ro.order_code as order_code, ro.code as code, ro.name as name, 
        ro.reception_date as reception_date,r.status as status, d.driver_name as driver_name
        from tbl_order_drivers_relation r
        left join tbl_reservation_order ro on ro.order_code = r.order_code
        left join mst_drivers d on d.driver_id = r.driver_id
        <if test="_parameter != null">
            <include refid="Example_Where_Clause_Form" />
        </if>
            order by r.create_time
    </select>
    <sql id="Example_Where_Clause_Form">
        <where>
            <if test="orderCode != null and orderCode != ''">
                AND r.order_code = #{orderCode}
            </if>
    
            <if test="name != null and name != ''">
                AND ro.name like CONCAT(CONCAT('%', #{name}), '%')
            </if>
        </where>
    </sql>
  • 相关阅读:
    性能测试相关
    centos7 设置定时器 crond
    大杀器Bitset
    树形DP
    双线程DP
    状态压缩DP
    斜率优化DP
    01分数规划
    二分和三分
    uva11549 Floyd判圈法
  • 原文地址:https://www.cnblogs.com/uip001/p/14736362.html
Copyright © 2011-2022 走看看