
package cn.orionsec.ops.handler.exporter;

import cn.orionsec.kit.lang.utils.convert.Converts;
import cn.orionsec.kit.spring.SpringHolder;
import cn.orionsec.ops.constant.ExportType;
import cn.orionsec.ops.dao.CommandTemplateDAO;
import cn.orionsec.ops.entity.domain.CommandTemplateDO;
import cn.orionsec.ops.entity.exporter.CommandTemplateExportDTO;
import cn.orionsec.ops.entity.request.data.DataExportRequest;

import javax.servlet.http.HttpServletResponse;
import java.util.List;


public class CommandTemplateDataExporter extends AbstractDataExporter<CommandTemplateExportDTO> {

    private static final CommandTemplateDAO commandTemplateDAO = SpringHolder.getBean(CommandTemplateDAO.class);

    public CommandTemplateDataExporter(DataExportRequest request, HttpServletResponse response) {
        super(ExportType.COMMAND_TEMPLATE, request, response);
    }

    @Override
    protected List<CommandTemplateExportDTO> queryData() {
        List<CommandTemplateDO> templateList = commandTemplateDAO.selectList(null);
        return Converts.toList(templateList, CommandTemplateExportDTO.class);
    }

}
