package com.stylefeng.guns.modular.system.controller;
|
|
import cn.hutool.core.date.DateField;
|
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateUtil;
|
import com.baomidou.mybatisplus.plugins.Page;
|
import com.stylefeng.guns.core.base.controller.BaseController;
|
import com.stylefeng.guns.modular.system.model.TYard;
|
import com.stylefeng.guns.modular.system.model.TYardVo;
|
import com.stylefeng.guns.modular.system.service.TYardService;
|
import com.stylefeng.guns.modular.system.utils.UserInfoUtil;
|
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.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.Date;
|
import java.util.List;
|
|
/**
|
* 控制器
|
*
|
* @author fengshuonan
|
* @Date 2023-01-09 09:51:51
|
*/
|
@Controller
|
@Api(tags = "卡车公司场地")
|
@RequestMapping("/api/yard")
|
public class TYardController extends BaseController {
|
|
@Autowired
|
private TYardService yardService;
|
|
|
/**
|
* 获取列表
|
*/
|
@ApiOperation(value = "卡车公司-场地列表", notes = "卡车公司-场地列表")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "name", value = "yardName 或者 Id", required = false, dataType = "String", paramType = "query"),
|
@ApiImplicitParam(name = "city", value = "country/state/city/zipcode", required = false, dataType = "String", paramType = "query"),
|
@ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int", paramType = "query"),
|
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int", paramType = "query"),
|
})
|
@GetMapping(value = "/list")
|
@ResponseBody
|
public Object list(String name, String city, int pageNumber, int pageSize) {
|
Page<TYardVo> tYardPage = new Page<>(pageNumber, pageSize);
|
List<TYardVo> tYardVoPage = yardService.getList(name,city,tYardPage);
|
tYardPage.setRecords(tYardVoPage);
|
return new SuccessTip(tYardPage);
|
}
|
|
|
@ApiOperation(value = "卡车公司-添加场地列表", notes = "卡车公司-添加场地列表")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
})
|
@PostMapping(value = "/addYard")
|
@ResponseBody
|
public Object addYard(@RequestBody TYard tYard) {
|
tYard.setCompanyId(UserInfoUtil.getId());
|
tYard.setCreateTime(new Date());
|
yardService.insert(tYard);
|
return new SuccessTip();
|
}
|
|
@ApiOperation(value = "卡车公司-编辑场地列表", notes = "卡车公司-编辑场地列表")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
})
|
@PostMapping(value = "/updateYard")
|
@ResponseBody
|
public Object updateYard(@RequestBody TYard tYard) {
|
yardService.updateById(tYard);
|
return new SuccessTip();
|
}
|
|
@ApiOperation(value = "卡车公司-删除场地", notes = "卡车公司-删除场地")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int", paramType = "query"),
|
})
|
@GetMapping(value = "/deleteYard")
|
@ResponseBody
|
public Object deletePowerUnitOrChassiss(int id) {
|
yardService.deleteById(id);
|
return new SuccessTip();
|
}
|
|
|
public static void main(String[] args) {
|
|
DateTime offset = DateUtil.offset(new Date(), DateField.MINUTE, 30);
|
String substring = offset.toString().split(" ")[1].substring(0, 5);
|
System.out.println(substring);
|
String s = offset.toDateStr();
|
System.out.println(s);
|
}
|
|
}
|