admin
2024-04-09 3d28cc569ff9bdf20ac56598ae4de8e2809d6f35
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
<?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.interchange.mapper.TbCoalMineSystemMapper">
    
    <resultMap type="TbCoalMineSystem" id="TbCoalMineSystemResult">
        <result property="id"    column="id"    />
        <result property="coalMineId"    column="coal_mine_id"    />
        <result property="systemName"    column="system_name"    />
        <result property="headName"    column="head_name"    />
        <result property="headPhone"    column="head_phone"    />
        <result property="systemCode"    column="system_code"    />
        <result property="ftpUrl"    column="ftp_url"    />
    </resultMap>
 
    <sql id="selectTbCoalMineSystemVo">
        select id, coal_mine_id, system_name, head_name, head_phone, system_code, ftp_url from tb_coal_mine_system
    </sql>
 
    <select id="selectTbCoalMineSystemList" parameterType="TbCoalMineSystem" resultMap="TbCoalMineSystemResult">
        <include refid="selectTbCoalMineSystemVo"/>
        <where>  
            <if test="coalMineId != null "> and coal_mine_id = #{coalMineId}</if>
            <if test="systemName != null  and systemName != ''"> and system_name like concat('%', #{systemName}, '%')</if>
            <if test="headName != null  and headName != ''"> and head_name like concat('%', #{headName}, '%')</if>
            <if test="headPhone != null  and headPhone != ''"> and head_phone = #{headPhone}</if>
            <if test="systemCode != null  and systemCode != ''"> and system_code = #{systemCode}</if>
            <if test="ftpUrl != null  and ftpUrl != ''"> and ftp_url = #{ftpUrl}</if>
        </where>
    </select>
    
    <select id="selectTbCoalMineSystemById" parameterType="Long" resultMap="TbCoalMineSystemResult">
        <include refid="selectTbCoalMineSystemVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTbCoalMineSystem" parameterType="TbCoalMineSystem" useGeneratedKeys="true" keyProperty="id">
        insert into tb_coal_mine_system
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="coalMineId != null">coal_mine_id,</if>
            <if test="systemName != null">system_name,</if>
            <if test="headName != null">head_name,</if>
            <if test="headPhone != null">head_phone,</if>
            <if test="systemCode != null">system_code,</if>
            <if test="ftpUrl != null">ftp_url,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="coalMineId != null">#{coalMineId},</if>
            <if test="systemName != null">#{systemName},</if>
            <if test="headName != null">#{headName},</if>
            <if test="headPhone != null">#{headPhone},</if>
            <if test="systemCode != null">#{systemCode},</if>
            <if test="ftpUrl != null">#{ftpUrl},</if>
         </trim>
    </insert>
 
    <update id="updateTbCoalMineSystem" parameterType="TbCoalMineSystem">
        update tb_coal_mine_system
        <trim prefix="SET" suffixOverrides=",">
            <if test="coalMineId != null">coal_mine_id = #{coalMineId},</if>
            <if test="systemName != null">system_name = #{systemName},</if>
            <if test="headName != null">head_name = #{headName},</if>
            <if test="headPhone != null">head_phone = #{headPhone},</if>
            <if test="systemCode != null">system_code = #{systemCode},</if>
            <if test="ftpUrl != null">ftp_url = #{ftpUrl},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteTbCoalMineSystemById" parameterType="Long">
        delete from tb_coal_mine_system where id = #{id}
    </delete>
 
    <delete id="deleteTbCoalMineSystemByIds" parameterType="String">
        delete from tb_coal_mine_system where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>