package com.chushang.inspection.project.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chushang.common.mybatis.page.CommonParam;
import com.chushang.common.mybatis.utils.PageResult;
import com.chushang.common.mybatis.utils.WrapperUtils;
import com.chushang.datascope.annotation.DataScope;
import com.chushang.inspection.project.po.InspectionDetail;
import com.chushang.inspection.project.query.InsDetailQuery;

import java.util.List;

/**
  * @auther: zhao
  * @date: 2024/6/18 15:39
  */
public interface InspectionDetailService extends IService<InspectionDetail>{


    @DataScope
    default PageResult findPage(InsDetailQuery query){
        CommonParam commonParam = CommonParam.buildPageRequest();
        LambdaQueryWrapper<InspectionDetail> detailSql = WrapperUtils.builder(query, commonParam);
        IPage<InspectionDetail> page = this.page(
                new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
                detailSql
        );
        return new PageResult(page);
    }

    void saveEntity(InspectionDetail detail);

    void updateByEntityId(InspectionDetail detail);

    void removeByEntityIds(List<Long> ids);
}
