package com.srs.comprehensive.service.impl;

import java.util.List;

import com.srs.common.utils.DateUtils;
import com.srs.comprehensive.domain.SrsZxjApprovalRecord;
import com.srs.comprehensive.domain.Vo.CphSearch;
import com.srs.comprehensive.mapper.SrsZxjApprovalRecordMapper;
import com.srs.comprehensive.service.ISrsZxjApprovalRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;


/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author srs
 * @date 2024-03-17
 */
@Service
public class SrsZxjApprovalRecordServiceImpl extends ServiceImpl<SrsZxjApprovalRecordMapper, SrsZxjApprovalRecord> implements ISrsZxjApprovalRecordService {
    @Autowired
    private SrsZxjApprovalRecordMapper srsZxjApprovalRecordMapper;

    @Override
    public List<SrsZxjApprovalRecord> listView(CphSearch param) {
        List<SrsZxjApprovalRecord> list = srsZxjApprovalRecordMapper.listView(param);
        for (int i = 0; i <list.size() ; i++) {
            Long step = list.get(i).getStep();
            if(step == 2){
                list.get(i).setStepName("辅导审核");
            }
            if(step == 3){
                list.get(i).setStepName("二级学院审核");
            }

            if(step == 4){
                list.get(i).setStepName("学校意见");
            }

            String status = list.get(i).getStatus();
            if("0".equals(status)){
                list.get(i).setStatus("拒绝");
            }
            if("1".equals(status)){
                list.get(i).setStatus("通过");
            }
            if("2".equals(status)){
                list.get(i).setStatus("驳回");
            }


        }
        return list;
    }

    /**
     * 查询【请填写功能名称】
     *
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public SrsZxjApprovalRecord selectSrsZxjApprovalRecordById(Long id) {
        return srsZxjApprovalRecordMapper.selectSrsZxjApprovalRecordById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param srsZxjApprovalRecord 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<SrsZxjApprovalRecord> selectSrsZxjApprovalRecordList(SrsZxjApprovalRecord srsZxjApprovalRecord) {
        return srsZxjApprovalRecordMapper.selectSrsZxjApprovalRecordList(srsZxjApprovalRecord);
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param srsZxjApprovalRecord 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertSrsZxjApprovalRecord(SrsZxjApprovalRecord srsZxjApprovalRecord) {
                srsZxjApprovalRecord.setCreateTime(DateUtils.getNowDate());
            return srsZxjApprovalRecordMapper.insertSrsZxjApprovalRecord(srsZxjApprovalRecord);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param srsZxjApprovalRecord 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateSrsZxjApprovalRecord(SrsZxjApprovalRecord srsZxjApprovalRecord) {
        return srsZxjApprovalRecordMapper.updateSrsZxjApprovalRecord(srsZxjApprovalRecord);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param ids 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteSrsZxjApprovalRecordByIds(Long[] ids) {
        return srsZxjApprovalRecordMapper.deleteSrsZxjApprovalRecordByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteSrsZxjApprovalRecordById(Long id) {
        return srsZxjApprovalRecordMapper.deleteSrsZxjApprovalRecordById(id);
    }
}
