dongyukun
8 天以前 95066d1bdaf67f414f01d1686e7ea9c0ebc07e26
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.xxl.job.admin.dao.XxlJobLogGlueDao">
    
    <resultMap id="XxlJobLogGlue" type="com.xxl.job.admin.core.model.XxlJobLogGlue" >
        <result column="id" property="id" />
        <result column="job_id" property="jobId" />
        <result column="glue_type" property="glueType" />
        <result column="glue_source" property="glueSource" />
        <result column="glue_remark" property="glueRemark" />
        <result column="add_time" property="addTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>
 
    <sql id="Base_Column_List">
        t.id,
        t.job_id,
        t.glue_type,
        t.glue_source,
        t.glue_remark,
        t.add_time,
        t.update_time
    </sql>
    
    <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" >
        INSERT INTO xxl_job_logglue (
            `job_id`,
            `glue_type`,
            `glue_source`,
            `glue_remark`,
            `add_time`, 
            `update_time`
        ) VALUES (
            #{jobId},
            #{glueType},
            #{glueSource},
            #{glueRemark},
            #{addTime},
            #{updateTime}
        );
        <!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
            SELECT LAST_INSERT_ID() 
        </selectKey>-->
    </insert>
    
    <select id="findByJobId" parameterType="java.lang.Integer" resultMap="XxlJobLogGlue">
        SELECT <include refid="Base_Column_List" />
        FROM xxl_job_logglue AS t
        WHERE t.job_id = #{jobId}
        ORDER BY id DESC
    </select>
    
    <delete id="removeOld" >
        DELETE FROM xxl_job_logglue
        WHERE id NOT in(
            SELECT id FROM(
                SELECT id FROM xxl_job_logglue
                WHERE `job_id` = #{jobId}
                ORDER BY update_time desc
                LIMIT 0, #{limit}
            ) t1
        ) AND `job_id` = #{jobId}
    </delete>
    
    <delete id="deleteByJobId" parameterType="java.lang.Integer" >
        DELETE FROM xxl_job_logglue
        WHERE `job_id` = #{jobId}
    </delete>
    
</mapper>