package com.psdc.service.impl;

import com.psdc.entity.PsdcControlLog;
import com.psdc.mapper.PsdcControlLogMapper;
import com.psdc.service.IPsdcControlLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 控制日志;(psdc_control_log)表服务实现类
 * @date : 2023-5-9
 */
@Service
public class PsdcControlLogServiceImpl implements IPsdcControlLogService {
    @Autowired
    private PsdcControlLogMapper psdcControlLogMapper;
    
    /** 
     * 通过ID查询单条数据 
     *
     * @param controlLogId 主键
     * @return 实例对象
     */
    public PsdcControlLog queryById(Integer controlLogId){
        return psdcControlLogMapper.queryById(controlLogId);
    }
    

    
    /** 
     * 新增数据
     *
     * @param psdcControlLog 实例对象
     * @return 实例对象
     */
    public PsdcControlLog insert(PsdcControlLog psdcControlLog){
        psdcControlLogMapper.insert(psdcControlLog);
        return psdcControlLog;
    }
    
    /** 
     * 更新数据
     *
     * @param psdcControlLog 实例对象
     * @return 实例对象
     */
    public PsdcControlLog update(PsdcControlLog psdcControlLog){
        psdcControlLogMapper.update(psdcControlLog);
        return queryById(psdcControlLog.getControlLogId());
    }
    
    /** 
     * 通过主键删除数据
     *
     * @param controlLogId 主键
     * @return 是否成功
     */
    public boolean deleteById(Integer controlLogId){
        int total = psdcControlLogMapper.deleteById(controlLogId);
        return total > 0;
    }

     @Override
     public List<PsdcControlLog> query(PsdcControlLog psdcControlLog) {
          return psdcControlLogMapper.queryControlLogList(psdcControlLog);
     }
 }