xuhy
2025-10-14 14f55cd77189bae10627277a2a3dab9cec5fcada
ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
@@ -53,33 +53,58 @@
storage,supplier_name
    </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},'%')
       t1.id
        ,  t1.supplier_clinic_id,  t1.goods_source,  t1.goods_name,  t1.goods_id_code,  t1.quasi_number,  t1.manufacturer,  t1.formulation_spec,  t1.packing_spec,  t1.type_id,  t1.goods_yards,  t1.maintenance_interval, t1.maintenance_interval_unit,  t1.low_purchase_quantity,  t1.low_unit_id,  t1.is_prescription_drug,  t1.goods_spec,  t1.warning_inventory,  t1.sales_amount,  t1.packing_unit_id,  t1.instructions_use,  t1.side_effect,  t1.clinic_purchase_price,  t1.platform_commission_price,  t1.create_time,  t1.update_time,  t1.create_by, t1.`state`,  t1.update_by,  t1.disabled,
        t1.simplified_code,
        t1.dosage_form,
        t1.usage_classification,
        t1.product_brand,
        t1.place_of_origin,
        t1.ingredient,
        t1.trait,
        t1.indication,
        t1.taboo,
        t1.precautions,
        t1.interaction,
        t1.storage,
        case t1.goods_source
        when 1 then t2.supplier_name
        when 2 then t1.supplier_name
        end as supplierName
        from t_erp_goods t1 left join t_crm_supplier t2 on t1.supplier_clinic_id = t2.id where  t1.disabled = 0
        <if test="query.supplierName != null and query.supplierName != ''">
            and  (t1.supplier_name like concat('%',#{query.supplierName},'%') or t2.supplier_name like concat('%',#{query.supplierName},'%'))
        </if>
        <if test="query.goodsName != null and query.goodsName != ''">
            and  t1.goods_name like concat('%',#{query.goodsName},'%')
        </if>
        <if test="query.goodsIdCode != null and query.goodsIdCode != ''">
            and goods_id_code like concat('%',#{query.goodsIdCode},'%')
            and  t1.goods_id_code like concat('%',#{query.goodsIdCode},'%')
        </if>
        <if test="query.typeId != null and query.typeId != ''">
            and type_id = #{query.typeId}
            and  t1.type_id = #{query.typeId}
        </if>
        <if test="query.quasiNumber != null and query.quasiNumber != ''">
            and quasi_number like concat('%',#{query.quasiNumber},'%')
            and  t1.quasi_number like concat('%',#{query.quasiNumber},'%')
        </if>
        <if test="query.state != null ">
            and state = #{query.state}
            and  t1.state = #{query.state}
        </if>
        <if test="user.roleType != null and user.roleType == 4 ">
            and goods_source =1 and supplier_clinic_id = #{query.supplierClinicId}
            and  t1.goods_source =1 and  t1.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} ) or (FIND_IN_SET(#{query.supplierClinicId},clinic_ids) and state =1))
            and  ( ( t1.goods_source =2 and  t1.supplier_clinic_id = #{query.supplierClinicId} ) or (FIND_IN_SET(#{query.supplierClinicId}, t1.clinic_ids) and  t1.state =1))
        </if>
        order by create_time desc
        order by  t1.create_time desc
    </select>
    <select id="listExport" resultType="com.ruoyi.system.vo.TErpGoodsVO">
        select
        <include refid="Base_Column_List"/>