Commit a30e33e9 by tyfanchz

修改命名、删除无用方法

1 parent 6c4c5889
...@@ -2,7 +2,6 @@ package com.glsx.smart.dao.mapper; ...@@ -2,7 +2,6 @@ package com.glsx.smart.dao.mapper;
import java.util.List; import java.util.List;
import com.glsx.smart.dao.entity.SmartProductType; import com.glsx.smart.dao.entity.SmartProductType;
import com.glsx.smart.dao.entity.SmartSysCode;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
...@@ -19,7 +18,5 @@ public interface SmartProductTypeMapper extends tk.mybatis.mapper.common.Mapper< ...@@ -19,7 +18,5 @@ public interface SmartProductTypeMapper extends tk.mybatis.mapper.common.Mapper<
int countByProductTypeName(String typeName); int countByProductTypeName(String typeName);
List<SmartSysCode> getTypeCategoryList();
List<SmartProductType> getAllList(); List<SmartProductType> getAllList();
} }
package com.glsx.smart.exception;
import com.glsx.plat.core.web.R;
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;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
* @deprecated 抛出异常,让上游服务捕获信息
*/
@Slf4j
//@RestControllerAdvice
@Deprecated
public class GlobalExceptionHandler {
@ExceptionHandler({BusinessException.class})
public R handleBusinessException(BusinessException e) {
log.error("业务异常", e);
return R.error(e.getMessage());
}
@ExceptionHandler({ServletRequestBindingException.class, MethodArgumentNotValidException.class,
BindException.class})
public R handleBindException(Exception e) {
log.error("参数错误", e);
return R.error(ResultEnum.PARAM_ERROR.getCode(), ResultEnum.PARAM_ERROR.getMessage());
}
@ExceptionHandler(Exception.class)
public R handleException(Exception e) {
log.error("未知异常", e);
return R.error(e.getMessage());
}
}
...@@ -20,8 +20,6 @@ public interface SmartProductTypeService { ...@@ -20,8 +20,6 @@ public interface SmartProductTypeService {
JSONObject getTypeAndCategory(); JSONObject getTypeAndCategory();
JSONObject getTypeAndCategory2();
void save(SmartProductType productType); void save(SmartProductType productType);
List<String> getShopTagList(); List<String> getShopTagList();
......
...@@ -11,7 +11,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -11,7 +11,6 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProductType; import com.glsx.smart.dao.entity.SmartProductType;
import com.glsx.smart.dao.entity.SmartSysCode;
import com.glsx.smart.dao.mapper.SmartProductTypeMapper; import com.glsx.smart.dao.mapper.SmartProductTypeMapper;
import com.glsx.smart.exception.BusinessException; import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum; import com.glsx.smart.exception.ResultEnum;
...@@ -101,45 +100,6 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro ...@@ -101,45 +100,6 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
} }
/** /**
* 获取结构化的产品类型。
* 数据格式为:
* {
* "车智能": ["产品类型1-1", "产品类型1-2"],
* "产品类型1-1": ["产品名称1", "产品名称2"],
*
* "家智能": ["产品类型2-1"],
* "产品类型2-1": ["产品名称3", "产品名称4", "产品名称5"]
* }
*
* @return 结果
*/
@Override
@Deprecated
public JSONObject getTypeAndCategory2() {
JSONObject result = new JSONObject();
// 获取所有产品类型,并按照二级分类来分组
List<SmartProductType> productTypeList = productTypeMapper.selectAll();
for (SmartProductType productType : productTypeList) {
String categoryKey = productType.getCategoryKey();
if (!result.containsKey(categoryKey)) {
result.put(categoryKey, new JSONArray());
}
result.getJSONArray(categoryKey).add(productType);
}
// 获取产品类型对应的字典集,并按照产品的二级分类来分组
List<SmartSysCode> categoryList = productTypeMapper.getTypeCategoryList();
for (SmartSysCode sysCode : categoryList) {
String parentKey = sysCode.getParentKey();
String dictKey = sysCode.getDictKey();
if (!result.containsKey(parentKey)) {
result.put(parentKey, new JSONArray());
}
result.getJSONArray(parentKey).add(dictKey);
}
return result;
}
/**
* 保存产品类型。 * 保存产品类型。
* *
* @param productType 产品类型 * @param productType 产品类型
......
...@@ -39,14 +39,6 @@ ...@@ -39,14 +39,6 @@
where type_name = #{typeName,jdbcType=VARCHAR} where type_name = #{typeName,jdbcType=VARCHAR}
</select> </select>
<select id="getTypeCategoryList" resultType="com.glsx.smart.dao.entity.SmartSysCode">
select distinct ssc.id, ssc.dict_type dictType, ssc.dict_key dictKey,
ssc.dict_value dictValue, ssc.parent_key parentKey, ssc.sort
from smart_product_type spt
left join smart_sys_code ssc on ssc.dict_key = spt.category_key
order by ssc.sort
</select>
<select id="getAllList" resultMap="BaseResultMap"> <select id="getAllList" resultMap="BaseResultMap">
select spt.id, spt.type_name, spt.category_key, spt.shop_tag, select spt.id, spt.type_name, spt.category_key, spt.shop_tag,
ssc.parent_key remark ssc.parent_key remark
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!