2024.7.10 新元素官网 字典倒序,网站接口代码

This commit is contained in:
lee 2024-07-10 17:12:25 +08:00
parent 3fbe35e556
commit 25a85220ba
4 changed files with 100 additions and 18 deletions

View File

@ -0,0 +1,67 @@
package com.ruoyi.web.controller.system;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.system.domain.XysArticle;
import com.ruoyi.system.domain.XysImg;
import com.ruoyi.system.service.IXysArticleService;
import com.ruoyi.system.service.IXysImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 門戶Controller
*
* @author libao
* @date 2024-07-08
*/
@RestController
@RequestMapping("/door")
public class DoorController extends BaseController
{
@Autowired
private IXysArticleService xysArticleService;
@Autowired
private IXysImgService xysImgService;
/**
* 查询文章列表
*/
@GetMapping("/getArticleList")
public TableDataInfo getArticleList(XysArticle xysArticle)
{
startPage();
List<XysArticle> list = xysArticleService.selectXysArticleList(xysArticle);
return getDataTable(list);
}
/**
* 查询图片列表
*/
@GetMapping("/getImgList")
public TableDataInfo getImgList(XysImg xysImg)
{
startPage();
List<XysImg> list = xysImgService.selectXysImgList(xysImg);
return getDataTable(list);
}
/**
* 获取文章管理详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(xysArticleService.selectXysArticleById(id));
}
}

View File

@ -79,8 +79,8 @@ public class XysArticleController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody XysArticle xysArticle) public AjaxResult add(@RequestBody XysArticle xysArticle)
{ {
String content = new String(Base64.decode(xysArticle.getContent())); // String content = new String(Base64.decode(xysArticle.getContent()));
xysArticle.setContent(content); // xysArticle.setContent(content);
return toAjax(xysArticleService.insertXysArticle(xysArticle)); return toAjax(xysArticleService.insertXysArticle(xysArticle));
} }
@ -92,8 +92,8 @@ public class XysArticleController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody XysArticle xysArticle) public AjaxResult edit(@RequestBody XysArticle xysArticle)
{ {
String content = new String(Base64.decode(xysArticle.getContent())); // String content = new String(Base64.decode(xysArticle.getContent()));
xysArticle.setContent(content); // xysArticle.setContent(content);
return toAjax(xysArticleService.updateXysArticle(xysArticle)); return toAjax(xysArticleService.updateXysArticle(xysArticle));
} }

View File

@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if> </if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectDictTypeAll" resultMap="SysDictTypeResult"> <select id="selectDictTypeAll" resultMap="SysDictTypeResult">

View File

@ -66,7 +66,11 @@
<el-table v-loading="loading" :data="imgList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="imgList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="官网图片管理" align="center" prop="id" /> <el-table-column label="官网图片管理" align="center" prop="id" />
<el-table-column label="图片类型" align="center" prop="imgType" /> <el-table-column label="图片类型" align="center" prop="imgType">
<template slot-scope="scope">
<dict-tag :options="dict.type.img_type" :value="scope.row.imgType"/>
</template>
</el-table-column>
<el-table-column label="图片地址" align="center" prop="imgUrl" width="100"> <el-table-column label="图片地址" align="center" prop="imgUrl" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<image-preview :src="scope.row.imgUrl" :width="50" :height="50"/> <image-preview :src="scope.row.imgUrl" :width="50" :height="50"/>
@ -109,6 +113,16 @@
<!-- 添加或修改图片管理对话框 --> <!-- 添加或修改图片管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="图片类型" prop="imgType">
<el-select v-model="form.imgType" placeholder="请选择图片类型">
<el-option
v-for="dict in dict.type.img_type"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="图片地址" prop="imgUrl"> <el-form-item label="图片地址" prop="imgUrl">
<image-upload v-model="form.imgUrl"/> <image-upload v-model="form.imgUrl"/>
</el-form-item> </el-form-item>
@ -139,7 +153,7 @@ import { listImg, getImg, delImg, addImg, updateImg } from "@/api/system/img";
export default { export default {
name: "Img", name: "Img",
dicts: ['article_cat'], dicts: ['img_type', 'article_cat'],
data() { data() {
return { return {
// //