自定义头部参数代码备份

dev2.0
anthonywj 2 years ago
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, "删除失败");
}
}
}

@ -3,8 +3,13 @@ package com.glxp.api.dao.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.system.SysTableHeadEntity;
import com.glxp.api.req.system.SysTableHeadRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SysTableHeadMapper extends BaseMapperPlus<SysTableHeadMapper, SysTableHeadEntity, SysTableHeadEntity> {
List<SysTableHeadEntity> filterList(SysTableHeadRequest sysTableHeadRequest);
}

@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
@Data
@ -15,10 +17,16 @@ public class SysTableHeadEntity implements Serializable {
private Integer id;
/**
*
*
*/
@TableField(value = "pageName")
private String pageName;
/**
*
*/
@TableField(value = "page")
private String page;
@TableField(value = "pageCode")
private String pageCode;
/**
*
@ -60,7 +68,7 @@ public class SysTableHeadEntity implements Serializable {
* tooltip
*/
@TableField(value = "overflow")
private Byte overflow;
private Boolean overflow;
/**
*
@ -72,7 +80,7 @@ public class SysTableHeadEntity implements Serializable {
*
*/
@TableField(value = "customSort")
private Byte customSort;
private Boolean customSort;
/**
*

@ -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);
}
}

@ -4,7 +4,7 @@ server:
spring:
datasource:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_wmd?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_pt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
hikari:

@ -1,26 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.system.SysTableHeadMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.system.SysTableHeadEntity">
<!--@mbg.generated-->
<!--@Table sys_table_head-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="page" jdbcType="VARCHAR" property="page" />
<result column="response" jdbcType="VARCHAR" property="response" />
<result column="label" jdbcType="VARCHAR" property="label" />
<result column="prop" jdbcType="VARCHAR" property="prop" />
<result column="width" jdbcType="DOUBLE" property="width" />
<result column="isShow" jdbcType="VARCHAR" property="isShow" />
<result column="isAuto" jdbcType="VARCHAR" property="isAuto" />
<result column="overflow" jdbcType="TINYINT" property="overflow" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="customSort" jdbcType="TINYINT" property="customSort" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, page, response, `label`, prop, width, isShow, isAuto, overflow, sort, customSort,
remark, updateTime
</sql>
<resultMap id="BaseResultMap" type="com.glxp.api.entity.system.SysTableHeadEntity">
<!--@mbg.generated-->
<!--@Table sys_table_head-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="pageName" jdbcType="VARCHAR" property="pageName"/>
<result column="pageCode" jdbcType="VARCHAR" property="pageCode"/>
<result column="response" jdbcType="VARCHAR" property="response"/>
<result column="label" jdbcType="VARCHAR" property="label"/>
<result column="prop" jdbcType="VARCHAR" property="prop"/>
<result column="width" jdbcType="DOUBLE" property="width"/>
<result column="isShow" jdbcType="VARCHAR" property="isShow"/>
<result column="isAuto" jdbcType="VARCHAR" property="isAuto"/>
<result column="overflow" jdbcType="TINYINT" property="overflow"/>
<result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="customSort" jdbcType="TINYINT" property="customSort"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id,pageName, pageCode, response, `label`, prop, width, isShow, isAuto, overflow, sort, customSort,
remark, updateTime
</sql>
<select id="filterList" parameterType="com.glxp.api.req.system.SysTableHeadRequest"
resultType="com.glxp.api.entity.system.SysTableHeadEntity">
SELECT *
FROM sys_table_head
<where>
<if test="pageName != null and pageName != ''">
AND `pageName` like CONCAT('%', #{pageName}, '%')
</if>
<if test="pageCode != null and pageCode != ''">
AND `pageCode` like CONCAT('%', #{pageCode}, '%')
</if>
<if test="label != null and label != ''">
AND `label` like CONCAT('%', #{label}, '%')
</if>
<if test="prop != null and prop != ''">
AND `prop` like CONCAT('%', #{prop}, '%')
</if>
<if test="isShow != null and isShow != ''">
AND `isShow` = #{isShow}
</if>
<if test="overflow != null and overflow != ''">
AND `overflow` = #{overflow}
</if>
</where>
</select>
</mapper>

Loading…
Cancel
Save