package cd.casic.ci.api;


import cd.casic.ci.process.dto.req.localAflCrashes.LocalAflCrashesQueryReq;
import cd.casic.ci.process.dto.req.localAflCrashes.LocalAflCrashesSaveReq;
import cd.casic.ci.process.dto.resp.localAflCrashes.LocalAflCrashesResp;
import cd.casic.ci.process.process.service.localAflCrashes.LocalAflCrashesService;
import cd.casic.framework.commons.pojo.CommonResult;
import cd.casic.framework.commons.pojo.PageResult;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/localAflCrashes")
public class LocalAflCrashesController {
    @Resource
    private LocalAflCrashesService localAflCrashesService;

    @PostMapping(path="/saveLocalAflCrashesInfo")
    public CommonResult<Void> saveLocalAflCrashesInfo(@RequestBody @Valid LocalAflCrashesSaveReq req){

        localAflCrashesService.saveLocalAflCrashesInfo(req);

        return CommonResult.success();
    }


    /**
     *分页模糊查询漏洞信息
     */
    @PostMapping("/search")
    public CommonResult<PageResult<LocalAflCrashesResp>> getLocalAflCrashesSearch(@RequestBody LocalAflCrashesQueryReq req) {
        PageResult<LocalAflCrashesResp> search = localAflCrashesService.getLocalAflCrashesSearch(req);
        return CommonResult.success(search);
    }
}
