Commit e6517afa authored by 梁光意's avatar 梁光意

修改获取仪表盘列表接口的问题

parent 39870a2e
...@@ -4,10 +4,9 @@ import com.syc.slm.common.core.util.R; ...@@ -4,10 +4,9 @@ import com.syc.slm.common.core.util.R;
import com.syc.slm.slmbi.exception.SysException; import com.syc.slm.slmbi.exception.SysException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.MyBatisSystemException; import org.mybatis.spring.MyBatisSystemException;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.validation.BindException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
...@@ -16,7 +15,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -16,7 +15,7 @@ import javax.servlet.http.HttpServletRequest;
* @author : lin * @author : lin
* @date : 2021-04-16 17:34 * @date : 2021-04-16 17:34
**/ **/
@ControllerAdvice @RestControllerAdvice
@Slf4j @Slf4j
public class SysExceptionHandler { public class SysExceptionHandler {
...@@ -27,7 +26,6 @@ public class SysExceptionHandler { ...@@ -27,7 +26,6 @@ public class SysExceptionHandler {
* @return exception * @return exception
*/ */
@ExceptionHandler(SysException.class) @ExceptionHandler(SysException.class)
@ResponseBody
public R<Object> handleSysException(SysException e, HttpServletRequest request) { public R<Object> handleSysException(SysException e, HttpServletRequest request) {
log.info(e.getMsg()); log.info(e.getMsg());
return R.bad(e.getMsg(),e.getDebugMsg()); return R.bad(e.getMsg(),e.getDebugMsg());
...@@ -39,10 +37,28 @@ public class SysExceptionHandler { ...@@ -39,10 +37,28 @@ public class SysExceptionHandler {
* @return * @return
*/ */
@ExceptionHandler(MyBatisSystemException.class) @ExceptionHandler(MyBatisSystemException.class)
@ResponseBody
public R<Object> handleMyBatisSystemException(MyBatisSystemException e) { public R<Object> handleMyBatisSystemException(MyBatisSystemException e) {
log.info(e.getMessage()); log.info(e.getMessage());
return R.bad(e.getCause().getCause().getMessage(),e.getMessage()); return R.bad(e.getCause().getCause().getMessage(),e.getMessage());
} }
/**
* 时间格式抛出的异常
* @param e
* @return
*/
@ExceptionHandler(BindException.class)
public R<Object> handleBindException(BindException e) {
String message = e.getMessage();
log.info(message);
if (message.contains("DateTimeFormat")){
return R.bad("时间格式错误",null);
}else {
return R.bad("请按照提示填写格式",null);
}
}
} }
...@@ -38,9 +38,14 @@ ...@@ -38,9 +38,14 @@
p.group_id, p.group_id,
g.name group_name, g.name group_name,
if(p.published='published','已发布','未发布') published, if(p.published='published','已发布','未发布') published,
p.creator,
p.creator_name, p.creator_name,
p.create_time,
p.updater,
p.updater_name, p.updater_name,
p.update_time p.update_time,
p.app_id,
p.description
from instrument_panel p from instrument_panel p
join instrument_panel_group g on p.group_id =g.id join instrument_panel_group g on p.group_id =g.id
${ew.customSqlSegment} ${ew.customSqlSegment}
......
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