zhaowenxuan
2025-02-06 06c12d2b42c343798d9476be66031b48967df639
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
109
110
111
112
<?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.ltkj.hosp.mapper.TbTransitionMapper">
 
    <resultMap type="TbTransition" id="TbTransitionResult">
        <result property="id" column="id"/>
        <result property="cusId" column="cus_id"/>
        <result property="pacId" column="pac_id"/>
        <result property="pacName" column="pac_name"/>
        <result property="proId" column="pro_id"/>
        <result property="proName" column="pro_name"/>
        <result property="parentProId" column="parent_pro_id"/>
        <result property="parentProName" column="parent_pro_name"/>
        <result property="ordPrice" column="ord_price"/>
        <result property="nowPrice" column="now_price"/>
    </resultMap>
 
    <sql id="selectTbTransitionVo">
        select id,
               cus_id,
               pac_id,
               pac_name,
               pro_id,
               pro_name,
               parent_pro_id,
               parent_pro_name,
               ord_price,
               now_price
        from tb_transition
    </sql>
 
    <select id="selectTbTransitionList" parameterType="TbTransition" resultMap="TbTransitionResult">
        <include refid="selectTbTransitionVo"/>
        <where>
            <if test="cusId != null ">and cus_id = #{cusId}</if>
            <if test="pacId != null ">and pac_id = #{pacId}</if>
            <if test="pacName != null  and pacName != ''">and pac_name like concat('%', #{pacName}, '%')</if>
            <if test="proId != null ">and pro_id = #{proId}</if>
            <if test="proName != null  and proName != ''">and pro_name like concat('%', #{proName}, '%')</if>
            <if test="parentProId != null ">and parent_pro_id = #{parentProId}</if>
            <if test="parentProName != null  and parentProName != ''">and parent_pro_name like concat('%',
                #{parentProName}, '%')
            </if>
            <if test="ordPrice != null ">and ord_price = #{ordPrice}</if>
            <if test="nowPrice != null ">and now_price = #{nowPrice}</if>
        </where>
    </select>
 
    <select id="selectTbTransitionById" parameterType="String" resultMap="TbTransitionResult">
        <include refid="selectTbTransitionVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertTbTransition" parameterType="TbTransition">
        insert into tb_transition
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="cusId != null">cus_id,</if>
            <if test="pacId != null">pac_id,</if>
            <if test="pacName != null">pac_name,</if>
            <if test="proId != null">pro_id,</if>
            <if test="proName != null">pro_name,</if>
            <if test="parentProId != null">parent_pro_id,</if>
            <if test="parentProName != null">parent_pro_name,</if>
            <if test="ordPrice != null">ord_price,</if>
            <if test="nowPrice != null">now_price,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="cusId != null">#{cusId},</if>
            <if test="pacId != null">#{pacId},</if>
            <if test="pacName != null">#{pacName},</if>
            <if test="proId != null">#{proId},</if>
            <if test="proName != null">#{proName},</if>
            <if test="parentProId != null">#{parentProId},</if>
            <if test="parentProName != null">#{parentProName},</if>
            <if test="ordPrice != null">#{ordPrice},</if>
            <if test="nowPrice != null">#{nowPrice},</if>
        </trim>
    </insert>
 
    <update id="updateTbTransition" parameterType="TbTransition">
        update tb_transition
        <trim prefix="SET" suffixOverrides=",">
            <if test="cusId != null">cus_id = #{cusId},</if>
            <if test="pacId != null">pac_id = #{pacId},</if>
            <if test="pacName != null">pac_name = #{pacName},</if>
            <if test="proId != null">pro_id = #{proId},</if>
            <if test="proName != null">pro_name = #{proName},</if>
            <if test="parentProId != null">parent_pro_id = #{parentProId},</if>
            <if test="parentProName != null">parent_pro_name = #{parentProName},</if>
            <if test="ordPrice != null">ord_price = #{ordPrice},</if>
            <if test="nowPrice != null">now_price = #{nowPrice},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteTbTransitionById" parameterType="String">
        delete
        from tb_transition
        where id = #{id}
    </delete>
 
    <delete id="deleteTbTransitionByIds" parameterType="String">
        delete from tb_transition where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>