yangys
2024-11-21 fe82f1f9a9be911d1420fe3b018ea85dd5fff1a3
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
96
97
98
99
100
101
102
103
104
<?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.qianwen.mdc.collect.mapper.mgr.CalendarMapper">
 
    <select id="getCalendarShiftInfo" resultType="com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO">
        SELECT pc.CODE AS code,
        pcd.YEAR AS factoryYear,
        pcd.WEEK AS factoryWeek,
        pcd.MONTH AS factoryMonth,
        pcd.calendar_date AS factoryDate,
        pcd.start_time AS startTime,
        pcd.end_time AS endTime,
        DATE_FORMAT(pcd.start_time, '%Y-%m-%d') AS calendarDay,
        pcd.shift_index AS shiftIndex,
        pcd.shift_type AS shiftTimeType
        FROM blade_production_calendar pc
        INNER JOIN blade_production_calendar_daytime pcd ON pc.id = pcd.calendar_id
        WHERE pc.YEAR = #{year}
        and DATE_FORMAT(pcd.start_time, '%Y-%m-%d') = #{dateTime}
        and pc.is_deleted = 0
        and code in
        <foreach collection="calendarCodeList" item="code" open="(" separator="," close=")">
            #{code}
        </foreach>
    </select>
    <!-- 
    <select id="getCalendarShiftInfo" resultType="com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO" databaseId="oracle">
        SELECT pc.CODE AS code,
        pcd.YEAR AS factoryYear,
        pcd.WEEK AS factoryWeek,
        pcd.MONTH AS factoryMonth,
        to_char(pcd.calendar_date,'yyyy-mm-dd') AS factoryDate,
        pcd.start_time AS startTime,
        pcd.end_time AS endTime,
        to_char(pcd.start_time, 'yyyy-mm-dd') AS calendarDay,
        pcd.shift_index AS shiftIndex,
        pcd.shift_type AS shiftTimeType
        FROM blade_production_calendar pc
        INNER JOIN prod_calendar_daytime pcd ON pc.id = pcd.calendar_id
        WHERE pc.YEAR = #{year}
        and to_char(pcd.start_time, 'yyyy-mm-dd') = #{dateTime}
        and pc.is_deleted = 0
        and code in
        <foreach collection="calendarCodeList" item="code" open="(" separator="," close=")">
            #{code}
        </foreach>
    </select>
 -->
    <!-- 
    <select id="getShiftIndexNameByCodeAndYear" resultType="java.lang.String">
        SELECT distinct pc.id, pc.CODE, sd.index_name
        FROM blade_production_calendar pc
                 LEFT JOIN blade_production_calendar_day pdc ON pc.id = pdc.calendar_id AND pdc.is_deleted = 0
                 LEFT JOIN blade_shift_detail sd on pdc.model_id = sd.model_id
        WHERE pc.CODE = #{calendarCode}
          AND pc.YEAR = #{year}
          AND pc.tenant_id = #{tenantId}
          AND sd.shift_index = #{shiftIndex}
          AND pc.is_deleted = 0
    </select>
 -->
    <select id="t1" resultType="java.lang.Long" >
        SELECT 1 from dual
    </select>
    
    <select id="getCalendarShiftInfoToday" resultType="com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO" >
        SELECT pc.CODE AS code,
               pcd.YEAR AS factoryYear,
               pcd.WEEK AS factoryWeek,
               pcd.MONTH AS factoryMonth,
               pcd.calendar_date AS factoryDate,
               pcd.start_time AS startTime,
               pcd.end_time AS endTime,
               DATE_FORMAT(pcd.start_time, '%Y-%m-%d') AS calendarDay,
               pcd.shift_index AS shiftIndex,
               pcd.shift_type AS shiftTimeType
        FROM blade_production_calendar pc
                 INNER JOIN blade_production_calendar_daytime pcd ON pc.id = pcd.calendar_id
        WHERE
            (DATE_FORMAT(pcd.start_time,'%Y-%m-%d')=#{dateTime} or DATE_FORMAT(pcd.end_time,'%Y-%m-%d')=#{dateTime})
          and pc.is_deleted = 0
          and code =#{calendarCode}
    </select>
    <!-- 
    <select id="getCalendarShiftInfoToday" resultType="com.qianwen.mdc.collect.dto.CalendarShiftInfoDTO"  databaseId="oracle">
        SELECT pc.CODE AS code,
               pcd.YEAR AS factoryYear,
               pcd.WEEK AS factoryWeek,
               pcd.MONTH AS factoryMonth,
               to_char(pcd.calendar_date,'yyyy-mm-dd') AS factoryDate,
               pcd.start_time AS startTime,
               pcd.end_time AS endTime,
               to_char(pcd.start_time, 'yyyy-mm-dd') AS calendarDay,
               pcd.shift_index AS shiftIndex,
               pcd.shift_type AS shiftTimeType
        FROM blade_production_calendar pc
                 INNER JOIN blade_production_calendar_daytime pcd ON pc.id = pcd.calendar_id
        WHERE
            (to_char(pcd.start_time, 'yyyy-mm-dd') = #{dateTime} or  to_char(pcd.end_time, 'yyyy-mm-dd') = #{dateTime})
          and pc.is_deleted = 0
          and code =#{calendarCode}
    </select>
 -->
</mapper>