dengzedong
2024-12-25 3ddbb6f6f8ecb625bf81b750a788e7d75309334c
提交 | 用户 | 时间
e7c126 1 <?xml version="1.0" encoding="UTF-8"?>
H 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
3     "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
4 <mapper namespace="com.xxl.job.admin.dao.XxlJobLogGlueDao">
5     
6     <resultMap id="XxlJobLogGlue" type="com.xxl.job.admin.core.model.XxlJobLogGlue" >
7         <result column="id" property="id" />
8         <result column="job_id" property="jobId" />
9         <result column="glue_type" property="glueType" />
10         <result column="glue_source" property="glueSource" />
11         <result column="glue_remark" property="glueRemark" />
12         <result column="add_time" property="addTime" />
13         <result column="update_time" property="updateTime" />
14     </resultMap>
15
16     <sql id="Base_Column_List">
17         t.id,
18         t.job_id,
19         t.glue_type,
20         t.glue_source,
21         t.glue_remark,
22         t.add_time,
23         t.update_time
24     </sql>
25     
26     <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" >
27         INSERT INTO xxl_job_logglue (
28             `job_id`,
29             `glue_type`,
30             `glue_source`,
31             `glue_remark`,
32             `add_time`, 
33             `update_time`
34         ) VALUES (
35             #{jobId},
36             #{glueType},
37             #{glueSource},
38             #{glueRemark},
39             #{addTime},
40             #{updateTime}
41         );
42         <!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
43             SELECT LAST_INSERT_ID() 
44         </selectKey>-->
45     </insert>
46     
47     <select id="findByJobId" parameterType="java.lang.Integer" resultMap="XxlJobLogGlue">
48         SELECT <include refid="Base_Column_List" />
49         FROM xxl_job_logglue AS t
50         WHERE t.job_id = #{jobId}
51         ORDER BY id DESC
52     </select>
53     
54     <delete id="removeOld" >
55         DELETE FROM xxl_job_logglue
56         WHERE id NOT in(
57             SELECT id FROM(
58                 SELECT id FROM xxl_job_logglue
59                 WHERE `job_id` = #{jobId}
60                 ORDER BY update_time desc
61                 LIMIT 0, #{limit}
62             ) t1
63         ) AND `job_id` = #{jobId}
64     </delete>
65     
66     <delete id="deleteByJobId" parameterType="java.lang.Integer" >
67         DELETE FROM xxl_job_logglue
68         WHERE `job_id` = #{jobId}
69     </delete>
70     
71 </mapper>