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

import com.github.pagehelper.Page;
import com.github.pagehelper.page.PageMethod;
import net.northking.cctp.common.db.DefaultPagination;
import net.northking.cctp.common.db.OrderBy;
import net.northking.cctp.common.db.Pagination;
import net.northking.cctp.common.http.QueryByPage;
import net.northking.cctp.scriptcase.db.dao.MdBusComponentInfoDao;
import net.northking.cctp.scriptcase.db.service.MdBusComponentInfoService;
import net.northking.cctp.scriptcase.db.entity.MdBusComponentInfo;

import net.northking.cctp.common.db.BasicDao;
import net.northking.cctp.common.saas.db.TenantEntityService;

import net.northking.cctp.scriptcase.dto.component.MdBusComponentInfoDetailDto;
import net.northking.cctp.scriptcase.dto.component.MdBusComponentInfoQueryDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 业务组件表_编辑
 *
 * <p>文件内容由代码生成器产生，请不要手动修改！ <br>
 * createdate:  2022-09-21 17:09:46  <br>
 * @author:  maven-cctp-plugin  <br>
 * @since:  1.0 <br>
 */
@Service
@ConditionalOnMissingBean(name = "MdBusComponentInfoServiceImpl")
public class MdBusComponentInfoServiceImpl extends TenantEntityService<MdBusComponentInfo> implements MdBusComponentInfoService
{
private static final Logger logger = LoggerFactory.getLogger(MdBusComponentInfoServiceImpl.class);

  private final MdBusComponentInfoDao mdBusComponentInfoDao;

  public MdBusComponentInfoServiceImpl(MdBusComponentInfoDao mdBusComponentInfoDao) {this.mdBusComponentInfoDao = mdBusComponentInfoDao;}

  public BasicDao<MdBusComponentInfo> getDao() {return mdBusComponentInfoDao;}

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

  @Override
  public Pagination<MdBusComponentInfoDetailDto> pagingQueryNew(QueryByPage<MdBusComponentInfoQueryDto> queryByPage) {
    int pageNo = queryByPage.getPageNo();
    int pageSize = queryByPage.getPageSize();
    OrderBy orderBy = queryByPage.toSqlOrderBy();
    MdBusComponentInfoQueryDto query = queryByPage.getQuery();
    if (pageNo <= 0) {
      pageNo = 1;
    }
    if (pageSize <= 0 || pageSize > 500) {
      pageSize = 500;
    }
    DefaultPagination<MdBusComponentInfoDetailDto> pagination = new DefaultPagination();
    pagination.setPageSize(pageSize);
    pagination.setPageNo(pageNo);
    OrderBy sort = orderBy;
    if (orderBy == null || orderBy.isEmpty()) {
    }

    if (sort != null && sort.isNotEmpty()) {
      PageMethod.orderBy(sort.toString());
    }
    Page<MdBusComponentInfoDetailDto> page = PageMethod.startPage(pageNo, pageSize);
    initTenantId(query);
    List result = mdBusComponentInfoDao.pagingQuery(query);
    pagination.setRecords(result);
    pagination.setRecordCount(page.getTotal());
    return pagination;
  }

  @Override
  public Integer queryCountByTreeCase(MdBusComponentInfo checkCount) {
    initTenantId(checkCount);
    return mdBusComponentInfoDao.queryCountByTreeCase(checkCount);
  }

  @Override
  public String deleteByIdList(List<String> ids) {
    return mdBusComponentInfoDao.deleteByIdList(ids);
  }

  @Override
  public String getMaxCopyComName(MdBusComponentInfo copy) {
    initTenantId(copy);
    return mdBusComponentInfoDao.getMaxCopyComName(copy);
  }

  @Override
  public Integer updateInfoByIds(MdBusComponentInfo update, List<String> ids) {
    initTenantId(update);
    initBeforeUpdate(update);
    return mdBusComponentInfoDao.updateInfoByIds(update,ids);
  }

  @Override
  public List<MdBusComponentInfoDetailDto> queryComListByType(MdBusComponentInfo comQuery, List<Integer> types) {
    initTenantId(comQuery);
    return mdBusComponentInfoDao.queryComListByType(comQuery,types);
  }

  @Override
  public List<MdBusComponentInfoDetailDto> queryComInfoByIdList(List<String> ids) {
    return mdBusComponentInfoDao.queryComInfoByIdList(ids);
  }

    @Override
    public List<String> selectManagerByProject(String projectId) {
        return mdBusComponentInfoDao.selectManagerByProject(projectId);
    }

    @Override
    public List<String> selectCreatorByProject(String projectId) {
      return mdBusComponentInfoDao.selectCreatorByProject(projectId);
    }

    @Override
    public List<String> selectUpdaterByProject(String projectId) {
      return mdBusComponentInfoDao.selectUpdaterByProject(projectId);
    }
// ----      The End by Generator     ----//




}

