增加前端服务
This commit is contained in:
parent
6f95683e6f
commit
729a63deca
|
|
@ -0,0 +1,54 @@
|
|||
package com.mdd.front.controller;
|
||||
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.front.service.IArticleService;
|
||||
import com.mdd.front.vo.article.ArticleCateVo;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/article")
|
||||
public class ArticleController {
|
||||
|
||||
@Resource
|
||||
IArticleService iArticleService;
|
||||
|
||||
/**
|
||||
* 文章分类
|
||||
*
|
||||
* @author fzr
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/category")
|
||||
public Object category() {
|
||||
List<ArticleCateVo> list = iArticleService.category();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章列表
|
||||
*
|
||||
* @author fzr
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Object list() {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章详情
|
||||
*
|
||||
* @author fzr
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public Object detail() {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,17 +1,57 @@
|
|||
package com.mdd.front.controller;
|
||||
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.common.validator.annotation.IDMust;
|
||||
import com.mdd.front.service.IIndexService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class IndexController {
|
||||
|
||||
@Resource
|
||||
IIndexService IIndexService;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
* @author fzr
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/index")
|
||||
public Object index() {
|
||||
return AjaxResult.success();
|
||||
Map<String, Object> detail = IIndexService.index();
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 装修
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/decorate")
|
||||
public Object decorate(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
Map<String, Object> detail = IIndexService.decorate(id);
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author fzr
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/config")
|
||||
public Object config() {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.mdd.front.controller;
|
||||
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/user")
|
||||
public class UserController {
|
||||
|
||||
@GetMapping("/center")
|
||||
public Object center() {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
public Object info() {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/agreement")
|
||||
public Object agreement() {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.mdd.front.service;
|
||||
|
||||
import com.mdd.front.vo.article.ArticleCateVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文章服务接口类
|
||||
*/
|
||||
public interface IArticleService {
|
||||
|
||||
List<ArticleCateVo> category();
|
||||
|
||||
Object list();
|
||||
|
||||
Object detail();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.mdd.front.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 首页服务接口类
|
||||
*/
|
||||
public interface IIndexService {
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> index();
|
||||
|
||||
/**
|
||||
* 装修
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> decorate(Integer id);
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> config();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package com.mdd.front.service;
|
||||
|
||||
public interface IUserService {
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.mdd.front.service.impl;
|
||||
|
||||
import com.mdd.common.mapper.article.ArticleCategoryMapper;
|
||||
import com.mdd.common.mapper.article.ArticleMapper;
|
||||
import com.mdd.front.service.IArticleService;
|
||||
import com.mdd.front.vo.article.ArticleCateVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ArticleServiceImpl implements IArticleService {
|
||||
|
||||
@Resource
|
||||
ArticleMapper articleMapper;
|
||||
|
||||
@Resource
|
||||
ArticleCategoryMapper articleCategoryMapper;
|
||||
|
||||
@Override
|
||||
public List<ArticleCateVo> category() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object list() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object detail() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.mdd.front.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.mdd.common.entity.decorate.DecoratePage;
|
||||
import com.mdd.common.entity.decorate.DecorateTabbar;
|
||||
import com.mdd.common.mapper.decorate.DecoratePageMapper;
|
||||
import com.mdd.common.mapper.decorate.DecorateTabbarMapper;
|
||||
import com.mdd.common.utils.ToolsUtil;
|
||||
import com.mdd.common.utils.UrlUtil;
|
||||
import com.mdd.front.service.IIndexService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 首页服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class IndexServiceImpl implements IIndexService {
|
||||
|
||||
@Resource
|
||||
DecoratePageMapper decoratePageMapper;
|
||||
|
||||
@Resource
|
||||
DecorateTabbarMapper decorateTabbarMapper;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> index() {
|
||||
Map<String, Object> response = new LinkedHashMap<>();
|
||||
|
||||
DecoratePage decoratePage = decoratePageMapper.selectOne(
|
||||
new QueryWrapper<DecoratePage>()
|
||||
.eq("id", 1)
|
||||
.last("limit 1"));
|
||||
|
||||
List<Map<String, String>> tabs = new LinkedList<>();
|
||||
List<DecorateTabbar> decorateTabbars = decorateTabbarMapper.selectList(new QueryWrapper<DecorateTabbar>().orderByAsc("id"));
|
||||
for (DecorateTabbar tab: decorateTabbars) {
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
map.put("name", tab.getName());
|
||||
map.put("selected", UrlUtil.toAbsoluteUrl(tab.getSelected()));
|
||||
map.put("unselected", UrlUtil.toAbsoluteUrl(tab.getUnselected()));
|
||||
map.put("link", tab.getLink());
|
||||
tabs.add(map);
|
||||
}
|
||||
|
||||
response.put("pages", ToolsUtil.jsonToMap(decoratePage.getPageData()));
|
||||
response.put("tabbar", tabs);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 装修
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> decorate(Integer id) {
|
||||
DecoratePage decoratePage = decoratePageMapper.selectOne(
|
||||
new QueryWrapper<DecoratePage>()
|
||||
.eq("id", id)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(decoratePage, "数据不存在!");
|
||||
|
||||
Map<String, Object> response = new LinkedHashMap<>();
|
||||
response.put("type", decoratePage.getPageType());
|
||||
response.put("name", decoratePage.getPageName());
|
||||
response.put("pages", ToolsUtil.jsonToMap(decoratePage.getPageData()));
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> config() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.mdd.front.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl {
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.mdd.front.vo.article;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 文章分类Vo
|
||||
*/
|
||||
@Data
|
||||
public class ArticleCateVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id; // 主键
|
||||
private String name; // 名称
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.mdd.front.vo.article;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ArticleDetailVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.mdd.front.vo.article;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ArticleListVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ like:
|
|||
|
||||
# 服务配置
|
||||
server:
|
||||
port: 8083
|
||||
port: 8084
|
||||
|
||||
# 框架配置
|
||||
spring:
|
||||
|
|
@ -50,9 +50,11 @@ spring:
|
|||
mybatis-plus:
|
||||
mapper-locations: classpath*:/mapper/**Mapper.xml # 映射文件路径
|
||||
typeAliasesPackage: com.mdd.**.mapper
|
||||
# configuration:
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# configuration:
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
banner: false
|
||||
db-config:
|
||||
table-prefix: ls_ # 设置表前缀
|
||||
table-prefix: la_ # 设置表前缀
|
||||
configuration-properties:
|
||||
prefix: la_ # 自定义表前缀标签${prefix}
|
||||
Loading…
Reference in New Issue