package com.stylefeng.guns.modular.system.controller; import com.baomidou.mybatisplus.plugins.Page; import com.stylefeng.guns.core.base.controller.BaseController; import com.stylefeng.guns.modular.system.model.TPortVo; import com.stylefeng.guns.modular.system.utils.tips.SuccessTip; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; import com.stylefeng.guns.modular.system.model.TPort; import com.stylefeng.guns.modular.system.service.ITPortService; import java.util.Date; import java.util.List; /** * 控制器 * * @author fengshuonan * @Date 2022-12-29 11:53:20 */ @Controller @Api(tags = "码头") @RequestMapping("/api/tPort") public class TPortController extends BaseController { @Autowired private ITPortService tPortService; /** * 获取列表 */ @ApiOperation(value = "码头列表",notes="码头列表") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"), @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"), @ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "String"), @ApiImplicitParam(name = "countryName", value = "国家、洲、地区", required = false, dataType = "String"), @ApiImplicitParam(name = "zipCode", value = "zipCode", required = false, dataType = "String"), }) @GetMapping(value = "/list") @ResponseBody public Object list(int pageNumber,int pageSize,String name,String countryName,String zipCode) { Page tPortVoPage = new Page<>(pageNumber, pageSize); List list = tPortService.getList(tPortVoPage,name,countryName,zipCode); tPortVoPage.setRecords(list); return new SuccessTip(tPortVoPage); } /** * 新增 */ @ApiOperation(value = "新增码头",notes="新增码头") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), }) @PostMapping(value = "/add") @ResponseBody public Object add(TPort tPort) { tPort.setCreateTime(new Date()); tPortService.insert(tPort); return SUCCESS_TIP; } /** * 删除 */ @ApiOperation(value = "删除码头",notes="删除码头") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), @ApiImplicitParam(name = "tPortId", value = "码头Id", required = true, dataType = "int"), }) @DeleteMapping(value = "/delete") @ResponseBody public Object delete(@RequestParam Integer tPortId) { TPort tPort = tPortService.selectById(tPortId); tPort.setRemove(1); tPortService.updateById(tPort); return SUCCESS_TIP; } /** * 修改 */ @ApiOperation(value = "修改码头",notes="修改码头") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), }) @PostMapping(value = "/update") @ResponseBody public Object update(TPort tPort) { tPort.setUpdateTime(new Date()); tPortService.updateById(tPort); return SUCCESS_TIP; } /** * 详情 */ @RequestMapping(value = "/detail/{tPortId}") @ResponseBody public Object detail(@PathVariable("tPortId") Integer tPortId) { return tPortService.selectById(tPortId); } }