package com.njcn.harmonic.controller.upload;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.pojo.param.UploadDataParam;
import com.njcn.harmonic.pojo.param.upload.PmsTemUserParam;
import com.njcn.harmonic.pojo.po.upload.PmsTemUserPO;
import com.njcn.harmonic.service.upload.IPmsTemUserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
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;
import com.njcn.web.controller.BaseController;

import java.util.List;

/**
 * <p>
 * 电能质量全过程管理用户 前端控制器
 * </p>
 *
 * @author cdf
 * @since 2024-10-09
 */
@RestController
@RequestMapping("/process/pmsTemUser")
@RequiredArgsConstructor
public class PmsTemUserController extends BaseController {

    private final IPmsTemUserService iPmsTemUserService;



    @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
    @PostMapping("/addPmsTemUser")
    @ApiOperation("新增用户")
    public HttpResult<Object> addPmsTemUser(@RequestBody @Validated PmsTemUserParam param) {
        String methodDescribe = getMethodDescribe("addPmsTemUser");
        Boolean result = iPmsTemUserService.addPmsTemUser(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }


    @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE)
    @PostMapping("/updatePmsTemUser")
    @ApiOperation("修改用户")
    public HttpResult<Object> updatePmsTemUser(@RequestBody @Validated PmsTemUserParam.UpdatePmsTemUserParam param) {
        String methodDescribe = getMethodDescribe("updatePmsTemUser");
        Boolean result = iPmsTemUserService.updatePmsTemUser(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }



    @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE)
    @PostMapping("/delPmsTemUser")
    @ApiOperation("删除用户")
    public HttpResult<Object> delPmsTemUser(@RequestBody List<String> ids) {
        String methodDescribe = getMethodDescribe("delPmsTemUser");
        Boolean result = iPmsTemUserService.delPmsTemUser(ids);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/pageList")
    @ApiOperation("分页查询用户")
    public HttpResult<Page<PmsTemUserPO>> pageList(@RequestBody PmsTemUserParam.QueryPmsTemUserParam param) {
        String methodDescribe = getMethodDescribe("pageList");
        Page<PmsTemUserPO> result = iPmsTemUserService.pageList(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/selectList")
    @ApiOperation("查询下拉")
    public HttpResult<List<PmsTemUserPO>> selectList(@RequestBody PmsTemUserParam.QueryPmsTemUserParam param) {
        String methodDescribe = getMethodDescribe("selectList");
        List<PmsTemUserPO> result = iPmsTemUserService.selectList(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }



    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/upGwTemUser")
    @ApiOperation("上送国网")
    public HttpResult<Boolean> upGwTemUser(@RequestBody List<String> ids) {
        String methodDescribe = getMethodDescribe("upGwTemUser");
        iPmsTemUserService.upGwTemUser(ids);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
    }

}

