456
whywhyo
2023-05-23 acfff22fdec6f230a64b8b6f61906e01cc29dd65
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetController.java
@@ -9,6 +9,7 @@
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ZfPet;
import com.ruoyi.domain.excel.ZfEconomyExcelBean;
import com.ruoyi.service.ZfPetService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -17,6 +18,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
@@ -44,6 +46,15 @@
        return zfPetService.selectPetList(zfPet, pageNum, pageSize);
    }
    /**
     * 获取导入模板
     */
    @PostMapping("/model")
    public void getExportModel(HttpServletResponse response){
        List<ZfPet> list = Collections.singletonList(new ZfPet());
        ExcelUtil<ZfPet> util = new ExcelUtil<>(ZfPet.class);
        util.exportExcel(response,list,"魅宠记录导入模板");
    }
    /**
     * 导出魅宠记录列表
@@ -54,6 +65,19 @@
    public void export(HttpServletResponse response, ZfPet zfPet)
    {
        List<ZfPet> list = zfPetService.selectByCondition(zfPet);
        log.info("导出记录为:{}",list);
        ExcelUtil<ZfPet> util = new ExcelUtil<>(ZfPet.class);
        util.exportExcel(response, list, "魅宠记录数据");
    }
    /**
     * 导出魅宠记录列表
     */
//    @PreAuthorize("@ss.hasPermi('system:property:export')")
    @Log(title = "魅宠记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export1/{ids}")
    public void export(HttpServletResponse response, @PathVariable Long[] ids)
    {
        List<ZfPet> list = zfPetService.selectByIds(ids);
        log.info("导出记录为:{}",list);
        ExcelUtil<ZfPet> util = new ExcelUtil<>(ZfPet.class);
        util.exportExcel(response, list, "魅宠记录数据");
@@ -94,7 +118,7 @@
    @PostMapping
    public AjaxResult add(@RequestBody ZfPet zfPet)
    {
        return toAjax(zfPetService.save(zfPet));
        return zfPetService.mySave(zfPet);
    }
    /**