zhangnaisong
2024-07-06 775524110885e27fe860be1feb156ca78b5040b2
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
<?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.sy.mapper.ArdTankWallMapper">
    
    <resultMap type="ArdTankWall" id="ArdTankWallResult">
        <result property="id"    column="id"    />
        <result property="wallName"    column="wall_name"    />
        <result property="wallPoi"    column="wall_poi"    />
    </resultMap>
 
    <sql id="selectArdTankWallVo">
        select id, wall_name, wall_poi from ard_tank_wall
    </sql>
 
    <select id="selectArdTankWallList" parameterType="ArdTankWall" resultMap="ArdTankWallResult">
        <include refid="selectArdTankWallVo"/>
        <where>  
            <if test="wallName != null  and wallName != ''"> and wall_name like '%'||#{wallName}||'%'</if>
            <if test="wallPoi != null  and wallPoi != ''"> and wall_poi = #{wallPoi}</if>
        </where>
        order by wall_name
    </select>
    
    <select id="selectArdTankWallById" parameterType="String" resultMap="ArdTankWallResult">
        <include refid="selectArdTankWallVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertArdTankWall" parameterType="ArdTankWall">
        insert into ard_tank_wall
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="wallName != null">wall_name,</if>
            <if test="wallPoi != null">wall_poi,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="wallName != null">#{wallName},</if>
            <if test="wallPoi != null">#{wallPoi},</if>
         </trim>
    </insert>
 
    <update id="updateArdTankWall" parameterType="ArdTankWall">
        update ard_tank_wall
        <trim prefix="SET" suffixOverrides=",">
            <if test="wallName != null">wall_name = #{wallName},</if>
            <if test="wallPoi != null">wall_poi = #{wallPoi},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteArdTankWallById" parameterType="String">
        delete from ard_tank_wall where id = #{id}
    </delete>
 
    <delete id="deleteArdTankWallByIds" parameterType="String">
        delete from ard_tank_wall where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <select id="getAllArdTankWall" resultMap="ArdTankWallResult">
        select * from ard_tank_wall order by wall_name
    </select>
 
    <select id="getArdTankWallByLockId" resultType="java.util.Map" parameterType="java.lang.String">
        select atw.id as "wallId",atw.wall_name as "wallName",atw.wall_poi as "wallPoi",
        atwl.process_type as "processType",case process_type when '-1' then '关动作'
        when '0' then '无动作' when '1' then '开动作' end as process
        from ard_tank_wall_lock atwl
        inner join ard_tank_wall atw on atwl.wall_id = atw.id
        where atwl.lock_id = #{id}
    </select>
 
    <select id="selectArdTankWallTotal" parameterType="java.lang.String" resultType="java.lang.Long">
        select count(*) from ard_tank_wall atw
        <where>
            <if test="wallName != null  and wallName != ''"> and wall_name like '%'||#{wallName}||'%'</if>
        </where>
    </select>
</mapper>