whycrzg
2021-05-21 06fc824fdbd64b7221656a7b591b39fd5ccacc1f
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
<?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="getPage" resultType="com.whyc.pojo.Experiment">
        select
            e.start_time,
            e.end_time,
            TIMESTAMPDIFF(MINUTE,e.start_time,e.end_time) as duration,
            e.name,
            e.type,
            u.name as username
        from
            tb_experiment e,
            tb_user u
        where e.user_id = u.id
        <if test="type !=null">
            and type = #{type}
        </if>
        <if test="startTime1 !=null">
            and start_time between #{startTime1} and #{startTime2}
        </if>
        and status = 2
    </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>