whyczh
2021-06-08 bb7de58443473208d71f44a5345eac00fbda3a1e
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
<?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.whyc.mapper.ExperimentMapper" >
 
    <select id="getList" resultType="com.whyc.pojo.Experiment">
        select
            e.id,
            e.name,
            e.type,
            e.project_id,
            e.device_id,
            e.create_time,
            e.start_time,
            e.end_time,
            e.status,
            TIMESTAMPDIFF(MINUTE,e.start_time,e.end_time) as duration,
            u.name as username,
            p.name as projectName
        from
            tb_experiment e,
            tb_user u,
            tb_project p
        where e.user_id = u.id
        and e.project_id = p.id
        <if test="type !=null">
            and type = #{type}
        </if>
        <if test="startTime1 !=null">
            and e.start_time between #{startTime1} and #{startTime2}
        </if>
        <if test="status!=null">
            and e.status = #{status}
        </if>
    </select>
 
    <update id="updateFlag" parameterType="com.whyc.pojo.Experiment">
        UPDATE `db_3.5mw_web`.`tb_experiment` SET `end_time`=#{endTime},`status`='2' WHERE id=#{id};
    </update>
 
</mapper>