package com.steerinfo.ems.tcm0312.service.impl;

import com.github.pagehelper.util.StringUtil;
import com.steerinfo.ems.tcm0312.mapper.TCm0312Mapper;
import com.steerinfo.ems.tcm0312.model.TCm0312;
import com.steerinfo.ems.tcm0312.model.VWaterPlanId;
import com.steerinfo.ems.tcm0312.service.ITCm0312Service;
import com.steerinfo.framework.mapper.IBaseMapper;
import com.steerinfo.framework.model.ICreatePO;
import com.steerinfo.framework.service.impl.BaseServiceImpl;
import com.steerinfo.framework.utils.misc.IdGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * TCm0312服务实现：
 * @author 王金涛
 * @version 1.0-SNAPSHORT 2019-10-16 11:40
 * 类描述
 * 修订历史：
 * 日期：2019-10-16
 * 作者：王金涛
 * 参考：
 * 描述：TCm0312服务实现
 * @see null
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 */
@Service(value = "tCm0312Service")
public class TCm0312ServiceImpl extends BaseServiceImpl<TCm0312, String> implements ITCm0312Service {

    @Autowired
    IdGenerator idGenerator;
    @Autowired
    private TCm0312Mapper tCm0312Mapper;

    @Override
    protected IBaseMapper<TCm0312, String> getMapper() {
        return tCm0312Mapper;
    }

    @Override
    public TCm0312 add(TCm0312 t) {
        if (t instanceof ICreatePO) {
            this.setCreate((ICreatePO)t);
        }
        this.getMapper().insert(t);
        return t;
    }

    public List<VWaterPlanId> getPlanNameAndId(){
        List<VWaterPlanId> rows = tCm0312Mapper.getPlanNameAndId();
        return rows;
    }
    synchronized public String getMaxId(){
        return this.tCm0312Mapper.getMaxId();
    }
}
