Newer
Older
huludao / src / main / java / com / newfiber / api / pc / controller / zhz / HouseSiteController.java
package com.newfiber.api.pc.controller.zhz;

import com.newfiber.api.core.annotation.SysLog;
import com.newfiber.api.core.commons.*;
import com.newfiber.api.pc.dto.HouseSiteDto;
import com.newfiber.api.pc.model.meet.HouseSite;
import com.newfiber.api.pc.model.meet.MeetPlan;
import com.newfiber.api.pc.service.HouseSiteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Author:zzh
 * @CreateDate:2020/11/25 13:18
 * @Description:
 */
@RestController
@RequestMapping("/house")
@Api(value = "HouseSiteController",tags = "存放点管理")
public class HouseSiteController{

    @Autowired
    private HouseSiteService houseSiteService;

    @PostMapping("/queryPage")
    @ApiOperation("分页查询存放点")
    @SysLog(value = "分页查询存放点",actionType = "4")
    public ResultObj<PageResultObject<HouseSite>> queryPage(@RequestBody PageRequestObject<String> pageRequestObject){
        return new ResultObj<PageResultObject<HouseSite>>(ResultCode.OK,houseSiteService.queryPage(pageRequestObject));
    }


    @PostMapping("/queryAll")
    @ApiOperation("查询全部")
    @SysLog(actionType = "4",value = "查询全部")
    public ResultObj<List<HouseSite>> queryAll(){
        return new ResultObj<List<HouseSite>>(ResultCode.OK,houseSiteService.selectList(null));
    }

    @PostMapping("/queryHouseSiteAndSup")
    @ApiOperation("查询所有存放点以及底下对应的物资")
    @SysLog(actionType = "4",value = "查询所有存放点以及底下对应的物资")
    public ResultObj<List<HouseSite>> queryHouseSiteAndSup(){
        return new ResultObj<List<HouseSite>>(ResultCode.OK,houseSiteService.queryHouseSiteAndSup());
    }




    @PostMapping("/add")
    @ApiOperation("新增存放点")
    public ResultObj addHouseSite(@RequestBody HouseSiteDto houseSiteDto,HttpServletRequest request){
        String userNo = request.getHeader("userNo");
        houseSiteService.addHouseSite(houseSiteDto,userNo);
        return  ResultObj.ok();
    }
    @PostMapping("/selectById")
    @ApiOperation("根据主键id查找数据")
    public ResultObj<HouseSite> selectById(@RequestParam("id")Integer id){
        if(StringUtils.isEmpty(id)){
            throw new CustomException(ResultCode.PARAM_NULL);
        }
        return new ResultObj<HouseSite>(ResultCode.OK,houseSiteService.selectById(id));
    }

    @PostMapping("/update")
    @ApiOperation("修改存放点")
    public ResultObj updateHouseSite(@RequestBody HouseSiteDto houseSiteDto){
        houseSiteService.updateHouseSite(houseSiteDto);
        return ResultObj.ok();
    }

    @PostMapping("/delete")
    @ApiOperation("删除存放点")
    public ResultObj deleteHouseSite(@RequestParam("hid")Integer  hid){
        houseSiteService.deletHouseSite(hid);
        return ResultObj.ok();
    }



}