package com.project.zcustom.logistics;


import com.project.zcustom.controller.core.AjaxResult;
import com.project.zcustom.controller.core.BaseController;
import com.project.zcustom.domain.addional.LargeHousingLand;
import com.project.zcustom.service.logistics.ILargeHousingLandService;
import lombok.RequiredArgsConstructor;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

@RestController
@RequestMapping("/zcustom/housing")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class LargeHousingLandController extends BaseController {

    @Autowired
    private ILargeHousingLandService largeHousingLandService;
    @GetMapping("/list")
    public AjaxResult list(LargeHousingLand entity) {
        return AjaxResult.success("查询成功", largeHousingLandService.pagingLargePlatHousingLandList(entity));
    }


    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success("查询成功", largeHousingLandService.getById(id));
    }


    @PostMapping("add")
    public AjaxResult add(@RequestBody LargeHousingLand entity) {
        return toAjax(largeHousingLandService.save(entity));
    }


    @PostMapping("edit")
    public AjaxResult edit(@RequestBody LargeHousingLand entity) {
        return toAjax(largeHousingLandService.updateById(entity));
    }


    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(largeHousingLandService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
    }

}
