Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
3.4 kB
3
Indexable
Never
            # subline_query = self.session.query(
            #     MSILLine.id.label('subline_id'),
            #     MSILLine.name.label('subline_name'),
            #     MSILLine.parent_line.label('parent_line')
            # ).filter(MSILLine.shop_id == shop_id,
            #          MSILLine.is_subline.is_(True),
            #          MSILLine.is_deleted.isnot(True)) \
            #     .subquery()

            # query = self.session.query(
            #     LinePart.line_id,
            #     MSILLine.name.label("line_name"),
            #     LinePart.model_id,
            #     EngineModel.name.label("model_name"),
            #     LinePart.variant_id,
            #     Variant.name.label("variant_name"),
            #     LinePart.part_id,
            #     Part.name.label("part_name"),
            #     subline_query.c.subline_id,
            #     subline_query.c.subline_name,
            # ).join(Part, Part.id == LinePart.part_id) \
            #     .join(MSILLine, MSILLine.id == LinePart.line_id) \
            #     .join(EngineModel, EngineModel.id == LinePart.model_id) \
            #     .join(Variant, Variant.id == LinePart.variant_id) \
            #     .join(subline_query, LinePart.line_id == subline_query.c.parent_line) \
            #     .filter(LinePart.shop_id == shop_id) \
            #     .subquery()

            # station_query = self.session.query(
            #     query.c.line_id,
            #     query.c.line_name,
            #     query.c.model_id,
            #     query.c.model_name,
            #     query.c.variant_id,
            #     query.c.variant_name,
            #     query.c.part_id,
            #     query.c.part_name,
            #     query.c.subline_id,
            #     query.c.subline_name,
            #     Station.id.label("station_id"),
            #     Station.name.label("station_name")
            # ).join(
            #     Station,
            #     or_(
            #         and_(Station.subline_id != None, Station.subline_id == query.c.subline_id,
            #              Station.line_id == query.c.line_id),
            #         and_(Station.subline_id == None, Station.line_id == query.c.line_id)
            #     )
            # ).filter(Station.shop_id == shop_id,
            #          Station.is_deleted.isnot(True)) \
            #     .subquery()

            # equipment_query = self.session.query(
            #     station_query.c.line_id,
            #     station_query.c.line_name,
            #     station_query.c.model_id,
            #     station_query.c.model_name,
            #     station_query.c.variant_id,
            #     station_query.c.variant_name,
            #     station_query.c.part_id,
            #     station_query.c.part_name,
            #     station_query.c.subline_id,
            #     station_query.c.subline_name,
            #     station_query.c.station_id,
            #     station_query.c.station_name
            # ).join(Equipment, and_(Equipment.station_id == station_query.c.station_id,
            #                        Equipment.line_id == station_query.c.line_id)) \
            #     .filter(Equipment.shop_id == shop_id,
            #             Equipment.is_deleted.isnot(True)) \
            #     .distinct()\
            #     .all()
Leave a Comment