郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
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
<?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.gkhy.safePlatform.account.repository.schedule.WorkTimeGroupAndPeriodRelationInfoRepository" >
    <resultMap id="workTimeGroupAndPeriodRelationMap" type="com.gkhy.safePlatform.account.entity.schedule.WorkTimeGroupAndPeriodRelationInfo">
        <result property="id" column="id" jdbcType="BIGINT"></result>
        <result property="workTimeGroupId" column="work_time_group_id" jdbcType="BIGINT"></result>
        <result property="workTimePeriodId" column="work_time_period_id" jdbcType="BIGINT"></result>
    </resultMap>
 
 
    <!--查询-->
    <select id="getWorkTimeGroupAndPeriodRelation" parameterType="com.gkhy.safePlatform.account.entity.schedule.WorkTimeGroupAndPeriodRelationInfo" resultMap="workTimeGroupAndPeriodRelationMap">
        select
            id,
            work_time_group_id,
            work_time_period_id
        from schedule_work_time_group_and_period_relation
        where 1=1
        <if test="workTimeGroupId != null and workTimeGroupId != ''">
            and work_time_group_id = #{workTimeGroupId}
        </if>
        <if test="workTimePeriodId != null and workTimePeriodId != ''">
            and work_time_period_id = #{workTimePeriodId}
        </if>
    </select>
    <!--删除绑定-->
    <delete id="deleteWtgAprByWorkTimeGroupId" parameterType="java.lang.Long">
        delete from schedule_work_time_group_and_period_relation where  work_time_group_id = #{workTimeGroupId}
    </delete>
 
    <!--查询关系表和工作时间段关联数据-->
    <select id="getWorkTimePeriodRelation" resultType="com.gkhy.safePlatform.account.entity.schedule.WorkTimePeriodRelationDO">
        SELECT
            r.id AS relationId,
            r.work_time_group_id AS workTimeGroupId,
            r.work_time_period_id AS workTimePeriodId,
            p.NAME,
            p.info,
            p.start_hour,
            p.start_min,
            p.end_hour,
            p.end_min,
            p.work_hours,
            p.enable_across_day,
            p.create_by,
            p.gmt_create,
            p.create_uid,
            p.edit_by,
            p.edit_uid,
            p.gmt_modified
        FROM schedule_work_time_group_and_period_relation r
        LEFT JOIN schedule_work_time_period p
        ON r.work_time_period_id = p.id
        WHERE
            p.STATUS = 1
            <if test="workTimeGroupId != null">
                and work_time_group_id = #{workTimeGroupId}
            </if>
     </select>
</mapper>