/*
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
*
*/
package net.northking.cctp.dw.db.impl;

import net.northking.cctp.dw.db.dao.BugTemplateStatusDao;
import net.northking.cctp.dw.db.service.BugTemplateStatusService;
import net.northking.cctp.dw.db.entity.BugTemplateStatus;

import net.northking.cctp.common.db.BasicDao;
import net.northking.cctp.common.db.PaginationService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


/**
 * 
 *
 * <p>文件内容由代码生成器产生，请不要手动修改！ <br>
 * createdate:  2022-01-17 11:02:43  <br>
 * @author:  maven-cctp-plugin  <br>
 * @since:  1.0 <br>
 */
@Service
@ConditionalOnMissingBean(name = "BugTemplateStatusServiceImpl")
public class BugTemplateStatusServiceImpl extends PaginationService<BugTemplateStatus> implements BugTemplateStatusService
{
private static final Logger logger = LoggerFactory.getLogger(BugTemplateStatusServiceImpl.class);

  private final BugTemplateStatusDao bugTemplateStatusDao;

  public BugTemplateStatusServiceImpl(BugTemplateStatusDao bugTemplateStatusDao) {this.bugTemplateStatusDao = bugTemplateStatusDao;}

  public BasicDao<BugTemplateStatus> getDao() {return bugTemplateStatusDao;}

  public BugTemplateStatus createEntity() { return new BugTemplateStatus();}

  @Override
  protected void beforeInsert(BugTemplateStatus bugTemplateStatus) {

  }

  @Override
  protected void beforeUpdate(BugTemplateStatus bugTemplateStatus) {

  }

  @Override
  public void deleteByProIdList(List<String> proIdList) {
    bugTemplateStatusDao.deleteByProIdList(proIdList);
  }

  @Override
  public Integer updateBugStatusByCode(String itemCode, String itemName, List<String> proIdList) {
    return bugTemplateStatusDao.updateBugStatusByCode(itemCode,itemName,proIdList);
  }

  @Override
  public List<String> getEndStatusList(String proId, int i) {
    BugTemplateStatus b=new BugTemplateStatus();
    b.setIsEndStatus(i);
    b.setProjectId(proId);
    List<BugTemplateStatus> bugTemplateStatusList = bugTemplateStatusDao.query(b);
    List<String> endStatusList=new ArrayList<>();
    if (null!=bugTemplateStatusList&&bugTemplateStatusList.size()!=0){
      bugTemplateStatusList.forEach(bugTemplateStatus -> {endStatusList.add(bugTemplateStatus.getBugStatusCode());});
    }
    return endStatusList;
  }


// ----      The End by Generator     ----//




}

