package cn.com.ctop.common.module.service.impl;

import cn.com.ctop.common.module.entity.Project;
import cn.com.ctop.common.module.mapper.ProjectMapper;
import cn.com.ctop.common.module.service.IProjectService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 项目
 *
 * @author jeecg-boot
 * @version V1.0
 * @date 2019-11-19
 */
@Service
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements IProjectService {
    @Autowired
    private ProjectMapper projectMapper;

    @Override
    public List<Project> listByMediaType(int projectType, int checkLink) {
        QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("media_id", projectType);
        queryWrapper.eq("check_link", checkLink);
        queryWrapper.orderByDesc("id");
        return this.list(queryWrapper);
    }

    @Override
    public String getNameByAccountId(Long accountId) {
        return projectMapper.getNameByAccountId(accountId);
    }

    @Override
    public String getSupplierCodeById(Long projectId) {
        return projectMapper.querySupplierCodeById(projectId);
    }
}
