wujianwei
2025-09-09 deb890911f16f28d0caf0edd7b96e8082bdd306d
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?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.cwgl.mapper.RequestLogMapper">
 
    <resultMap type="com.ruoyi.cwgl.domain.RequestLog" id="RequestLogResult">
        <result property="id"    column="id"    />
        <result property="driverCode"    column="driver_code"    />
        <result property="driverName"    column="driver_name"    />
        <result property="boxNum"    column="box_num"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="reqTime"    column="req_time"    />
        <result property="type"    column="type"    />
        <result property="operation"    column="operation"    />
    </resultMap>
 
    <sql id="selectRequestLogVo">
        select thisTab.id, thisTab.driver_code, thisTab.driver_name, thisTab.box_num, thisTab.create_by, thisTab.create_time, thisTab.req_time, thisTab.type, thisTab.operation from request_log AS thisTab
    </sql>
    <sql id="selectRequestLogVoCount">
        select count(0) from request_log as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="driverCode != null  and driverCode != ''"> and thisTab.driver_code = #{driverCode}</if>
        <if test="driverName != null  and driverName != ''"> and  thisTab.driver_name like concat('%', #{driverName}, '%')</if>
        <if test="boxNum != null  and boxNum != ''"> and thisTab.box_num = #{boxNum}</if>
        <if test="reqTime != null "> and thisTab.req_time = #{reqTime}</if>
        <if test="type != null "> and thisTab.type = #{type}</if>
        <if test="operation != null  and operation != ''"> and thisTab.operation = #{operation}</if>
    </sql>
 
    <!--查询-->
    <select id="selectRequestLogById" parameterType="Integer" resultMap="RequestLogResult">
        <include refid="selectRequestLogVo"/>
        where id = #{id}
    </select>
 
    <select id="selectRequestLogCount" parameterType="com.ruoyi.cwgl.domain.RequestLog" resultType="int">
        <include refid="selectRequestLogVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectRequestLogList" parameterType="com.ruoyi.cwgl.domain.RequestLog" resultMap="RequestLogResult">
        <include refid="selectRequestLogVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertRequestLog" parameterType="com.ruoyi.cwgl.domain.RequestLog"  useGeneratedKeys="true" keyProperty="id">
        insert into request_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="driverCode != null">driver_code,</if>
            <if test="driverName != null">driver_name,</if>
            <if test="boxNum != null">box_num,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="reqTime != null">req_time,</if>
            <if test="type != null">type,</if>
            <if test="operation != null">operation,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="driverCode != null">#{driverCode},</if>
            <if test="driverName != null">#{driverName},</if>
            <if test="boxNum != null">#{boxNum},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="reqTime != null">#{reqTime},</if>
            <if test="type != null">#{type},</if>
            <if test="operation != null">#{operation},</if>
         </trim>
    </insert>
 
    <insert id="insertRequestLogBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into request_log
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,driver_code,driver_name,box_num,create_by,create_time,req_time,type,operation,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.driverCode},#{item.driverName},#{item.boxNum},#{item.createBy},#{item.createTime},#{item.reqTime},#{item.type},#{item.operation},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateRequestLog" parameterType="com.ruoyi.cwgl.domain.RequestLog">
        update request_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="driverCode != null">driver_code = #{driverCode},</if>
            <if test="driverName != null">driver_name = #{driverName},</if>
            <if test="boxNum != null">box_num = #{boxNum},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="reqTime != null">req_time = #{reqTime},</if>
            <if test="type != null">type = #{type},</if>
            <if test="operation != null">operation = #{operation},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateRequestLogBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update request_log
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.driverCode != null">driver_code = #{item.driverCode},</if>
                <if test="item.driverName != null">driver_name = #{item.driverName},</if>
                <if test="item.boxNum != null">box_num = #{item.boxNum},</if>
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.reqTime != null">req_time = #{item.reqTime},</if>
                <if test="item.type != null">type = #{item.type},</if>
                <if test="item.operation != null">operation = #{item.operation},</if>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteRequestLogById" parameterType="Integer">
        delete from request_log where id = #{id}
    </delete>
    <delete id="deleteRequestLogByIds" parameterType="Integer">
        delete from request_log where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>