| | |
| | | |
| | | @ExceptionHandler(CoolException.class) |
| | | public R handleRRException(CoolException e) { |
| | | return R.parse(e.getMessage()); |
| | | return R.error(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.core.exception.CoolException; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import zy.cloud.wms.manager.entity.Tag; |
| | | import zy.cloud.wms.manager.service.TagService; |
| | | import zy.cloud.wms.system.entity.User; |
| | | import zy.cloud.wms.system.service.UserService; |
| | | |
| | |
| | | protected HttpServletRequest request; |
| | | @Autowired |
| | | private UserService userService; |
| | | @Autowired |
| | | private TagService tagService; |
| | | |
| | | protected Long getUserId(){ |
| | | return Long.parseLong(String.valueOf(request.getAttribute("userId"))); |
| | |
| | | return ""; |
| | | } |
| | | |
| | | protected Tag getOriginTag(){ |
| | | Tag tag = tagService.selectOne(new EntityWrapper<Tag>().eq("level", 1)); |
| | | if (tag == null) { |
| | | throw new CoolException("归类数据错误"); |
| | | } |
| | | return tag; |
| | | } |
| | | |
| | | /** |
| | | * 分页组装 |
| | | * @param pageNumber |
| | |
| | | EntityWrapper<Mat> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(matService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | Page<Mat> page = matService.selectPage(new Page<>(curr, limit), wrapper); |
| | | |
| | | return R.ok().add(page); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | |
| | | @PostMapping(value = "/tag/tree/auth") |
| | | @ManagerAuth |
| | | public R tree(@RequestParam(required = false, defaultValue = "") String condition) throws IOException, ClassNotFoundException { |
| | | ArrayList<Map> tree = treeUtils.getTree("1"); |
| | | ArrayList<Map> tree = treeUtils.getTree(String.valueOf(getOriginTag().getId())); |
| | | // 深拷贝 |
| | | List<Map> result = ListUtils.deepCopy(tree); |
| | | if (!Cools.isEmpty(condition)) { |
| | |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="listByPageByArea" resultMap="BaseResultMap"> |
| | | SELECT |
| | | mm.* |
| | | FROM man_mat mm |
| | | LEFT JOIN man_tag mt ON mm.`tag_id` = mt.`id` |
| | | WHERE 1=1 |
| | | AND (FIND_IN_SET(#{tagId}, mt.`path`) OR mt.`id` = #{tagId}) |
| | | ORDER BY mm.create_time DESC |
| | | </select> |
| | | |
| | | </mapper> |