package com.kcim.dao.repository;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kcim.common.util.UserContext;
import com.kcim.dao.mapper.ReportColumnMapper;
import com.kcim.dao.model.ReportColumn;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @program: CostAccount
 * @description: 报表设置数据库交互
 * @author: Wang.YS
 * @create: 2023-10-17 16:18
 **/
@Repository
public class ReportColumnRepository extends ServiceImpl<ReportColumnMapper, ReportColumn> {
    public List<ReportColumn> getByReportCode(String reportCode) {
        LambdaQueryWrapper<ReportColumn> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ReportColumn::getHospId, UserContext.getHospId());
        queryWrapper.eq(ReportColumn::getReportCode,reportCode);
        return this.list(queryWrapper);
    }

    public List<ReportColumn> getByParentCode(Long columnCode) {
        LambdaQueryWrapper<ReportColumn> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ReportColumn::getHospId, UserContext.getHospId());
        queryWrapper.eq(ReportColumn::getParentColumnCode,columnCode);

        return this.list(queryWrapper);
    }
}
