自定义头部参数代码备份
parent
70483edee8
commit
c62383ff51
@ -0,0 +1,95 @@
|
||||
package com.glxp.api.controller.system;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.annotation.AuthRuleAnnotation;
|
||||
import com.glxp.api.common.enums.ResultEnum;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.controller.BaseController;
|
||||
import com.glxp.api.entity.system.SysTableHeadEntity;
|
||||
import com.glxp.api.req.system.DeleteRequest;
|
||||
import com.glxp.api.req.system.SysTableHeadRequest;
|
||||
import com.glxp.api.service.system.SysTableHeadService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备表头字段
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class SysTableHeadController extends BaseController {
|
||||
|
||||
@Resource
|
||||
SysTableHeadService sysTableHeadService;
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("/udiwms/sys/table/head/filter")
|
||||
public BaseResponse filterPreInorder(SysTableHeadRequest sysTableHeadRequest) {
|
||||
List<SysTableHeadEntity> list = sysTableHeadService.filterList(sysTableHeadRequest);
|
||||
PageInfo<SysTableHeadEntity> pageInfo = new PageInfo<SysTableHeadEntity>(list);
|
||||
return ResultVOUtils.page(pageInfo);
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("/udiwms/sys/table/head/find")
|
||||
public BaseResponse findByPage(SysTableHeadRequest sysTableHeadRequest) {
|
||||
if (StrUtil.isEmpty(sysTableHeadRequest.getPageCode())) {
|
||||
return ResultVOUtils.error(500, "页面标识不能为空!");
|
||||
}
|
||||
List<SysTableHeadEntity> list = sysTableHeadService.list(new QueryWrapper<SysTableHeadEntity>().eq("pageCode", sysTableHeadRequest.getPageCode()));
|
||||
return ResultVOUtils.success(list);
|
||||
}
|
||||
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/udiwms/sys/table/head/save")
|
||||
public BaseResponse save(@RequestBody SysTableHeadEntity sysTableHeadEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
boolean b = sysTableHeadService.save(sysTableHeadEntity);
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
return ResultVOUtils.success("添加成功!");
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/udiwms/sys/table/head/update")
|
||||
public BaseResponse update(@RequestBody SysTableHeadEntity sysTableHeadEntity,
|
||||
BindingResult bindingResult) {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
boolean b = sysTableHeadService.updateById(sysTableHeadEntity);
|
||||
if (!b) {
|
||||
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
||||
}
|
||||
return ResultVOUtils.success("修改成功!");
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/udiwms/sys/table/head/delete")
|
||||
public BaseResponse deleteById(@RequestBody DeleteRequest deleteRequest) {
|
||||
boolean b = sysTableHeadService.removeById(deleteRequest.getId());
|
||||
if (b)
|
||||
return ResultVOUtils.success("删除成功");
|
||||
else {
|
||||
return ResultVOUtils.error(500, "删除失败");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.glxp.api.req.system;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.glxp.api.util.page.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class SysTableHeadRequest extends ListPageRequest {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 前端页面名称
|
||||
*/
|
||||
private String pageName;
|
||||
|
||||
/**
|
||||
* 前端页面标识
|
||||
*/
|
||||
private String pageCode;
|
||||
|
||||
/**
|
||||
* 所属后端返回类
|
||||
*/
|
||||
private String response;
|
||||
|
||||
/**
|
||||
* 显示的标题
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 字段名
|
||||
*/
|
||||
private String prop;
|
||||
|
||||
/**
|
||||
* 对应列的宽度
|
||||
*/
|
||||
private Double width;
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
private String isShow;
|
||||
|
||||
/**
|
||||
* 自适应宽度
|
||||
*/
|
||||
private String isAuto;
|
||||
|
||||
/**
|
||||
* 当内容过长被隐藏时显示 tooltip
|
||||
*/
|
||||
private Boolean overflow;
|
||||
|
||||
|
||||
/**
|
||||
* 是否启用自定义排序
|
||||
*/
|
||||
private Boolean customSort;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
@ -1,13 +1,37 @@
|
||||
package com.glxp.api.service.system;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.req.system.SysTableHeadRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.glxp.api.entity.system.SysTableHeadEntity;
|
||||
import com.glxp.api.dao.system.SysTableHeadMapper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysTableHeadService extends ServiceImpl<SysTableHeadMapper, SysTableHeadEntity> {
|
||||
|
||||
@Resource
|
||||
SysTableHeadMapper sysTableHeadMapper;
|
||||
|
||||
public List<SysTableHeadEntity> filterList(SysTableHeadRequest sysTableHeadRequest) {
|
||||
if (sysTableHeadRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (sysTableHeadRequest.getPage() != null) {
|
||||
int offset = (sysTableHeadRequest.getPage() - 1) * sysTableHeadRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, sysTableHeadRequest.getLimit());
|
||||
}
|
||||
|
||||
return sysTableHeadMapper.filterList(sysTableHeadRequest);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue