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
<?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="org.springblade.modules.taskinfo.mapper.TaskinfoPlanMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="taskinfoPlanResultMap" type="org.springblade.modules.taskinfo.entity.TaskinfoPlanEntity">
        <result column="id" property="id"/>
        <result column="no" property="no"/>
        <result column="title" property="title"/>
        <result column="type" property="type"/>
        <result column="start_time" property="startTime"/>
        <result column="end_time" property="endTime"/>
        <result column="content" property="content"/>
        <result column="route_range" property="routeRange"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="create_dept" property="createDept"/>
    </resultMap>
 
 
    <select id="selectTaskinfoPlanPage" resultMap="taskinfoPlanResultMap">
        select id,no,title,type,start_time,end_time,content,ST_ASTEXT(route_range) as route_range,
               create_user,create_time,update_user,update_time,status,is_deleted
        from ins_taskinfo_plan
        where is_deleted = 0
        <if test="taskinfoPlan.no !=null and taskinfoPlan.no != ''">
            AND no like CONCAT('%',#{taskinfoPlan.no},'%')
        </if>
        <if test="taskinfoPlan.title !=null and taskinfoPlan.title != ''">
            AND title like CONCAT('%',#{taskinfoPlan.title},'%')
        </if>
        <if test="taskinfoPlan.startCreateTime !=null and taskinfoPlan.startCreateTime !=''">
            AND DATE_FORMAT(create_time,'%Y-%m-%d') &gt;= #{taskinfoPlan.startCreateTime}
        </if>
        <if test="taskinfoPlan.endCreateTime !=null and taskinfoPlan.endCreateTime !=''">
            AND DATE_FORMAT(create_time,'%Y-%m-%d') &lt;= #{taskinfoPlan.endCreateTime}
        </if>
    </select>
 
    <select id="getMaxNo" resultMap="taskinfoPlanResultMap">
        SELECT * from ins_taskinfo_plan where is_deleted = 0 ORDER BY create_time DESC LIMIT 1
    </select>
    <select id="getTaskInfoPlanOne" resultType="org.springblade.modules.taskinfo.entity.TaskinfoPlanEntity">
        select id,no,title,type,start_time,end_time,content,ST_ASTEXT(route_range) as route_range,
               create_user,create_time,update_user,update_time,status,create_dept,is_deleted from ins_taskinfo_plan
        where id = #{id} and is_deleted = 0
    </select>
 
    <insert id="saveTaskinfoPlan">
        INSERT INTO ins_taskinfo_plan (id, no, title, type, start_time,end_time,content,
        <if test="taskinfoPlan.routeRange!=null and taskinfoPlan.routeRange!=''">
            route_range,
        </if>
        create_user,create_time,
        update_user, update_time,
        status, is_deleted,
        tenant_id,create_dept)
        VALUES
        (#{taskinfoPlan.id},#{taskinfoPlan.no},#{taskinfoPlan.title},#{taskinfoPlan.type},#{taskinfoPlan.startTime},#{taskinfoPlan.endTime},#{taskinfoPlan.content},
        <if test="taskinfoPlan.routeRange!=null and taskinfoPlan.routeRange!=''">
            ST_GeomFromText(${taskinfoPlan.routeRange}),
        </if>
       #{taskinfoPlan.createUser},#{taskinfoPlan.createTime},
        #{taskinfoPlan.updateUser},#{taskinfoPlan.updateTime},
        #{taskinfoPlan.status},#{taskinfoPlan.isDeleted},
        #{taskinfoPlan.tenantId},#{taskinfoPlan.createDept})
    </insert>
 
    <update id="updateTaskinfoPlan">
        UPDATE ins_taskinfo_plan SET
        title = #{taskinfoPlan.title},
        type = #{taskinfoPlan.type},
        start_time = #{taskinfoPlan.startTime},
        end_time = #{taskinfoPlan.endTime},
        content = #{taskinfoPlan.content},
        <if test="taskinfoPlan.routeRange!=null and taskinfoPlan.routeRange!=''">
            route_range = ST_GeomFromText(${taskinfoPlan.routeRange}),
        </if>
        tenant_id = #{taskinfoPlan.tenantId},
        create_user = #{taskinfoPlan.createUser},
        create_dept = #{taskinfoPlan.createDept},
        create_time = #{taskinfoPlan.createTime},
        update_user = #{taskinfoPlan.updateUser},
        update_time = #{taskinfoPlan.updateTime},
        status = #{taskinfoPlan.status}
        WHERE id = #{taskinfoPlan.id} AND is_deleted = 0
    </update>
 
 
</mapper>