13693261870
2025-07-02 7c7cb1855b7f18802f55a70fa14ed70cbdb11bab
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
<?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.terra.system.mapper.data.TaskMapper">
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_task
        <where>
            1 = 1
            <if test="name != null">
                and upper(name) like #{name}
            </if>
            <if test="status != null">
                and status = #{status}
            </if>
            <if test="type != null">
                and type = #{type}
            </if>
        </where>
    </select>
 
    <select id="selectByPage" resultType="com.terra.system.entity.data.TaskEntity">
        select a.*, fn_get_fullname(a.depcode, 1) depName, fn_get_fullname(a.dircode, 2) dirName, fn_uname(create_user) createName, fn_uname(update_user) updateName
        from lf.sys_task a
        <where>
            1 = 1
            <if test="name != null">
                and upper(name) like #{name}
            </if>
            <if test="status != null">
                and status = #{status}
            </if>
            <if test="type != null">
                and type = #{type}
            </if>
        </where>
        order by a.id desc
        limit #{limit} offset #{offset}
    </select>
 
    <select id="selectAll" resultType="com.terra.system.entity.data.TaskEntity">
        select * from lf.sys_task order by id desc;
    </select>
 
    <select id="selectById" resultType="com.terra.system.entity.data.TaskEntity">
        select * from lf.sys_task where id = #{id}
    </select>
 
    <insert id="insert" parameterType="com.terra.system.entity.data.TaskEntity">
        insert into lf.sys_task
        (name,status,type,descr,err,ip,pid,gids,depcode,dircode,create_user,create_time)
        values
        (#{name},#{status},#{type},#{descr},#{err},#{ip},#{pid},#{gids},#{depcode},#{dircode},#{createUser},now())
    </insert>
 
    <insert id="inserts">
        insert into lf.sys_task
        (name,status,type,descr,err,ip,pid,gids,depcode,dircode,create_user,create_time)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.name},#{item.status},#{item.type},#{item.descr},#{item.err},#{item.ip},#{item.pid},#{item.gids},#{item.depcode},#{item.dircode},#{item.createUser},now())
        </foreach>
    </insert>
 
    <delete id="delete">
        delete from lf.sys_task where id = #{id}
    </delete>
 
    <delete id="deletes">
        delete from lf.sys_task where id in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <update id="update">
        update lf.sys_task
        set name=#{name},status=#{status},type=#{type},descr=#{descr},err=#{err},ip=#{ip},pid=#{pid},gids=#{gids},depcode=#{depcode},dircode=#{dircode},update_user=#{updateUser},update_time=now()
        where id=#{id}
    </update>
 
    <update id="updates">
        <foreach collection="list" item="item" index="index" separator=";">
            update lf.sys_task
            set name=#{item.name},status=#{item.status},type=#{item.type},descr=#{item.descr},err=#{item.err},ip=#{item.ip},pid=#{item.pid},gids=#{item.gids},depcode=#{item.depcode},dircode=#{item.dircode},update_user=#{item.updateUser},update_time=now()
            where id = #{item.id}
        </foreach>
    </update>
</mapper>