Commit ba22447c by tyfanchz

调整代码

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