<select id="getGoodsInventoryList" resultMap="BaseResultMap">
SELECT
*
FROM
t_goods
LEFT JOIN t_goods_type ON t_goods.goods_type_id = t_goods_type.goods_type_id
<where>
<if test="codeOrName != null and codeOrName != ''">
AND
(
t_goods.goods_name LIKE CONCAT('%', #{codeOrName} ,'%') OR
t_goods.goods_code LIKE CONCAT('%', #{codeOrName} ,'%')
)
</if>
<if test="goodsTypeId != null and goodsTypeId != 1">
AND
(
t_goods.goods_type_id = #{goodsTypeId} OR
t_goods_type.p_id = #{goodsTypeId}
)
</if>
</where>
LIMIT #{offSet}, #{pageRow}
</select>
根据多个条件查询 (上)
根据一个条件查询 (下)
<select id="getSupplierList" resultMap="BaseResultMap">
SELECT
*
FROM
t_supplier
<where>
<if test="supplierName != null and supplierName != ''">
t_supplier.supplier_name LIKE CONCAT('%', #{supplierName} ,'%')
</if>
</where>
LIMIT #{offSet}, #{pageRow}
</select>