charging_pile/common/src/main/resources/mapper/SparePartrMapper.xml

27 lines
1.1 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hcy.common.mapper.sparePart.SparePartMapper">
<select id="pageList" resultType="com.hcy.common.dto.SparePartDto">
SELECT
lsp.*,
lw.warehouse_name as warehouseName
FROM
la_spare_part AS lsp
LEFT JOIN la_warehouse AS lw ON lw.id = lsp.warehouse_id and lw.is_delete = 0
<where>
lsp.is_delete = 0
and lsp.quantity > 0
<if test="param.keywords != null and param.keywords != ''">
and (lsp.spare_parts_code like concat('%',#{param.keywords},'%') or
lsp.spare_parts_name like concat('%',#{param.keywords},'%') or
lw.warehouse_name like concat('%',#{param.keywords},'%'))
</if>
<if test="param.warehouseIds != null and param.warehouseIds != ''">
and find_in_set(lw.id,#{param.warehouseIds})
</if>
</where>
</select>
</mapper>