| | |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.lang.Dict; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import vip.xiaonuo.core.annotion.BusinessLog; |
| | | import vip.xiaonuo.core.consts.CommonConstant; |
| | | import vip.xiaonuo.core.consts.MyConstant; |
| | | import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum; |
| | | import vip.xiaonuo.core.exception.BlogException; |
| | | import vip.xiaonuo.core.pojo.response.ResponseData; |
| | | import vip.xiaonuo.core.pojo.response.SuccessResponseData; |
| | | import vip.xiaonuo.modular.blogfriendshiplink.entity.BlogFriendshipLink; |
| | | import vip.xiaonuo.modular.blogfriendshiplink.entity.BlogLinkVo; |
| | | import vip.xiaonuo.modular.blogfriendshiplink.param.BlogFriendshipLinkParam; |
| | | import vip.xiaonuo.modular.blogfriendshiplink.param.BlogFriendshipLinkVo; |
| | | import vip.xiaonuo.modular.blogfriendshiplink.param.BlogLinkVo; |
| | | import vip.xiaonuo.modular.blogfriendshiplink.service.BlogFriendshipLinkService; |
| | | import vip.xiaonuo.sys.modular.dict.param.SysDictTypeParam; |
| | | import vip.xiaonuo.sys.modular.dict.service.SysDictTypeService; |
| | |
| | | @Resource |
| | | private SysDictTypeService sysDictTypeService; |
| | | |
| | | |
| | | /** |
| | | * 查询blog友情链接 |
| | | * |
| | |
| | | public ResponseData queryBlogLinkGroup() { |
| | | |
| | | List<BlogFriendshipLink> linkList = blogFriendshipLinkService.lambdaQuery() |
| | | .eq(BlogFriendshipLink::getIsEnable,MyConstant.Yes) |
| | | .eq(BlogFriendshipLink::getIsEnable, MyConstant.Yes) |
| | | .orderByAsc(BlogFriendshipLink::getTopValue) |
| | | .orderByAsc(BlogFriendshipLink::getName) |
| | | .list(); |
| | |
| | | |
| | | return new SuccessResponseData(res); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加友情链接 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-17 15:05:44 |
| | | */ |
| | | @PostMapping("/blogLink/add") |
| | | @BusinessLog(title = "外部blog系统_blog友情链接_增加", opType = LogAnnotionOpTypeEnum.ADD) |
| | | public ResponseData add(@RequestBody @Validated(BlogFriendshipLinkParam.add.class) BlogFriendshipLinkParam blogFriendshipLinkParam) { |
| | | |
| | | if (blogFriendshipLinkService.lambdaQuery() |
| | | .eq(BlogFriendshipLink::getUrl, blogFriendshipLinkParam.getUrl()) |
| | | .count() > 0) { |
| | | throw new BlogException("已经有该链接的记录啦,不要重复提交哦.."); |
| | | } |
| | | |
| | | blogFriendshipLinkParam.setIsEnable(MyConstant.Yes); |
| | | blogFriendshipLinkService.add(blogFriendshipLinkParam); |
| | | return new SuccessResponseData(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/blogLink/getLinkType") |
| | | @BusinessLog(title = "外部blog系统_blog友情链接_获取链接类型", opType = LogAnnotionOpTypeEnum.QUERY) |
| | | public ResponseData getLinkType() { |
| | | |
| | | |
| | | SysDictTypeParam param = new SysDictTypeParam(); |
| | | param.setCode("blog_link_type"); |
| | | param.setStatus(MyConstant.No); |
| | | List<Dict> dictList = sysDictTypeService.dropDown(param); |
| | | |
| | | List<BlogLinkVo> res = new ArrayList<>(dictList.size()); |
| | | BlogLinkVo vo; |
| | | |
| | | for (Dict dict : dictList) { |
| | | vo = new BlogLinkVo(); |
| | | vo.setGroupName(dict.get(CommonConstant.VALUE).toString()); |
| | | vo.setLinkTypeId(dict.getLong(CommonConstant.CODE)); |
| | | res.add(vo); |
| | | } |
| | | return new SuccessResponseData(res); |
| | | } |
| | | |
| | | } |