package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.base.jx;

import cn.estsh.i3plus.ext.mes.pcn.api.base.jx.IRepairJudgeService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.impp.framework.base.controller.MesPcnBaseController;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @PROJECT_NAME: i3plus-mes-panasonic-jx
 * @DESCRIPTION:
 * @USER: xinwang.yi
 * @DATE: 2023-11-13 14:50
 */
@RestController
@RequestMapping(MesPcnExtConstWords.BASE_URL_MES_PCN_JX + "/repair-judge-type")
@Api(tags = "维修判定类型 Controller")
public class RepairJudgeController extends MesPcnBaseController {

    @Autowired
    private IRepairJudgeService repairJudgeService;

    @GetMapping(value = "/query")
    @ApiOperation(value = "按条件分页查询维修判定类型信息")
    public ResultBean queryRepairJudgeList(String organizeCode) {
        try {
            return ResultBean.success("查询成功").setResultList(repairJudgeService.queryRepairJudgeList(organizeCode))
                    .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
        } catch (ImppBusiException busExcep) {
            return ResultBean.fail(busExcep);
        } catch (Exception e) {
            return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
        }
    }

}
