huminmin
2026-05-15 c7e3f7809362a858d68d79df1370b37508a4d54a
src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -81,6 +81,14 @@
            <if test="c.productMainId != null">
                and ppm.id = #{c.productMainId}
            </if>
            <!-- 班组长可以看到所有关联订单的数据,成员只能看到自己的报工 -->
            <if test="currentUserId != null">
                and (
                    po.team_leader_user_id = #{currentUserId}
                    or pot.team_user_id = #{currentUserId}
                    or ppm.user_id = #{currentUserId}
                )
            </if>
        </where>
        order by ppm.create_time desc
    </select>
@@ -100,13 +108,17 @@
               ifnull(ppo.scrap_qty, 0) as scrapQty,
               date(pa.scheduling_date) as schedulingDate,
               pa.scheduling_user_name as schedulingUserName,
               cast(ifnull(ppm.work_hour, 0) as decimal(18,4)) as workHour,
               cast(ifnull(pa.work_hours, 0) as decimal(18,4)) as workHours,
               cast(
                   ifnull(pa.work_hours, 0) * ifnull(pa.finished_num, 0) *
                   case
                       when substring_index(pm.model, '*', -1) regexp '^[0-9]+(\\.[0-9]+)?$'
                       then cast(substring_index(pm.model, '*', -1) as decimal(18,4))
                       else 1
                       when poro.type = 0 then ifnull(pa.work_hours, 0) * ifnull(ppm.work_hour, 0)
                       else ifnull(pa.work_hours, 0) * ifnull(pa.finished_num, 0) *
                            case
                                when substring_index(pm.model, '*', -1) regexp '^[0-9]+(\\.[0-9]+)?$'
                                then cast(substring_index(pm.model, '*', -1) as decimal(18,4))
                                else 1
                            end
                   end
                   as decimal(18,4)
               ) as wages