lxp
2025-03-14 4b5c6891b92a186685b713627fe6701074b67435
performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml
@@ -17,41 +17,36 @@
        <result column="date_time" property="dateTime"/>
        <result column="week" property="week"/>
        <result column="week_day" property="weekDay"/>
        <result column="check" property="check"/>
        <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>
    <sql id="selectAuxiliaryOutputWorking">
    <select id="selectAuxiliaryOutputWorkingHours" resultType="com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursDto">
        select *
        from (
        select aowh.id,
        aowh.inspection_item_class,
        aowh.inspection_item,
        aowh.inspection_item_subclass,
        aowh.overtime_order_no,
        aowh.overtime_work_time,
        aowh.overtime_amount,
        aowh.order_no,
        aowh.work_time,
        aowh.amount,
        aowh.output_work_time,
        aowh.date_time,
        aowh.week,
        aowh.week_day,
        user.name,
        aowh.sample,
        aowh.price,
        aowh.man_hour_group,
        ip.cable_tag
        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 ins_product ip on ip.id = aowh.ins_product_id
        left join user on user.id=aowh.`check`
        left join user on user.id=aowh.check_id
        WHERE 1=1
        <if test="ids !=null and ids.size() > 0">
            and `check` in
            and aowh.check_id in
            <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
@@ -60,18 +55,14 @@
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </sql>
    <select id="selectAuxiliaryOutputWorkingHours" resultType="com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursDto">
        <include refid="selectAuxiliaryOutputWorking"/>
    </select>
    <select id="selectDataByUser" resultType="com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursDto">
        select aowh.*, name, ip.cable_tag cableTag
        select aowh.*,name
        FROM auxiliary_output_working_hours aowh
        left join ins_product ip on ip.id = aowh.ins_product_id
        left join user on user.id = aowh.`check`
        left join user on user.id=aowh.check_id
        WHERE 1 = 1
        <if test="ids !=null and ids.size() > 0">
            and `check` in
            and aowh.check_id in
            <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
@@ -80,22 +71,24 @@
    <select id="totalHours" resultType="java.util.Map">
        select A.name,
        A.month,
        FORMAT(SUM(A.manHours), 4) manHours
        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
        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`
        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 != ''">
            and `check` in
        <if test="ids !=null and ids.size()>0">
            and aowh.check_id in
            <foreach collection="ids" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
@@ -115,8 +108,8 @@
    <select id="selectListByIds" resultType="com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours">
        select * from auxiliary_output_working_hours
        where 1=1
        <if test="ids !=null and ids != ''">
            and `check` in
        <if test="ids !=null and ids.size()>0">
            and check_id in
            <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
@@ -126,8 +119,8 @@
    <select id="selectLists" resultMap="BaseResultMap">
        select * from(select * from auxiliary_output_working_hours
        WHERE 1=1
        <if test="ids !=null and ids != ''">
            and `check` in
        <if test="ids !=null and ids.size()>0">
            and check_id in
            <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
@@ -136,51 +129,5 @@
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="selectAuxiliaryAllByMonth" resultType="com.ruoyi.performance.dto.AuxiliaryAllDto">
        select sum(aowh.work_time) yieldHour,
               u.name           userName,
               aowh.`check`           userId,
               #{dto.month} month
        from (SELECT *
              FROM auxiliary_output_working_hours
              GROUP BY CASE
                           WHEN man_hour_group IS NOT NULL AND man_hour_group != '' THEN man_hour_group
                           ELSE id
                  END
                     , CASE
                           WHEN man_hour_group IS NOT NULL AND man_hour_group != '' THEN order_id
                           ELSE id
                  END) aowh
                 left join user u on u.id = aowh.`check`
        where aowh.date_time between #{dto.beginDate} and #{dto.endDate}
        <if test="userIds !=null and userIds.size() > 0">
            and aowh.`check` in
            <foreach collection="userIds" index="index" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
        </if>
        group by aowh.`check`
    </select>
    <select id="selectSubsidiaryAllByMonth" resultType="com.ruoyi.performance.dto.AuxiliaryAllDto">
        select sum(awhd.reviewer_nonproductive_time) subsidiaryHour,
               u.name              userName,
               awhd.name_user      userId,
               #{dto.month} month
        from auxiliary_working_hours_day awhd
                 left join user u on u.id = awhd.name_user
        where awhd.date_time between #{dto.beginDate} and #{dto.endDate}
        and awhd.state = '已批准'
        <if test="userIds !=null and userIds.size() > 0">
            and awhd.name_user in
            <foreach collection="userIds" index="index" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
        </if>
        group by awhd.name_user
    </select>
    <!-- 查询产量工时集合 -->
    <select id="selectAuxiliaryOutputWorkingHoursList" resultType="com.ruoyi.performance.dto.AuxiliaryOutputWorkingHoursDto">
        <include refid="selectAuxiliaryOutputWorking"/>
    </select>
</mapper>