package thyyxxk.webserver.service.lc.project;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import thyyxxk.webserver.dao.his.lc.project.LcProjectAliasDao;
import thyyxxk.webserver.entity.lc.company.LcCompany;
import thyyxxk.webserver.entity.lc.company.LcCompanyParam;
import thyyxxk.webserver.entity.lc.project.LcProjectAlias;

import java.util.List;
import java.util.UUID;

@Slf4j
@Service
public class LcProjectAliasService {

    @Autowired
    private LcProjectAliasDao dao;

    public LcProjectAlias getLcProjectAliasById(String id) {
        return dao.selectById(id);
    }

    public List<LcProjectAlias> getLcProjectAliasList(LcProjectAlias lcProjectAlias) {
        LambdaQueryWrapper<LcProjectAlias> queryWrapper = new LambdaQueryWrapper<>();
        if (StringUtils.isNotBlank(lcProjectAlias.getLcProjectId())) {
            queryWrapper.eq(LcProjectAlias::getLcProjectId, lcProjectAlias.getLcProjectId());
        }

        return dao.selectList(queryWrapper);
    }

    public int insertLcProjectAlias(LcProjectAlias lcProjectAlias) {
        lcProjectAlias.setId(UUID.randomUUID().toString().replace("-", ""));
        return dao.insert(lcProjectAlias);
    }
}
