package com.goldenwater.web.controller.gx;

import java.util.List;

import com.goldenwater.common.annotation.Anonymous;
import com.goldenwater.common.core.controller.BaseController;
import com.goldenwater.common.core.domain.AjaxResult;
import com.goldenwater.gx.domain.GxStWry;
import com.goldenwater.gx.service.IGxStWryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;

@RestController
@RequestMapping("/gx/stWry")
public class GxStWryController extends BaseController {

    @Resource
    private IGxStWryService gxStWryService;

    @Anonymous
    @GetMapping("/front/latest/{bizCode}")
    public AjaxResult frontLatest(@PathVariable String bizCode) {
        return success(gxStWryService.selectWryLatestByBizCode(bizCode));
    }

    @Anonymous
    @GetMapping("/front/history")
    public AjaxResult frontHistory(
            @RequestParam(value = "bizCode") String bizCode,
            @RequestParam(value = "stnm") String stnm) {
        return success(gxStWryService.selectWryHistoryByBizCodeAndStnm(bizCode, stnm));
    }
}
