<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>
版权声明:本文为weixin_45838279原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。