lius
2023-06-08 534aec7a687ceca8120ba798ad20d80d7058ffe6
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package org.jeecg.modules.mdc.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.mdc.entity.MdcDriveTypeParamConfig;
import org.jeecg.modules.mdc.entity.MdcEquipmentType;
import org.jeecg.modules.mdc.service.IMdcDriveTypeParamConfigService;
import org.jeecg.modules.mdc.service.IMdcEquipmentTypeService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * @Description: 设备类型
 * @Author: Sake
 * @Date: 2023-03-28 15:32
 */
@Slf4j
@Api(tags = "设备类型")
@RestController
@RequestMapping("/mdc/mdcEquipmentType")
public class MdcEquipmentTypeController extends JeecgController<MdcEquipmentType, IMdcEquipmentTypeService> {
 
    @Resource
    private IMdcEquipmentTypeService mdcEquipmentTypeService;
 
    /**
     * 根据id查询
     * @param id
     * @return
     */
    @AutoLog(value = "设备类型-根据id查询")
    @ApiOperation(value = "设备类型-根据id查询", notes = "设备类型-根据id查询")
    @GetMapping("/queryById")
    public Result<?> queryById(@RequestParam(name = "id", required = true) String id){
        MdcEquipmentType mdcEquipmentType = mdcEquipmentTypeService.queryById(id);
        //查询不为空则返回数据
        return null != mdcEquipmentType ? Result.OK(mdcEquipmentType) : Result.error("未找到对应数据");
    }
 
    /**
     * 设备类型查询
     * @return
     */
    @AutoLog(value = "设备类型-设备类型查询")
    @ApiOperation(value = "设备类型-设备类型查询", notes = "设备类型-设备类型查询")
    @GetMapping("/queryEquipmentType")
    public Result<?> queryEquipmentType(){
        List<MdcEquipmentType> mdcEquipmentTypes = mdcEquipmentTypeService.queryEquipmentType();
        return Result.OK(mdcEquipmentTypes);
    }
    /**
     * 分页查询
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @AutoLog(value = "设备类型-分页查询")
    @ApiOperation(value = "设备类型-分页查询", notes = "设备类型-分页查询")
    @GetMapping("/queryWrapper")
    public Result<?> queryWrapper(MdcEquipmentType mdcEquipmentType,
                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                  HttpServletRequest req){
        Page<MdcEquipmentType> page = new Page<>(pageNo, pageSize);
        IPage<MdcEquipmentType> mdcEquipmentTypeIPage = mdcEquipmentTypeService.queryPageList(page, req);
        return Result.OK(mdcEquipmentTypeIPage);
    }
 
    /**
     * 新增
     * @param mdcEquipmentType
     * @return
     */
    @AutoLog(value = "设备类型-新增")
    @ApiOperation(value = "设备类型-新增", notes = "设备类型-新增")
    @PostMapping("/addEquipmentType")
    public Result<?> addEquipmentType(@RequestBody MdcEquipmentType mdcEquipmentType){
        boolean flag = mdcEquipmentTypeService.addEquipmentType(mdcEquipmentType);
        return flag ? Result.OK("新增成功") : Result.error("新增失败");
    }
 
    /**
     * 编辑
     * @param mdcEquipmentType
     * @return
     */
    @AutoLog(value = "设备类型-编辑")
    @ApiOperation(value = "设备类型-编辑", notes = "设备类型-编辑")
    @PutMapping("/editEquipmentType")
    public Result<?> editEquipmentType(@RequestBody MdcEquipmentType mdcEquipmentType){
        boolean flag = mdcEquipmentTypeService.editEquipmentType(mdcEquipmentType);
        return flag ? Result.OK("修改成功") : Result.error("修改失败");
    }
 
    /**
     * 根据id删除设备类型
     * @param id
     * @return
     */
    @AutoLog(value = "设备类型-根据id删除设备类型")
    @ApiOperation(value = "设备类型-根据id删除设备类型", notes = "设备类型-根据id删除设备类型")
    @DeleteMapping("/deleteEquipmentType")
    public Result<?> deleteEquipmentType(@RequestParam(name = "id", required = true) String id){
        boolean flag = mdcEquipmentTypeService.deleteEquipmentType(id);
        return flag ? Result.OK("删除成功") : Result.error("删除失败");
    }
 
    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "设备类型-批量删除")
    @ApiOperation(value = "设备类型-批量删除", notes = "设备类型-批量删除")
    @DeleteMapping(value = "/deleteBatchEquipmentType")
    public Result<?> deleteBatchEquipmentType(@RequestParam(name = "ids", required = true) String ids) {
        boolean flag = mdcEquipmentTypeService.deleteBatchEquipmentType(ids);
        return flag ? Result.OK("批量删除成功") : Result.error("删除失败");
    }
 
    /**
     * 导出excel
     * @param request
     * @param mdcEquipmentType
     * @return
     */
    @RequestMapping("/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentType mdcEquipmentType){
        return super.exportXls(request, mdcEquipmentType, MdcEquipmentType.class, "设备类型导出");
    }
 
    /**
     * 导入excel
     * @param request
     * @param response
     * @return
     */
    @RequestMapping("/importExcel")
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        return super.importExcel(request, response, MdcEquipmentType.class);
    }
}