package com.sifang.modules.completionrectification.service;

import com.jfinal.plugin.activerecord.Record;
import com.sifang.modules.completionrectification.dao.RectificationInfoDetailDao;
import com.sifang.modules.sys.common.service.BaseService;
import com.sifang.modules.sys.util.LayuiPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

@Service
public class RectificationInfoDetailService extends BaseService {

    @Autowired
    private RectificationInfoDetailDao rectificationInfoDetailDao;

    public void getRectificationResultList(LayuiPage<Record> page, Map<String, String> map) {
        List<Record> list = rectificationInfoDetailDao.getRectificationResultList(page, map);
        page.setData(list);
        page.setCount(rectificationInfoDetailDao.countRectificationResultList(map));
    }

    public String getRectificationDetailIdStr(String rectificationNo) {
        List<Record> list = rectificationInfoDetailDao.getRectificationDetailByRectificationNo(rectificationNo);
        String id = "";
        for(Record record : list){
            id += record.getStr("id") + ",";
        }
        id = id.substring(0, id.length() - 1);
        return id;
    }

}