package org.springblade.estate.feign;

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.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import org.springblade.estate.entity.AccessFacePushRecords;
import org.springblade.estate.vo.AccessFacePushRecordsVO;
import org.springblade.estate.wrapper.AccessFacePushRecordsWrapper;
import org.springblade.estate.service.IAccessFacePushRecordsService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.List;
/**
 * 出入记录 client
 *
 * @author lianghanqiang
 * @since 2021-04-28
 */

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

public class AccessFacePushRecordsClient implements IAccessFacePushRecordsClient {

    private final IAccessFacePushRecordsService accessFacePushRecordsService;

        /**
     * 详情
     */
    @Override
    @GetMapping("/detail")
    public AccessFacePushRecordsVO detail(@SpringQueryMap AccessFacePushRecords accessFacePushRecords) {
        AccessFacePushRecords detail = accessFacePushRecordsService.getOne(Condition.getQueryWrapper(accessFacePushRecords));
        return AccessFacePushRecordsWrapper.build().entityVO(detail);
        }

    /**
     * 查询 出入记录
     */
    @Override
    @GetMapping("/list")
    public List<AccessFacePushRecordsVO> list(AccessFacePushRecords accessFacePushRecords) {
        return AccessFacePushRecordsWrapper.build().listVO(accessFacePushRecordsService.list(Condition.getQueryWrapper(accessFacePushRecords)));
        }



    /**
     * 新增 出入记录
     */
    @Override
    @PostMapping("/save")
    public boolean save(@Valid @RequestBody AccessFacePushRecords accessFacePushRecords) {
        return accessFacePushRecordsService.save(accessFacePushRecords);
        }

    /**
     * 修改 出入记录
     */
    @Override
    @PostMapping("/update")
    public boolean update(@Valid @RequestBody AccessFacePushRecords accessFacePushRecords) {
        return accessFacePushRecordsService.updateById(accessFacePushRecords);
        }

    /**
     * 新增或修改 出入记录
     */
    @Override
    @PostMapping("/submit")
    public boolean submit(@Valid @RequestBody AccessFacePushRecords accessFacePushRecords) {
        return accessFacePushRecordsService.saveOrUpdate(accessFacePushRecords);
        }


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


}
