feat: 系统设置功能
This commit is contained in:
@@ -30,7 +30,7 @@ import org.apache.poi.ss.formula.functions.T;
|
|||||||
*/
|
*/
|
||||||
@Api(tags="设备")
|
@Api(tags="设备")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/1/khDevice")
|
@RequestMapping("/khDevice")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class KhDeviceController extends JeroController<KhDevice, IKhDeviceService> {
|
public class KhDeviceController extends JeroController<KhDevice, IKhDeviceService> {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
+12
-125
@@ -1,24 +1,18 @@
|
|||||||
package com.jero.modules.controller;
|
package com.jero.modules.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import com.jero.common.api.vo.Results;
|
import com.jero.common.api.vo.Results;
|
||||||
import com.jero.modules.entity.KhSystemSetting;
|
import com.jero.modules.entity.KhSystemSetting;
|
||||||
import com.jero.modules.service.IKhSystemSettingService;
|
import com.jero.modules.service.IKhSystemSettingService;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.jero.common.system.base.controller.JeroController;
|
import com.jero.common.system.base.controller.JeroController;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import com.jero.common.aspect.annotation.AutoLog;
|
import com.jero.common.aspect.annotation.AutoLog;
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
|
||||||
|
|
||||||
@@ -30,45 +24,26 @@ import org.apache.poi.ss.formula.functions.T;
|
|||||||
*/
|
*/
|
||||||
@Api(tags="系统设置")
|
@Api(tags="系统设置")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/com.jero.modules/khSystemSetting")
|
@RequestMapping("/khSystemSetting")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class KhSystemSettingController extends JeroController<KhSystemSetting, IKhSystemSettingService> {
|
public class KhSystemSettingController extends JeroController<KhSystemSetting, IKhSystemSettingService> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IKhSystemSettingService khSystemSettingService;
|
private IKhSystemSettingService khSystemSettingService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页列表查询
|
|
||||||
*
|
|
||||||
* @param khSystemSetting
|
|
||||||
* @param pageNo
|
|
||||||
* @param pageSize
|
|
||||||
* @param req
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "系统设置-分页列表查询")
|
|
||||||
@ApiOperation(value="系统设置-分页列表查询", notes="系统设置-分页列表查询")
|
|
||||||
@GetMapping(value = "/page")
|
|
||||||
public Results<IPage<KhSystemSetting>> queryPageList(KhSystemSetting khSystemSetting,
|
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
||||||
HttpServletRequest req) {
|
|
||||||
IPage<KhSystemSetting> pageList = khSystemSettingService.queryPage(khSystemSetting, pageNo, pageSize, req);
|
|
||||||
return Results.OK(pageList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表查询
|
* 获取设置
|
||||||
*
|
*
|
||||||
* @param khSystemSetting
|
* @param khSystemSetting
|
||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@AutoLog(value = "系统设置-列表查询")
|
@AutoLog(value = "系统设置-获取设置")
|
||||||
@ApiOperation(value="系统设置-列表查询", notes="系统设置-列表查询")
|
@ApiOperation(value="系统设置-获取设置", notes="系统设置-获取设置")
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/getSetting")
|
||||||
public Results<List<KhSystemSetting>> queryList(KhSystemSetting khSystemSetting, HttpServletRequest req) {
|
public Results<KhSystemSetting> queryList(KhSystemSetting khSystemSetting, HttpServletRequest req) {
|
||||||
List<KhSystemSetting> list = khSystemSettingService.queryList(khSystemSetting, req);
|
List<KhSystemSetting> list = khSystemSettingService.queryList(khSystemSetting, req);
|
||||||
return Results.OK(list);
|
return Results.OK(list.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,100 +52,12 @@ public class KhSystemSettingController extends JeroController<KhSystemSetting, I
|
|||||||
* @param khSystemSetting
|
* @param khSystemSetting
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@AutoLog(value = "系统设置-添加")
|
@AutoLog(value = "系统设置-保存设置")
|
||||||
@ApiOperation(value="系统设置-添加", notes="系统设置-添加")
|
@ApiOperation(value="系统设置-保存设置", notes="系统设置-保存设置")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/save")
|
||||||
public Results<T> add(@Validated @RequestBody KhSystemSetting khSystemSetting) {
|
public Results<T> add(@Validated @RequestBody KhSystemSetting khSystemSetting) {
|
||||||
khSystemSettingService.add(khSystemSetting);
|
khSystemSettingService.save(khSystemSetting);
|
||||||
return Results.OK("操作成功!");
|
return Results.OK("操作成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑
|
|
||||||
*
|
|
||||||
* @param khSystemSetting
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "系统设置-编辑")
|
|
||||||
@ApiOperation(value="系统设置-编辑", notes="系统设置-编辑")
|
|
||||||
@PostMapping(value = "/edit")
|
|
||||||
public Results<T> edit(@Validated @RequestBody KhSystemSetting khSystemSetting) {
|
|
||||||
khSystemSettingService.editById(khSystemSetting);
|
|
||||||
return Results.OK("操作成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id删除
|
|
||||||
*
|
|
||||||
* @param map
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "系统设置-通过id删除")
|
|
||||||
@ApiOperation(value="系统设置-通过id删除", notes="系统设置-通过id删除")
|
|
||||||
@PostMapping(value = "/delete")
|
|
||||||
public Results<T> delete(@RequestBody Map<String, String> map) {
|
|
||||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
|
||||||
return Results.error("请选择数据!");
|
|
||||||
}
|
|
||||||
khSystemSettingService.deleteById(map.get("id"));
|
|
||||||
return Results.OK("删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
*
|
|
||||||
* @param map
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "系统设置-批量删除")
|
|
||||||
@ApiOperation(value="系统设置-批量删除", notes="系统设置-批量删除")
|
|
||||||
@PostMapping(value = "/deleteBatch")
|
|
||||||
public Results<T> deleteBatch(@RequestBody Map<String, String> map) {
|
|
||||||
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
|
||||||
return Results.error("请选择数据!");
|
|
||||||
}
|
|
||||||
this.khSystemSettingService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
|
||||||
return Results.OK("批量删除成功!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id查询
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@AutoLog(value = "系统设置-通过id查询")
|
|
||||||
@ApiOperation(value="系统设置-通过id查询", notes="系统设置-通过id查询")
|
|
||||||
@GetMapping(value = "/queryById")
|
|
||||||
public Results<KhSystemSetting> queryById(@RequestParam(name="id",required=true) String id) {
|
|
||||||
KhSystemSetting khSystemSetting = khSystemSettingService.queryById(id);
|
|
||||||
if(khSystemSetting==null) {
|
|
||||||
return Results.error("未找到对应数据");
|
|
||||||
}
|
|
||||||
return Results.OK(khSystemSetting);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出excel
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param khSystemSetting
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/exportXls")
|
|
||||||
public ModelAndView exportXls(HttpServletRequest request, KhSystemSetting khSystemSetting) {
|
|
||||||
return super.exportXls(request, khSystemSetting, KhSystemSetting.class, "系统设置");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过excel导入数据
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param response
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
||||||
public Results<KhSystemSetting> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
return super.importExcel(request, response, KhSystemSetting.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ import org.apache.poi.ss.formula.functions.T;
|
|||||||
*/
|
*/
|
||||||
@Api(tags="井口")
|
@Api(tags="井口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/1/khWellhead")
|
@RequestMapping("/khWellhead")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class KhWellheadController extends JeroController<KhWellhead, IKhWellheadService> {
|
public class KhWellheadController extends JeroController<KhWellhead, IKhWellheadService> {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package com.jero.modules.entity;
|
package com.jero.modules.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@@ -11,12 +10,10 @@ import lombok.Data;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
import com.jero.common.aspect.annotation.Dict;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,5 +76,5 @@ public class KhDevice implements Serializable {
|
|||||||
/**设备状态(0离线 1在线 默认在线)*/
|
/**设备状态(0离线 1在线 默认在线)*/
|
||||||
@Excel(name = "设备状态(0离线 1在线 默认在线)", width = 15)
|
@Excel(name = "设备状态(0离线 1在线 默认在线)", width = 15)
|
||||||
@ApiModelProperty(value = "设备状态(0离线 1在线 默认在线)")
|
@ApiModelProperty(value = "设备状态(0离线 1在线 默认在线)")
|
||||||
private String deviceStatuts;
|
private String deviceStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package com.jero.modules.mapper;
|
package com.jero.modules.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.jero.modules.entity.KhDevice;
|
import com.jero.modules.entity.KhDevice;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.jero.modules.mapper;
|
package com.jero.modules.mapper;
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.jero.modules.entity.KhSystemSetting;
|
import com.jero.modules.entity.KhSystemSetting;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package com.jero.modules.mapper;
|
package com.jero.modules.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.jero.modules.entity.KhWellhead;
|
import com.jero.modules.entity.KhWellhead;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -53,7 +53,11 @@ public class KhSystemSettingServiceImpl extends ServiceImpl<KhSystemSettingMappe
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<KhSystemSetting> queryList(KhSystemSetting khSystemSetting, HttpServletRequest req) {
|
public List<KhSystemSetting> queryList(KhSystemSetting khSystemSetting, HttpServletRequest req) {
|
||||||
return list(QueryGenerator.initQueryWrapper(khSystemSetting, req.getParameterMap()));
|
List<KhSystemSetting> list = list(QueryGenerator.initQueryWrapper(khSystemSetting, req.getParameterMap()));
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
list.add(new KhSystemSetting());
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user