工作
xiao白跳大神
小白一枚,努力蜕变。。。。
展开
-
全局异常捕获处理
自定义一个异常类,用户抛出异常后根据组装成前台需要的格式进行返回1.自定义异常类package com.ztccloud.naire.exception;import lombok.Data;@Datapublic class QuestionException extends RuntimeException { /** * 异常码 */ private String errorCode; /** * 异常信息 */原创 2022-01-27 20:32:14 · 4527 阅读 · 0 评论 -
自定义用户权限,全局用户搜索
手写用户认证,角色方法控制,用户全局搜索原创 2022-01-27 17:27:00 · 3117 阅读 · 0 评论 -
PostGrepSql行转列
建表语句:CREATE TABLE public.order_t ( order_name varchar(255) NULL, order_id varchar(255) NULL, oder_time varchar(255) NULL, amount int4 NULL, province_id int4 NULL, test_date varchar NULL);测试数据:INSERT INTO order_t (order_name, order_id, oder_原创 2021-11-30 10:50:54 · 602 阅读 · 0 评论 -
动态创建表,并批量入库表数据(字段在程序运行之前未知)
环境:springboot+mybatis需要需求:前台导入任意数据,后台经过处理后,根据处理后的字段,新建数据库表,并入库处理后的数据。1.Mapper.xml中创建通用sql脚本,如下: <select id="executeSql" parameterType="String"> ${sqlContent} </select>2.创建表格,因为表明和字段名,字段数量未知,需要用StringBuffer讲sql拼接Stri原创 2021-11-18 17:17:32 · 1152 阅读 · 0 评论 -
VUE提交表单,为什么发了四次请求,有的是GET有的是POST
代码如下图:这个是现象发了四次请求,两个post两个get两个状态码是200 另外两个分别是405 和302原创 2021-11-09 14:28:43 · 329 阅读 · 0 评论 -
vue前后端分离跨域CORS问题处理
处理步骤:1.删除前台请求头信息,下面红框位置2.后台增加如下类package com.datacenter.permission.config;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.web.cors.CorsConfiguration;imp.原创 2021-11-09 13:55:00 · 741 阅读 · 0 评论 -
springboot多module子项目的controller无法被访问
springboot多模块,子模块controller无法被扫描到项目结构common负责引入坐标,在auth的pom文件中已经引入commonmanager启动类所在module,在manager的pom中也已经引入authauth的controller无法被访问。最后在manager的启动类上加了就好了但是其他人没有添加这个注解也可以访问,比如说processor模块,这个是什么原因不太清楚...原创 2021-11-04 10:45:57 · 7065 阅读 · 5 评论