liujie
2025-09-05 a40429e0df56c94fecd29dbfb4c99cf2d393a1a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?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 =#{user.userId}
        </if>
        <if test="user.roleType != null and user.roleType == 5 ">
            and goods_source =2 and supplier_clinic_id =#{user.userId}
        </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 =#{user.userId}
        </if>
        <if test="user.roleType != null and user.roleType == 5 ">
            and goods_source =2 and supplier_clinic_id =#{user.userId}
        </if>
        order by create_time desc
    </select>
 
</mapper>