OpsSysLogMapper.xml
3.2 KB
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
<?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.zhonglai.luhui.serverops.mapper.OpsSysLogMapper">
<resultMap type="OpsSysLog" id="OpsSysLogResult">
<result property="id" column="id" />
<result property="log_type" column="log_type" />
<result property="create_time" column="create_time" />
<result property="exception" column="exception" />
<result property="describe" column="describe" />
</resultMap>
<sql id="selectOpsSysLogVo">
select `id`, `log_type`, `create_time`, `exception`, `describe` from ops_sys_log
</sql>
<select id="selectOpsSysLogList" parameterType="OpsSysLog" resultMap="OpsSysLogResult">
<include refid="selectOpsSysLogVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="log_type != null and log_type != ''"> and log_type like concat('%', #{log_type}, '%')</if>
<if test="params.beginCreate_time != null and params.beginCreate_time != '' and params.endCreate_time != null and params.endCreate_time != ''"> and create_time between #{params.beginCreate_time} and #{params.endCreate_time}</if>
<if test="describe != null and describe != ''"> and `describe` like concat('%', #{describe}, '%')</if>
</where>
</select>
<select id="selectOpsSysLogById" parameterType="Integer" resultMap="OpsSysLogResult">
<include refid="selectOpsSysLogVo"/>
where id = #{id}
</select>
<insert id="insertOpsSysLog" parameterType="OpsSysLog" useGeneratedKeys="true" keyProperty="id">
insert into ops_sys_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="log_type != null">log_type,</if>
<if test="create_time != null">create_time,</if>
<if test="exception != null">`exception`,</if>
<if test="describe != null">`describe`,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="log_type != null">#{log_type},</if>
<if test="create_time != null">#{create_time},</if>
<if test="exception != null">#{exception},</if>
<if test="describe != null">#{describe},</if>
</trim>
</insert>
<update id="updateOpsSysLog" parameterType="OpsSysLog">
update ops_sys_log
<trim prefix="SET" suffixOverrides=",">
<if test="log_type != null">log_type = #{log_type},</if>
<if test="create_time != null">create_time = #{create_time},</if>
<if test="exception != null">`exception` = #{exception},</if>
<if test="describe != null">`describe` = #{describe},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOpsSysLogById" parameterType="Integer">
delete from ops_sys_log where id = #{id}
</delete>
<delete id="deleteOpsSysLogByIds" parameterType="String">
delete from ops_sys_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>