175 lines
6.0 KiB
Java
175 lines
6.0 KiB
Java
package rms.controller;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
import rms.entity.RmsLocation;
|
|
import rms.model.TreeModel;
|
|
import rms.service.IRmsLocationService;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
|
/**
|
|
* @Description: 存放地表
|
|
* @Author: jeecg-boot
|
|
* @Date: 2023-11-18
|
|
* @Version: V1.0
|
|
*/
|
|
@Api(tags = "存放地表")
|
|
@RestController
|
|
@RequestMapping("/rms/rmsLocation")
|
|
@Slf4j
|
|
public class RmsLocationController extends JeecgController<RmsLocation, IRmsLocationService> {
|
|
@Autowired
|
|
private IRmsLocationService rmsLocationService;
|
|
|
|
/**
|
|
* 分页列表查询
|
|
*
|
|
* @param rmsLocation
|
|
* @param pageNo
|
|
* @param pageSize
|
|
* @param req
|
|
* @return
|
|
*/
|
|
//@AutoLog(value = "存放地表-分页列表查询")
|
|
@ApiOperation(value = "存放地表-分页列表查询", notes = "存放地表-分页列表查询")
|
|
@GetMapping(value = "/list")
|
|
public Result<IPage<RmsLocation>> queryPageList(RmsLocation rmsLocation,
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
HttpServletRequest req) {
|
|
QueryWrapper<RmsLocation> queryWrapper = QueryGenerator.initQueryWrapper(rmsLocation, req.getParameterMap());
|
|
Page<RmsLocation> page = new Page<RmsLocation>(pageNo, pageSize);
|
|
IPage<RmsLocation> pageList = rmsLocationService.page(page, queryWrapper);
|
|
//return Result.OK(rmsLocationService.getsLocationData(page, queryWrapper));
|
|
return Result.OK(pageList);
|
|
}
|
|
|
|
//获取树结构
|
|
@ApiOperation(value = "存放地表-分页列表查询", notes = "存放地表-分页列表查询")
|
|
@GetMapping(value = "/getTree")
|
|
public Result<ArrayList<TreeModel>> getTreeList() {
|
|
return Result.OK(rmsLocationService.getTreeList());
|
|
}
|
|
|
|
//获取级联样式
|
|
@ApiOperation(value = "存放地表-分页列表查询", notes = "存放地表-分页列表查询")
|
|
@GetMapping(value = "/getCascader")
|
|
public Result<ArrayList<TreeModel>> getCascaderList(@RequestParam(name = "type", defaultValue = "0") Integer type) {
|
|
return Result.OK(rmsLocationService.getCascaderList(type));
|
|
}
|
|
|
|
/**
|
|
* 添加
|
|
*
|
|
* @param rmsLocation
|
|
* @return
|
|
*/
|
|
@AutoLog(value = "存放地表-添加")
|
|
@ApiOperation(value = "存放地表-添加", notes = "存放地表-添加")
|
|
@PostMapping(value = "/add")
|
|
public Result<String> add(@RequestBody RmsLocation rmsLocation) {
|
|
rmsLocationService.save(rmsLocation);
|
|
return Result.OK("添加成功!");
|
|
}
|
|
|
|
/**
|
|
* 编辑
|
|
*
|
|
* @param rmsLocation
|
|
* @return
|
|
*/
|
|
@AutoLog(value = "存放地表-编辑")
|
|
@ApiOperation(value = "存放地表-编辑", notes = "存放地表-编辑")
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
public Result<String> edit(@RequestBody RmsLocation rmsLocation) {
|
|
rmsLocationService.updateById(rmsLocation);
|
|
return Result.OK("编辑成功!");
|
|
}
|
|
|
|
/**
|
|
* 通过id删除
|
|
*
|
|
* @param id
|
|
* @return
|
|
*/
|
|
@AutoLog(value = "存放地表-通过id删除")
|
|
@ApiOperation(value = "存放地表-通过id删除", notes = "存放地表-通过id删除")
|
|
@DeleteMapping(value = "/delete")
|
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
rmsLocationService.removeById(id);
|
|
return Result.OK("删除成功!");
|
|
}
|
|
|
|
/**
|
|
* 批量删除
|
|
*
|
|
* @param ids
|
|
* @return
|
|
*/
|
|
@AutoLog(value = "存放地表-批量删除")
|
|
@ApiOperation(value = "存放地表-批量删除", notes = "存放地表-批量删除")
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
this.rmsLocationService.removeByIds(Arrays.asList(ids.split(",")));
|
|
return Result.OK("批量删除成功!");
|
|
}
|
|
|
|
/**
|
|
* 通过id查询
|
|
*
|
|
* @param id
|
|
* @return
|
|
*/
|
|
//@AutoLog(value = "存放地表-通过id查询")
|
|
@ApiOperation(value = "存放地表-通过id查询", notes = "存放地表-通过id查询")
|
|
@GetMapping(value = "/queryById")
|
|
public Result<RmsLocation> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
RmsLocation rmsLocation = rmsLocationService.getById(id);
|
|
if (rmsLocation == null) {
|
|
return Result.error("未找到对应数据");
|
|
}
|
|
return Result.OK(rmsLocation);
|
|
}
|
|
|
|
/**
|
|
* 导出excel
|
|
*
|
|
* @param request
|
|
* @param rmsLocation
|
|
*/
|
|
@RequestMapping(value = "/exportXls")
|
|
public ModelAndView exportXls(HttpServletRequest request, RmsLocation rmsLocation) {
|
|
return super.exportXls(request, rmsLocation, RmsLocation.class, "存放地表");
|
|
}
|
|
|
|
/**
|
|
* 通过excel导入数据
|
|
*
|
|
* @param request
|
|
* @param response
|
|
* @return
|
|
*/
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
return super.importExcel(request, response, RmsLocation.class);
|
|
}
|
|
|
|
}
|