lxp
2025-03-15 52d79c7e5a1fb4316f34886ec336f69f56d5edb2
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?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.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours">
        <id column="id" property="id"/>
        <result column="inspection_item" property="inspectionItem"/>
        <result column="inspection_item_subclass" property="inspectionItemSubclass"/>
        <result column="sample" property="sample"/>
        <result column="overtime_order_no" property="overtimeOrderNo"/>
        <result column="overtime_work_time" property="overtimeWorkTime"/>
        <result column="overtime_amount" property="overtimeAmount"/>
        <result column="order_no" property="orderNo"/>
        <result column="work_time" property="workTime"/>
        <result column="amount" property="amount"/>
        <result column="output_work_time" property="outputWorkTime"/>
        <result column="date_time" property="dateTime"/>
        <result column="week" property="week"/>
        <result column="week_day" property="weekDay"/>
        <result column="check_id" property="checkId"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="create_user" property="createUser"/>
        <result column="update_user" property="updateUser"/>
    </resultMap>
    <select id="selectAuxiliaryOutputWorkingHours" resultType="com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursDto">
        select *
        from (
        select aowh.id,
        inspection_item,
        inspection_item_subclass,
        overtime_order_no,
        overtime_work_time,
        overtime_amount,
        order_no,
        work_time,
        amount,
        output_work_time,
        date_time,
        week,
        week_day,
        name,
        sample,
        aowh.check_id
        FROM auxiliary_output_working_hours aowh
        left join user on user.id=aowh.check_id
        WHERE 1=1
        <if test="ids !=null and ids.size()>0">
            and aowh.check_id in
            <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
        </if>
        ) A
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="selectDataByUser" resultType="com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursDto">
        select aowh.*,name
        FROM auxiliary_output_working_hours aowh
        left join user on user.id=aowh.check_id
        WHERE 1=1
        <if test="ids !=null and ids.size()>0">
            and aowh.check_id in
            <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
        </if>
    </select>
    <select id="totalHours" resultType="java.util.Map">
        select A.name,
        A.month,
        FORMAT(SUM(A.manHours), 4) AS manHours
        from(
        select user.name,
        date_time as month,
        order_no,
        sample,
        man_hour_group,
        case
        when #{type}='加班工时' then case when overtime_work_time is null then 0 else overtime_work_time end
        else case when work_time is null then 0 else work_time end
        end as manHours
        -- FORMAT(SUM(output_work_time), 4) as manHours
        from auxiliary_output_working_hours aowh
        left join user on user.id=aowh.check_id
        left join department_lims dl on depart_lims_id=dl.id
        where date_time LIKE CONCAT('%', #{month}, '%')
        <if test="ids !=null and ids.size()>0">
            and aowh.check_id in
            <foreach collection="ids" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
        </if>
        group by user.name,date_time,order_no,
        sample,
        man_hour_group
        order by user.name,date_time,order_no,
        sample,
        man_hour_group
        )A
        group by A.name,
        A.month
        order by A.name,
        A.month
    </select>
    <select id="selectListByIds" resultType="com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours">
        select * from auxiliary_output_working_hours
        where 1=1
        <if test="ids !=null and ids.size()>0">
            and check_id in
            <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
        </if>
    </select>
 
    <select id="selectLists" resultMap="BaseResultMap">
        select * from(select * from auxiliary_output_working_hours
        WHERE 1=1
        <if test="ids !=null and ids.size()>0">
            and check_id in
            <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
        </if>
        ) A
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
</mapper>