33 lines
1.8 KiB
XML
33 lines
1.8 KiB
XML
<?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.openhis.administration.mapper.DeviceDefinitionMapper">
|
||
|
||
<!-- 根据关键字查询 如果关键字为空,查询10条,否则返回查询到的所有 -->
|
||
<select id="searchDeviceListByKeyWord" resultType="com.openhis.medication.dto.AdjustPriceMedListDto">
|
||
select df.id as targetId, df.name as name, df.size as volume, details.amount as
|
||
originRetailPrice,def_details.amount as originBuyingPrice,df.bus_no as busNo,df.min_unit_code as unitCode
|
||
from adm_device_definition df
|
||
inner join adm_charge_item_definition actd on actd.instance_id = df.id
|
||
left join adm_charge_item_def_detail details on actd.id = details.definition_id
|
||
and details.id = (select cidd.id from adm_charge_item_def_detail cidd where actd.id = cidd.definition_id and
|
||
cidd.condition_code = '5' and cidd.delete_flag = '0' ORDER BY create_time DESC
|
||
LIMIT 1)
|
||
left join adm_charge_item_def_detail def_details on actd.id = def_details.definition_id
|
||
and def_details.id = (select cidd.id from adm_charge_item_def_detail cidd where actd.id = cidd.definition_id and
|
||
cidd.condition_code = '1' and cidd.delete_flag = '0' ORDER BY create_time DESC
|
||
LIMIT 1)
|
||
WHERE 1 = 1 and df.id in (select inventoty.item_id FROM wor_inventory_item inventoty where
|
||
inventoty.quantity > 0 and inventoty.delete_flag = '0' )
|
||
<if test="keyWord == ''">
|
||
limit 10
|
||
</if>
|
||
<if test="keyWord !=''">
|
||
and
|
||
(df.name like concat('%',#{keyWord},'%') or df.py_str like concat('%',#{keyWord},'%') or df.wb_str like
|
||
concat('%',#{keyWord},'%'))
|
||
</if>
|
||
</select>
|
||
|
||
</mapper> |