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

import com.steerinfo.ems.tcm0312.model.TCm0312;
import com.steerinfo.ems.tcm0313.mapper.TCm0313Mapper;
import com.steerinfo.ems.tcm0313.model.TCm0313;
import com.steerinfo.ems.tcm0313.service.ITCm0313Service;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

    private static final Logger LOGGER = LoggerFactory.getLogger(TCm0313ServiceImpl.class);

    @Autowired
    IdGenerator idGenerator;
    @Autowired
    private TCm0313Mapper tCm0313Mapper;

    @Override
    protected IBaseMapper<TCm0313, String> getMapper() {
        return tCm0313Mapper;
    }

    @Override
    public TCm0313 add(TCm0313 t) {
        if (t instanceof ICreatePO) {
            this.setCreate((ICreatePO)t);
        }

        this.getMapper().insert(t);
        return t;
    }

    public TCm0313 updatelimit(TCm0313 model){
        tCm0313Mapper.updatelimit(model);
        tCm0313Mapper.update0312limit(model);
        return tCm0313Mapper.selectByPrimaryKey(model.getRecordid());
    }

}
