Commit ba22447c by tyfanchz

调整代码

1 parent 502ccc7a
......@@ -37,18 +37,6 @@ public class SmartProduct extends BaseDTO {
@Transient
private String typeName;
/**
* 接入平台名称
*/
@Transient
private String platformName;
/**
* 配网模式名称
*/
@Transient
private String networkName;
/**
* 标识ID
......
......@@ -4,7 +4,6 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import com.glsx.smart.pojo.BaseDTO;
......@@ -26,19 +25,6 @@ import lombok.Data;
@Table(name = "smart_product_type")
public class SmartProductType extends BaseDTO {
/**
* 一级分类名
*/
@Transient
private String categoryName1;
/**
* 二级分类名
*/
@Transient
private String categoryName2;
/**
* 标识ID
*/
@Id
......
package com.glsx.smart.exception;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
......@@ -12,17 +14,25 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
* @author wbh
* @date 2021-03-16
*/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ExceptionHandler({BusinessException.class})
public String handleBusinessException(BusinessException e) {
log.error("!!!! 业务异常", e);
return e.getMessage();
}
@ExceptionHandler(BusinessException.class)
public void handleBusinessException(BusinessException e) {
logger.error("!!!! 业务异常", e);
@ExceptionHandler({ServletRequestBindingException.class, MethodArgumentNotValidException.class,
BindException.class})
public String handleBindException(Exception e) {
log.error("!!!! 参数错误", e);
return ResultEnum.PARAM_ERROR.getMessage();
}
@ExceptionHandler(Exception.class)
public void handleException(Exception e) {
logger.error("!!!! 未知异常", e);
public String handleException(Exception e) {
log.error("!!!! 未知异常", e);
return ResultEnum.ERROR.getMessage();
}
}
......@@ -31,14 +31,10 @@
sp.platform_product_id, sp.network_key, sp.status, sp.remark, sp.create_time,
sp.create_by, sp.update_time, sp.update_by,
ssf.url iconUrl,
spt.type_name typeName,
sscp.dict_value platformName,
sscn.dict_value networkName
spt.type_name typeName
from smart_product sp
left join smart_sys_file ssf on ssf.id = sp.icon
left join smart_product_type spt on spt.id = sp.type_id
left join smart_sys_code sscp on sscp.dict_key = sp.platform_key
left join smart_sys_code sscn on sscn.dict_key = sp.network_key
<where>
<if test="productName != null and productName != ''">
and sp.product_name like concat('%', #{productName,jdbcType=VARCHAR}, '%')
......
......@@ -23,12 +23,8 @@
<select id="getList" resultMap="BaseResultMap">
select spt.id, spt.type_name, spt.category_key, spt.shop_tag, spt.remark, spt.create_time,
spt.create_by, spt.update_time, spt.update_by,
ssc2.dict_value categoryName2,
ssc1.dict_value categoryName1
spt.create_by, spt.update_time, spt.update_by
from smart_product_type spt
left join smart_sys_code ssc2 on ssc2.dict_key = spt.category_key
left join smart_sys_code ssc1 on ssc1.dict_key = ssc2.parent_key
<where>
<if test="typeName != null and typeName != ''">
and spt.type_name like concat('%', #{typeName,jdbcType=VARCHAR}, '%')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!