<?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.ruoyi.system.mapper.TErpGoodsMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ruoyi.system.model.TErpGoods">
|
<id column="id" property="id"/>
|
<result column="supplier_clinic_id" property="supplierClinicId"/>
|
<result column="goods_source" property="goodsSource"/>
|
<result column="clinic_id" property="clinicId"/>
|
<result column="goods_name" property="goodsName"/>
|
<result column="goods_id_code" property="goodsIdCode"/>
|
<result column="quasi_number" property="quasiNumber"/>
|
<result column="manufacturer" property="manufacturer"/>
|
<result column="formulation_spec" property="formulationSpec"/>
|
<result column="packing_spec" property="packingSpec"/>
|
<result column="type_id" property="typeId"/>
|
<result column="goods_yards" property="goodsYards"/>
|
<result column="maintenance_interval" property="maintenanceInterval"/>
|
<result column="low_purchase_quantity" property="lowPurchaseQuantity"/>
|
<result column="low_unit_id" property="lowUnitId"/>
|
<result column="is_prescription_drug" property="isPrescriptionDrug"/>
|
<result column="goods_spec" property="goodsSpec"/>
|
<result column="warning_inventory" property="warningInventory"/>
|
<result column="sales_amount" property="salesAmount"/>
|
<result column="packing_unit_id" property="packingUnitId"/>
|
<result column="instructions_use" property="instructionsUse"/>
|
<result column="side_effect" property="sideEffect"/>
|
<result column="clinic_purchase_price" property="clinicPurchasePrice"/>
|
<result column="platform_commission_price" property="platformCommissionPrice"/>
|
<result column="create_time" property="createTime"/>
|
<result column="update_time" property="updateTime"/>
|
<result column="create_by" property="createBy"/>
|
<result column="update_by" property="updateBy"/>
|
<result column="disabled" property="disabled"/>
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id
|
, supplier_clinic_id, goods_source, goods_name, goods_id_code, quasi_number, manufacturer, formulation_spec, packing_spec, type_id, goods_yards, maintenance_interval, low_purchase_quantity, low_unit_id, is_prescription_drug, goods_spec, warning_inventory, sales_amount, packing_unit_id, instructions_use, side_effect, clinic_purchase_price, platform_commission_price, create_time, update_time, create_by,`state`, update_by, disabled,
|
simplified_code,
|
dosage_form,
|
usage_classification,
|
product_brand,
|
place_of_origin,
|
ingredient,
|
trait,
|
indication,
|
taboo,
|
precautions,
|
interaction,
|
storage
|
|
</sql>
|
<select id="pageList" resultType="com.ruoyi.system.vo.TErpGoodsVO">
|
select
|
<include refid="Base_Column_List"/>
|
from t_erp_goods where disabled = 0
|
<if test="query.goodsName != null and query.goodsName != ''">
|
and goods_name like concat('%',#{query.goodsName},'%')
|
</if>
|
<if test="query.goodsIdCode != null and query.goodsIdCode != ''">
|
and goods_id_code like concat('%',#{query.goodsIdCode},'%')
|
</if>
|
<if test="query.typeId != null and query.typeId != ''">
|
and type_id = #{query.typeId}
|
</if>
|
<if test="query.quasiNumber != null and query.quasiNumber != ''">
|
and quasi_number like concat('%',#{query.quasiNumber},'%')
|
</if>
|
<if test="query.state != null ">
|
and state = #{query.state}
|
</if>
|
<if test="user.roleType != null and user.roleType == 4 ">
|
and goods_source =1 and supplier_clinic_id = #{query.supplierClinicId}
|
</if>
|
<if test="user.roleType != null and user.roleType == 5 ">
|
and goods_source =2 and supplier_clinic_id = #{query.supplierClinicId}
|
</if>
|
order by create_time desc
|
</select>
|
<select id="listExport" resultType="com.ruoyi.system.vo.TErpGoodsVO">
|
select
|
<include refid="Base_Column_List"/>
|
from t_erp_goods where disabled = 0
|
<if test="query.goodsName != null and query.goodsName != ''">
|
and goods_name like concat('%',#{query.goodsName},'%')
|
</if>
|
<if test="query.goodsIdCode != null and query.goodsIdCode != ''">
|
and goods_id_code like concat('%',#{query.goodsIdCode},'%')
|
</if>
|
<if test="query.typeId != null and query.typeId != ''">
|
and type_id = #{query.typeId}
|
</if>
|
<if test="query.quasiNumber != null and query.quasiNumber != ''">
|
and quasi_number like concat('%',#{query.quasiNumber},'%')
|
</if>
|
<if test="query.state != null ">
|
and state = #{query.state}
|
</if>
|
<if test="user.roleType != null and user.roleType == 4 ">
|
and goods_source =1 and supplier_clinic_id =#{query.supplierClinicId}
|
</if>
|
<if test="user.roleType != null and user.roleType == 5 ">
|
and goods_source =2 and supplier_clinic_id =#{query.supplierClinicId}
|
</if>
|
order by create_time desc
|
</select>
|
|
|
<select id="pageInventoryGoodsPageList" resultType="com.ruoyi.system.vo.TErpGoodsInventoryVO">
|
select * from (
|
SELECT t1.id,t2.warehouse_no,
|
t3.goods_name,
|
t4.supplier_name,
|
t3.type_id,
|
t3.packing_unit_id,
|
t3.quasi_number,
|
t3.goods_id_code,
|
t1.batch_number,
|
coalesce(sum(t5.outbound_count),0) as outbound_count,
|
t1.warehousing_number,
|
t2.create_time,
|
t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num,
|
t3.sales_amount,
|
t1.expiry_date
|
from t_erp_supplier_warehousing_batch t1
|
LEFT JOIN t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id
|
LEFT JOIN t_erp_goods t3 on t2.goods_id = t3.id
|
LEFT JOIN t_crm_supplier t4 on t3.supplier_clinic_id = t4.id
|
LEFT JOIN t_erp_supplier_outbound_goods t5 on t5.warehousing_batch_id =t1.id
|
where t2.disabled = 0 and t2.warehouse_id = #{query.warehouseId}
|
<if test="query.type != null and query.type ==1">
|
and #{time} > t1.expiry_date
|
</if>
|
<if test="query.goodsName != null and query.goodsName != ''">
|
and t3.goods_name like concat('%',#{query.goodsName},'%')
|
</if>
|
<if test="user.roleType !=null and user.roleType ==4">
|
and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=1
|
</if>
|
<if test="user.roleType !=null and user.roleType ==5">
|
and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=2
|
</if>
|
<if test="query.supplierName != null and query.supplierName != ''">
|
and t4.supplier_name like concat('%',#{query.supplierName},'%')
|
</if>
|
|
<if test="query.typeId != null and query.typeId != ''">
|
and t3.type_id = #{query.typeId}
|
</if>
|
<if test="query.quasiNumber != null and query.quasiNumber != ''">
|
and t3.quasi_number =#{query.quasiNumber}
|
</if>
|
<if test="query.batchNumber != null and query.batchNumber != ''">
|
and t1.batch_number =#{query.batchNumber}
|
</if>
|
<if test="query.warehouseNo != null and query.warehouseNo != ''">
|
and t2.warehouse_no = #{query.warehouseNo}
|
</if>
|
) as o
|
where (o.warehousing_number -o.outbound_count) >0
|
order by o.create_time desc
|
</select>
|
|
</mapper>
|