Commit 2d7dc78c authored by lvzhuangzhuang's avatar lvzhuangzhuang

1

parent 9d788f72
......@@ -8,7 +8,7 @@ spring:
master:
url: jdbc:mysql://localhost:3306/hbghgz_sc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: root
password: 123456
# 从库数据源
slave:
# 从数据源开关/默认关闭
......
......@@ -8,7 +8,7 @@ spring:
master:
url: jdbc:mysql://localhost:3306/hbghgz_sc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
username: root
password: root
password: 123456
# 从库数据源
slave:
# 从数据源开关/默认关闭
......
package com.ruoyi.framework.web.exception;
import com.ruoyi.system.ex.ServiceException;
import com.ruoyi.system.web.ServiceCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.jdbc.BadSqlGrammarException;
import org.springframework.jdbc.UncategorizedSQLException;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.AccountExpiredException;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
......@@ -17,9 +23,11 @@ import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.exception.DemoModeException;
import com.ruoyi.common.utils.StringUtils;
import javax.servlet.http.HttpServletRequest;
/**
* 全局异常处理器
*
*
* @author ruoyi
*/
@RestControllerAdvice
......@@ -77,12 +85,12 @@ public class GlobalExceptionHandler
return AjaxResult.error(e.getMessage());
}
@ExceptionHandler(Exception.class)
/* @ExceptionHandler(Exception.class)
public AjaxResult handleException(Exception e)
{
log.error(e.getMessage(), e);
return AjaxResult.error(e.getMessage());
}
}*/
/**
* 自定义验证异常
......@@ -114,4 +122,109 @@ public class GlobalExceptionHandler
{
return AjaxResult.error("演示模式,不允许操作");
}
/*---------------------------------------------------*/
/**
* 权限校验异常
* @param e
* @param request
* @return
*/
/* @ExceptionHandler(AccessDeniedException.class)
public AjaxResult handleAccessDeniedException(AccessDeniedException e,
HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址{},权限校验失败{}", requestURI, e.getMessage());
return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权");
}*/
/**
* 请求方式不支持
* @param e
* @param request
* @return
*/
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e,
HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址{},不支持{}请求", requestURI, e.getMethod());
return AjaxResult.error(e.getMessage());
}
/**
* 拦截错误SQL异常
* @param e
* @param request
* @return
*/
@ExceptionHandler(BadSqlGrammarException.class)
public AjaxResult handleBadSqlGrammarException(BadSqlGrammarException e,
HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',发生数据库异常.", requestURI, e);
return AjaxResult.error(HttpStatus.ERROR, "数据库异常!");
}
/**
* 可以拦截表示违反数据库的完整性约束导致的异常。
* @param e
* @param request
* @return
*/
@ExceptionHandler(DataIntegrityViolationException.class)
public AjaxResult handleDataIntegrityViolationException(DataIntegrityViolationException e,
HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',发生数据库异常.", requestURI, e);
return AjaxResult.error(HttpStatus.ERROR, "数据库异常!");
}
/**
* 可以拦截违反数据库的非完整性约束导致的异常,可能也会拦截一些也包括 SQL 语句错误、连接问题、权限问题等各种数据库异常。
* @param e
* @param request
* @return
*/
@ExceptionHandler(UncategorizedSQLException.class)
public AjaxResult handleUncategorizedSqlException(UncategorizedSQLException e,
HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',发生数据库异常.", requestURI, e);
return AjaxResult.error(HttpStatus.ERROR, "数据库异常!");
}
/**
* 拦截未知的运行时异常
* @param e
* @param request
* @return
*/
@ExceptionHandler(RuntimeException.class)
public AjaxResult handleRuntimeException(RuntimeException e,
HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址{},发生未知运行异常", requestURI, e);
return AjaxResult.error(e.getMessage());
}
/**
* 全局异常
* @param e
* @param request
* @return
*/
@ExceptionHandler(Exception.class)
public AjaxResult handleException(Exception e,
HttpServletRequest request){
String requestURI = request.getRequestURI();
log.error("请求地址{},发生系统异常",requestURI,e);
return AjaxResult.error(e.getMessage());
}
}
......@@ -21,7 +21,7 @@ import java.util.stream.Stream;
/**
* 物料总分类管理Controller
*
*
* @author ruoyi
* @date 2023-07-11
*/
......
......@@ -17,20 +17,20 @@ import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
/**
* 物料总分类管理Service业务层处理
*
*
* @author ruoyi
* @date 2023-07-11
*/
@Service
public class ActSuppliesServiceImpl implements IActSuppliesService
public class ActSuppliesServiceImpl implements IActSuppliesService
{
@Autowired
private ActSuppliesMapper actSuppliesMapper;
/**
* 查询物料总分类管理
*
*
* @param id 物料总分类管理ID
* @return 物料总分类管理
*/
......@@ -42,7 +42,7 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
/**
* 查询物料总分类管理列表
*
*
* @param actSupplies 物料总分类管理
* @return 物料总分类管理
*/
......@@ -54,7 +54,7 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
/**
* 新增物料总分类管理
*
*
* @param actSupplies 物料总分类管理
* @return 结果
*/
......@@ -77,7 +77,7 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
/**
* 修改物料总分类管理
*
*
* @param actSupplies 物料总分类管理
* @return 结果
*/
......@@ -99,7 +99,7 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
/**
* 批量删除物料总分类管理
*
*
* @param ids 需要删除的物料总分类管理ID
* @return 结果
*/
......@@ -111,7 +111,7 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
/**
* 删除物料总分类管理信息
*
*
* @param id 物料总分类管理ID
* @return 结果
*/
......
......@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.ActSuppliesMapper">
<resultMap type="ActSupplies" id="ActSuppliesResult">
<result property="id" column="id" />
<result property="pid" column="pid" />
......@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectActSuppliesList" parameterType="ActSupplies" resultMap="ActSuppliesResult">
select a.id,a.pid,b.supplies_name fname,a.supplies_name,a.status from act_supplies a left join act_supplies b on a.pid =b.id
<where>
<where>
<if test="id != null "> and a.id = #{id}</if>
<if test="pid != null">and a.pid = #{pid}</if>
<if test="fname != null "> and b.supplies_name like concat('%', #{fname}, '%')</if>
......@@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null "> and a.status = #{status}</if>
</where>
</select>
<select id="selectActSuppliesById" parameterType="Long" resultMap="ActSuppliesResult">
<include refid="selectActSuppliesVo"/>
where id = #{id}
......@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectActSuppliesVo"/>
where pid = 0
</select>
<insert id="insertActSupplies" parameterType="ActSupplies" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -120,4 +120,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</update>
</mapper>
\ No newline at end of file
</mapper>
......@@ -5,9 +5,9 @@
"author": "若依",
"license": "MIT",
"scripts": {
"dev": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service serve",
"build:prod": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service build",
"build:stage": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service build --mode staging",
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src"
},
......
......@@ -10,11 +10,11 @@
<link rel='stylesheet' href='<%= BASE_URL %>./plugins/plugins.css' />
<link rel='stylesheet' href='<%= BASE_URL %>./css/luckysheet.css' />
<link rel='stylesheet' href='<%= BASE_URL %>./assets/iconfont/iconfont.css' />
<!--<link rel='stylesheet' href='./luckysheet/expendPlugins/chart/chartmix.css' />-->
<link rel='stylesheet' href='<%= BASE_URL %>./expendPlugins/chart/chartmix.css' />
<script src="<%= BASE_URL %>./jquery.min.js"></script>
<script src="<%= BASE_URL %>./plugins/js/plugin.js"></script>
<script src="<%= BASE_URL %>./luckysheet.umd.js"></script>
<!--<script src="./luckysheet/expendPlugins/chart/chartmix.umd.min.js"></script>-->
<script src="/expendPlugins/chart/chartmix.umd.min.js"></script>
<!-- <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/css/pluginsCss.css' />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment