liujie
2023-05-26 f9de931c4457c2a6bfe395879e3b2f2bfd7d9692
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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.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.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();
    }
 
    @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 = "/yardInfo")
    @ResponseBody
    public Object yardInfo(int id) {
        TYard tYard = yardService.selectById(id);
        return new SuccessTip(tYard);
    }
 
 
    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);
    }
 
}