xml文件连表查询
<!-- 根据条件查询资产信息 --> <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>