package com.project.zcustom.controller.backManager.engineering;


import com.project.zcustom.controller.core.AjaxResult;
import com.project.zcustom.controller.core.BaseController;
import com.project.zcustom.domain.addional.LargeIssue;
import com.project.zcustom.service.unit.ILargeIssueService;
import lombok.RequiredArgsConstructor;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

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

/**
 * 上报问题Controller
 *
 * @author change
 * @date 2024-12-30
 */
@RestController
@RequestMapping("/zcustom/issue")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class LargeIssueController extends BaseController {

    private final ILargeIssueService largeIssueService;

    @GetMapping("/list")
    public AjaxResult list(LargeIssue entity) {
        return AjaxResult.success("查询成功", largeIssueService.selectList(entity));
    }

    @GetMapping("/listAll")
    public AjaxResult listAll(LargeIssue entity) {
        return AjaxResult.success("查询成功", largeIssueService.selectLargeIssueList(entity));
    }

    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success("查询成功", largeIssueService.selectLargeIssueById(id));
    }

    @PostMapping("add")
    public AjaxResult add(@RequestBody LargeIssue entity) {
        return toAjax(largeIssueService.save(entity));
    }

    @PostMapping("edit")
    public AjaxResult edit(@RequestBody LargeIssue entity) {
        return toAjax(largeIssueService.updateById(entity));
    }

}
