wujianwei
5 天以前 849648e82e5dec96f9f30fcc9c9bd799268b1f4c
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
<?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.AccountLogMapper">
 
    <resultMap type="com.ruoyi.cwgl.domain.AccountLog" id="AccountLogResult">
        <result property="id"    column="id"    />
        <result property="headId"    column="head_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="operation"    column="operation"    />
    </resultMap>
 
    <sql id="selectAccountLogVo">
        select thisTab.id, thisTab.head_id, thisTab.create_by, thisTab.create_time, thisTab.operation from account_log AS thisTab
    </sql>
    <sql id="selectAccountLogVoCount">
        select count(0) from account_log as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="headId != null "> and thisTab.head_id = #{headId}</if>
        <if test="operation != null  and operation != ''"> and thisTab.operation = #{operation}</if>
    </sql>
 
    <!--查询-->
    <select id="selectAccountLogById" parameterType="Integer" resultMap="AccountLogResult">
        <include refid="selectAccountLogVo"/>
        where id = #{id}
    </select>
 
    <select id="selectAccountLogCount" parameterType="com.ruoyi.cwgl.domain.AccountLog" resultType="int">
        <include refid="selectAccountLogVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectAccountLogList" parameterType="com.ruoyi.cwgl.domain.AccountLog" resultMap="AccountLogResult">
        <include refid="selectAccountLogVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertAccountLog" parameterType="com.ruoyi.cwgl.domain.AccountLog"  useGeneratedKeys="true" keyProperty="id">
        insert into account_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="headId != null">head_id,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="operation != null">operation,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="headId != null">#{headId},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="operation != null">#{operation},</if>
         </trim>
    </insert>
 
    <insert id="insertAccountLogBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into account_log
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,head_id,create_by,create_time,operation,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.headId},#{item.createBy},#{item.createTime},#{item.operation},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateAccountLog" parameterType="com.ruoyi.cwgl.domain.AccountLog">
        update account_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="headId != null">head_id = #{headId},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="operation != null">operation = #{operation},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateAccountLogBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update account_log
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.headId != null">head_id = #{item.headId},</if>
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.operation != null">operation = #{item.operation},</if>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteAccountLogById" parameterType="Integer">
        delete from account_log where id = #{id}
    </delete>
    <delete id="deleteAccountLogByIds" parameterType="Integer">
        delete from account_log where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>