增加装修数据

This commit is contained in:
TinyAnts
2022-09-14 10:40:07 +08:00
parent 4113967539
commit 1596c077c4
19 changed files with 142 additions and 4 deletions

View File

@@ -0,0 +1,37 @@
package com.mdd.admin.controller.decorate;
import com.mdd.admin.service.decorate.IDecorateDataService;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 装修数据管理
*/
@RestController("decorateDataController")
@RequestMapping("api/decorate/data")
public class DataController {
@Resource
IDecorateDataService iDecorateDataService;
/**
* 获取文章数据
*
* @author fzr
* @param limit 条数
* @return Object
*/
@GetMapping("/article")
public Object article(@RequestParam(defaultValue = "10") Integer limit) {
List<Map<String, Object>> list = iDecorateDataService.article(limit);
return AjaxResult.success(list);
}
}

View File

@@ -14,7 +14,7 @@ import java.util.Map;
/**
* 页面装修管理
*/
@RestController
@RestController("decoratePagesController")
@RequestMapping("api/decorate/pages")
public class PagesController {

View File

@@ -12,7 +12,7 @@ import java.util.Map;
/**
* 装修底部导航管理
*/
@RestController
@RestController("decorateTabbarController")
@RequestMapping("api/decorate/tabbar")
public class TabbarController {

View File

@@ -0,0 +1,20 @@
package com.mdd.admin.service.decorate;
import java.util.List;
import java.util.Map;
/**
* 装修数据服务接口类
*/
public interface IDecorateDataService {
/**
* 获取文章数据
*
* @author fzr
* @param limit 条数
* @return List<Map<String, Object>>
*/
List<Map<String, Object>> article(Integer limit);
}

View File

@@ -0,0 +1,58 @@
package com.mdd.admin.service.decorate.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mdd.admin.service.decorate.IDecorateDataService;
import com.mdd.common.entity.article.Article;
import com.mdd.common.mapper.article.ArticleMapper;
import com.mdd.common.utils.TimeUtil;
import com.mdd.common.utils.UrlUtil;
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 DecorateDataServiceImpl implements IDecorateDataService {
@Resource
ArticleMapper articleMapper;
/**
* 获取文章数据
*
* @author fzr
* @param limit 条数
* @return List<Map<String, Object>>
*/
@Override
public List<Map<String, Object>> article(Integer limit) {
List<Map<String, Object>> articleList = new LinkedList<>();
List<Article> articles = articleMapper.selectList(new QueryWrapper<Article>()
.eq("is_show", 1)
.eq("is_delete", 0)
.orderByDesc("id")
.last("limit 20"));
for (Article article : articles) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("id", article.getId());
map.put("title", article.getTitle());
map.put("intro", article.getIntro());
map.put("summary", article.getSummary());
map.put("image", UrlUtil.toAbsoluteUrl(article.getImage()));
map.put("author", article.getAuthor());
map.put("visit", article.getVisit());
map.put("content", article.getContent());
map.put("createTime", TimeUtil.timestampToDate(article.getCreateTime()));
articleList.add(map);
}
return articleList;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB