package com.bonus.sharedstation.app.controller;


import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.app.service.IPropertyServiceService;
import com.bonus.sharedstation.web.domain.PropertyServiceDTO;
import com.bonus.sharedstation.web.dto.PropertyPageDTO;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
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 javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author 云归
 */
@Tag(name = "app-物业服务")
@RestController
@RequestMapping("/information/service/app")
public class PropertyServiceAppController {

    @Resource
    private IPropertyServiceService propertyServiceService;


    @PostMapping(value = "/add", produces = "application/json; charset=utf-8")
    @ApiOperation("物业服务-新增")
    public AjaxResult add(@RequestBody @Valid PropertyServiceDTO dto) {
        return propertyServiceService.insert(dto);
    }

    @PostMapping(value = "/delete", produces = "application/json; charset=utf-8")
    @ApiOperation("物业服务-删除")
    public AjaxResult deleteById(@RequestBody PropertyServiceDTO dto){
        return propertyServiceService.delete(dto);
    }

    @ApiOperation("物业服务-修改")
    @PostMapping("/update")
    public AjaxResult update(@RequestBody @Valid PropertyServiceDTO dto){
        return propertyServiceService.updateInfoById(dto);
    }

    @ApiOperation("物业服务-查询全部数据")
    @PostMapping("/getList")
    public AjaxResult getList(@RequestBody PropertyPageDTO dto){
        return propertyServiceService.getListPageApp(dto);

    }

    @PostMapping(value = "selectById", produces = "application/json; charset=utf-8")
    @ApiOperation("物业服务-查询详情")
    public AjaxResult selectInfoById(@RequestBody PropertyServiceDTO dto){
        return propertyServiceService.selectInfoById(dto);
    }


}
