加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml文件连表查询

发布时间:2020-12-16 23:25:13 所属栏目:百科 来源:网络整理
导读:? ? ! -- 根据条件查询资产信息 -- select id = "getAssetCommonByPage" resultType = "java.util.Map" SELECT * ,t2.name as category_name,t3.name as type_name FROM s_it_asset_common t1 LEFT JOIN s_asset_category t2 ON t1.category = t2.id LEFT JO

?

?

<!-- 根据条件查询资产信息 -->
    <select id="getAssetCommonByPage" resultType="java.util.Map">
        SELECT 
        *,t2.name as category_name,t3.name as type_name
        FROM 
        s_it_asset_common t1
        LEFT JOIN 
        s_asset_category t2 
        ON 
        t1.category = t2.id 
        LEFT JOIN
        s_asset_type t3 
        ON 
        t1.type = t3.id
        WHERE 1=1
        <if test="id !=‘‘ and id != null">
            AND
            id=#{id,jdbcType=NUMERIC}
        </if>
        <if test="code !=‘‘ and code != null">
            AND
            code=#{code}
        </if>
        <if test="category !=‘‘ and category != null">
            AND
            category=#{category}
        </if>
        <if test="type !=‘‘ and type != null">
            AND
            type=#{type}
        </if>
        <if test="mfr !=‘‘ and mfr != null">
            AND
            mfr like CONCAT(%,#{mfr},%)
        </if>
        <if test="ip !=‘‘ and ip != null">
            AND
            ip=#{ip}
        </if>
        <if test="name !=‘‘ and name != null">
            AND
            name like CONCAT(%,#{name},%)
        </if>
        <if test="currPage != null and currPage != ‘‘ and pageSize != null and pageSize != ‘‘">
            limit ${currPage - 1},${pageSize}
        </if>
    </select>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读