zss
2025-05-26 51ec98113c6d49d0f7eec4e3c030e55e337e97db
performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml
@@ -4,7 +4,9 @@
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.AuxiliaryOutputWorkingHours">
        <id column="id" property="id"/>
        <result column="inspect_project" property="inspectProject"/>
        <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"/>
@@ -16,16 +18,19 @@
        <result column="week" property="week"/>
        <result column="week_day" property="weekDay"/>
        <result column="check" property="check"/>
        <result column="name" property="name"/>
        <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.yuanchu.mom.dto.AuxiliaryOutputWorkingHoursDto">
    <select id="selectAuxiliaryOutputWorkingHours" resultMap="BaseResultMap">
        select *
        from (
        select aowh.id,
        inspect_project,
        inspection_item,
        num,
        inspection_item_subclass,
        overtime_order_no,
        overtime_work_time,
        overtime_amount,
@@ -35,8 +40,9 @@
        output_work_time,
        date_time,
        week,
        SUBSTRING(week_day, 2) AS week_day,
        name
        week_day,
        name,
        sample
        FROM auxiliary_output_working_hours aowh
        left join user on user.id=aowh.`check`
        WHERE 1=1
@@ -51,45 +57,46 @@
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="selectDataByUser" resultType="com.yuanchu.mom.dto.AuxiliaryOutputWorkingHoursDto">
    <select id="selectDataByUser" resultMap="BaseResultMap">
        select aowh.*,name
        FROM auxiliary_output_working_hours aowh
        left join user on user.id=aowh.`check`
        WHERE 1=1
         <if test="ids !=null and ids != ''">
             and `check` in
             <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
                 #{val}
             </foreach>
         </if>
        <if test="ids !=null and ids != ''">
            and `check` 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,
        A.manHours
        FORMAT(SUM(A.manHours), 4) manHours
        from(
        select user.name,
        date_time as month,
        FORMAT(SUM(output_work_time), 2) 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
        from auxiliary_output_working_hours aowh
        left join user on user.id=aowh.`check`
        left join department_lims dl on depart_lims_id=dl.id
        where date_time LIKE CONCAT('%', #{month}, '%')
        <!--and `check` in (#{ids})-->
        <if test="ids !=null and ids != ''">
            and `check` in
            <foreach collection="ids" open="(" separator="," close=")" item="val">
                #{val}
            </foreach>
        </if>
        group by user.name,date_time
        order by user.name,date_time
        )A
        group by A.name,
        A.month
        order by A.name,
        A.month
    </select>
    <select id="selectListByIds" resultType="com.yuanchu.mom.pojo.AuxiliaryOutputWorkingHours">
        select * from auxiliary_output_working_hours
        where 1=1
        <!--and `check` in(#{ids})-->
        <if test="ids !=null and ids != ''">
            and `check` in
            <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
@@ -97,4 +104,19 @@
            </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 != ''">
            and `check` 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>