Функциональность для работы с поизциями выглядет так
package ru.mge.estimate.controller

import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.data.domain.Page
import org.springframework.web.bind.annotation.*
import ru.mge.estimate.model.local.dto.LocalContextDto
import ru.mge.estimate.model.local.dto.PositionDto
import ru.mge.estimate.model.local.dto.SectionDto
import ru.mge.estimate.service.LocalContextService
import java.util.*

@CrossOrigin
@RestController
@Tag(name = "LocalContextController", description = "Контроллер контекста ЛСР")
@RequestMapping(path = ["/v1/estimate/{id}/local"], produces = ["application/json; charset=utf-8"])
class LocalContextController(
    private val localContextService: LocalContextService
) {
    @GetMapping("/context")
    @Operation(summary = "ЛСР получение контекста")
    fun getLocalContext(
        @PathVariable id: UUID
    ): LocalContextDto = localContextService.getContextLevel(id)

    @GetMapping("/context/sections")
    @Operation(summary = "ЛСР получение контекста. Уровень секций")
    fun getLocalContextBySections(
        @PathVariable id: UUID,
        @RequestParam(defaultValue = "0") page: Int,
        @RequestParam(defaultValue = "10") pageSize: Int,
        @RequestParam(required = false, defaultValue = "false") tsn: Boolean,
        @RequestParam(required = false, defaultValue = "false") calculations: Boolean,
    ): Page<SectionDto> = localContextService.getSections(id, page, pageSize, tsn, calculations)

    @GetMapping("/context/sections/{sectionId}/positions")
    @Operation(summary = "ЛСР получение контекста. Уровень позиций")
    fun getLocalContextByPositions(
        @PathVariable id: UUID,
        @PathVariable sectionId: UUID,
        @RequestParam(defaultValue = "0") page: Int,
        @RequestParam(defaultValue = "10") pageSize: Int,
        @RequestParam(required = false, defaultValue = "false") tsn: Boolean,
        @RequestParam(required = false, defaultValue = "false") calculations: Boolean,
    ): Page<PositionDto> = localContextService.getPositions(id, sectionId, page, pageSize, tsn, calculations)
}

   fun getPositions(estimateId: UUID, sectionId: UUID, page: Int, pageSize: Int): Page<PositionDto> {
        val pageable: Pageable = PageRequest.of(page, pageSize)
        return localPositionRepository.findAllByEstimateIdAndSectionId(estimateId, sectionId, pageable)
            .map {
                PositionDto(
                    totalWork = it.jsonPositionData.totalWork,
                    isReturnMat = it.jsonPositionData.isReturnMat,
                    comment = it.jsonPositionData.comment,
                    totalEquipment = it.jsonPositionData.totalEquipment,
                    totalPosition = it.jsonPositionData.totalPosition,
                    workersOverhead = it.jsonPositionData.workersOverhead,
                    workersProfit = it.jsonPositionData.workersProfit,
                    machinistOverheadProfit = it.jsonPositionData.workersProfit,
                    laborCosts = it.jsonPositionData.laborCosts,
                    groundVolume = it.jsonPositionData.groundVolume,
                    groundWeight = it.jsonPositionData.groundWeight,
                    garbageWeight = it.jsonPositionData.garbageWeight,
                    equipmentWeight = it.jsonPositionData.equipmentWeight,
                    tsn = it.jsonPositionData.tsn,
                )
            }
    }

@Repository
interface LocalPositionRepository : JpaRepository<LocalPosition, UUID> {
    @Query("""
        SELECT p FROM LocalPosition p 
        JOIN p.section s 
        JOIN s.localContext lc 
        WHERE lc.estimate.id = :estimateId AND s.id = :sectionId
    """)
    fun findAllByEstimateIdAndSectionId(
        @Param("estimateId") estimateId: UUID,
        @Param("sectionId") sectionId: UUID,
        pageable: Pageable
    ): Page<LocalPosition>
}

package ru.mge.estimate.model.local

import jakarta.persistence.*
import org.hibernate.annotations.JdbcTypeCode
import org.hibernate.type.SqlTypes
import ru.mge.estimate.model.BaseEntity
import ru.mge.estimate.model.Estimate
import ru.mge.estimate.model.local.dto.LocalContextBriefDto
import ru.mge.estimate.model.local.dto.SectionBriefDto


@Entity
@Table(name = "local_context")
class LocalContext(
    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "estimate_id")
    val estimate: Estimate,
    @JdbcTypeCode(SqlTypes.JSON)
    @Column(columnDefinition = "jsonb")
    val jsonContext: LocalContextBriefDto,
    @JdbcTypeCode(SqlTypes.JSON)
    @Column(columnDefinition = "jsonb")
    var jsonSectionData: List<SectionBriefDto>,
    val index: Int? = null,
    val additionNumber: Int? = null,
    val equipmentIndex: Int? = null,
    val equipmentAdditionNumber: Int? = null,
    val form19: Boolean,
    val okn: Boolean,
    val errorsCount: Int = 0
) : BaseEntity()

package ru.mge.estimate.model.local

import jakarta.persistence.*
import org.hibernate.annotations.JdbcTypeCode
import org.hibernate.type.SqlTypes
import ru.mge.estimate.model.BaseEntity
import ru.mge.estimate.model.local.dto.SectionDto

@Entity
@Table(name = "local_section")
class LocalSection(
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "local_context_id")
    val localContext: LocalContext,
    @JdbcTypeCode(SqlTypes.JSON)
    @Column(columnDefinition = "jsonb")
    var jsonSectionData: SectionDto,
    val errorsCount: Int = 0
) : BaseEntity()

package ru.mge.estimate.model.local

import jakarta.persistence.*
import org.hibernate.annotations.JdbcTypeCode
import org.hibernate.type.SqlTypes
import ru.mge.estimate.model.BaseEntity
import ru.mge.estimate.model.local.dto.PositionDto

@Entity
@Table(name = "local_position")
class LocalPosition(
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "local_section_id")
    val section: LocalSection,
    @JdbcTypeCode(SqlTypes.JSON)
    @Column(columnDefinition = "jsonb")
    val jsonPositionData: PositionDto,
    val isReturn: Boolean?,
    val errorsCountTotal: Int = 0,
    val errorsCountTsn: Int = 0,
    val errorsCountCalculation: Int = 0,
) : BaseEntity()

Как реализовать фильрацию позиций по 
включен фильтр tsn, выбираем все позиции у которых errorsCountTsn > 0
включен фильтр calculations, выбираем все позиции у которых errorsCountCalculation > 0
включены оба фильтра, выбираем все ошибки по обоим условиям