/*
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
*
*/
package net.northking.cctp.device.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.Pagination;
import net.northking.cctp.common.db.entity.EntityService;
import net.northking.cctp.common.http.QueryByPage;
import net.northking.cctp.device.db.dao.CdDeviceModelDao;
import net.northking.cctp.device.db.service.CdDeviceModelService;
import net.northking.cctp.device.db.entity.CdDeviceModel;

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

import net.northking.cctp.device.dto.model.CdDeviceModelDetailDto;
import net.northking.cctp.device.dto.model.CdDeviceModelQueryDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * 设备型号管理表
 *
 * <p>文件内容由代码生成器产生，请不要手动修改！ <br>
 * createdate:  2022-09-13 09:48:56  <br>
 * @author:  maven-cctp-plugin  <br>
 * @since:  1.0 <br>
 */
@Service
@ConditionalOnMissingBean(name = "CdDeviceModelServiceImpl")
public class CdDeviceModelServiceImpl extends EntityService<CdDeviceModel> implements CdDeviceModelService
{
private static final Logger logger = LoggerFactory.getLogger(CdDeviceModelServiceImpl.class);

  private final CdDeviceModelDao cdDeviceModelDao;

  public CdDeviceModelServiceImpl(CdDeviceModelDao cdDeviceModelDao) {this.cdDeviceModelDao = cdDeviceModelDao;}

  public BasicDao<CdDeviceModel> getDao() {return cdDeviceModelDao;}

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

  @Override
  public Pagination<CdDeviceModelDetailDto> pageQuery(QueryByPage<CdDeviceModelQueryDto> dto) {
    DefaultPagination<CdDeviceModelDetailDto> pagination = new DefaultPagination<>();
    Page<CdDeviceModelDetailDto> page = PageMethod.startPage(dto.getPageNo(), dto.getPageSize());
    List<CdDeviceModelDetailDto> resultList = this.cdDeviceModelDao.pageQuery(dto.getQuery());
    pagination.setPageNo(dto.getPageNo());
    pagination.setPageSize(dto.getPageSize());
    pagination.setRecords(resultList);
    pagination.setRecordCount(page.getTotal());
    return pagination;
  }

  @Override
  public Integer checkOnlyModel(CdDeviceModel cdDeviceModel) {
    Integer result = this.cdDeviceModelDao.checkOnlyModel(cdDeviceModel);
    return result;
  }

  @Override
  public List<Map<String, String>> getDeviceCondition(Map<String, Object> queryMap) {
    return cdDeviceModelDao.getDeviceConditionWithStatus(queryMap);
  }


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




}

