package org.springblade.device.feign;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.utils.Func;
import org.springblade.device.entity.ElevatorDevice;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import org.springblade.device.entity.ElevatorAlarm;
import org.springblade.device.vo.ElevatorAlarmVO;
import org.springblade.device.wrapper.ElevatorAlarmWrapper;
import org.springblade.device.service.IElevatorAlarmService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.List;
/**
 *  client
 *
 * @author lianghanqiang
 * @since 2021-04-19
 */

@AllArgsConstructor
@RestController
@RequestMapping("/feign/elevatoralarm")

public class ElevatorAlarmClient implements IElevatorAlarmClient {

    private final IElevatorAlarmService elevatorAlarmService;

        /**
     * 详情
     */
    @Override
    @GetMapping("/detail")
    public ElevatorAlarmVO detail(@SpringQueryMap ElevatorAlarm elevatorAlarm) {
        ElevatorAlarm detail = elevatorAlarmService.getOne(Condition.getQueryWrapper(elevatorAlarm));
        return ElevatorAlarmWrapper.build().entityVO(detail);
        }

    /**
     * 查询
     */
    @Override
    @GetMapping("/list")
    public List<ElevatorAlarmVO> list(@SpringQueryMap ElevatorAlarm elevatorAlarm) {
        return ElevatorAlarmWrapper.build().listVO(elevatorAlarmService.list(Condition.getQueryWrapper(elevatorAlarm)));
        }



    /**
     * 新增
     */
    @Override
    @PostMapping("/save")
    public boolean save(@Valid @RequestBody ElevatorAlarm elevatorAlarm) {
        return elevatorAlarmService.save(elevatorAlarm);
        }

    /**
     * 修改
     */
    @Override
    @PostMapping("/update")
    public boolean update(@Valid @RequestBody ElevatorAlarm elevatorAlarm) {
        return elevatorAlarmService.updateById(elevatorAlarm);
        }

    /**
     * 新增或修改
     */
    @Override
    @PostMapping("/submit")
    public boolean submit(@Valid @RequestBody ElevatorAlarm elevatorAlarm) {
        return elevatorAlarmService.saveOrUpdate(elevatorAlarm);
    }


    /**
     * 删除
     */
    @Override
    @PostMapping("/remove")
    public boolean remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return elevatorAlarmService.deleteLogic(Func.toLongList(ids));
    }

	@Override
    @PostMapping("/updateById")
	public boolean updateById(@Valid @RequestBody  ElevatorAlarm elevatorAlarm) {
		return elevatorAlarmService.updateById(elevatorAlarm);
	}

	@Override
    @PostMapping("/getDirectorAndSendMsg")
	public boolean getDirectorAndSendMsg(@Valid @RequestBody  ElevatorAlarm elevatorAlarm) {
		return elevatorAlarmService.getDirectorAndSendMsg(elevatorAlarm);
	}


}
