2024.7.10 新元素官网 字典倒序,网站接口代码
This commit is contained in:
parent
3fbe35e556
commit
25a85220ba
|
@ -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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDictTypeVo">
|
<sql id="selectDictTypeVo">
|
||||||
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
|
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
|
||||||
from sys_dict_type
|
from sys_dict_type
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
@ -39,36 +39,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
and date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
and date_format(create_time,'%y%m%d') <= 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">
|
||||||
<include refid="selectDictTypeVo"/>
|
<include refid="selectDictTypeVo"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
|
<select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
|
||||||
<include refid="selectDictTypeVo"/>
|
<include refid="selectDictTypeVo"/>
|
||||||
where dict_id = #{dictId}
|
where dict_id = #{dictId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
|
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
|
||||||
<include refid="selectDictTypeVo"/>
|
<include refid="selectDictTypeVo"/>
|
||||||
where dict_type = #{dictType}
|
where dict_type = #{dictType}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
|
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
|
||||||
<include refid="selectDictTypeVo"/>
|
<include refid="selectDictTypeVo"/>
|
||||||
where dict_type = #{dictType} limit 1
|
where dict_type = #{dictType} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="deleteDictTypeById" parameterType="Long">
|
<delete id="deleteDictTypeById" parameterType="Long">
|
||||||
delete from sys_dict_type where dict_id = #{dictId}
|
delete from sys_dict_type where dict_id = #{dictId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteDictTypeByIds" parameterType="Long">
|
<delete id="deleteDictTypeByIds" parameterType="Long">
|
||||||
delete from sys_dict_type where dict_id in
|
delete from sys_dict_type where dict_id in
|
||||||
<foreach collection="array" item="dictId" open="(" separator="," close=")">
|
<foreach collection="array" item="dictId" open="(" separator="," close=")">
|
||||||
#{dictId}
|
#{dictId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<update id="updateDictType" parameterType="SysDictType">
|
<update id="updateDictType" parameterType="SysDictType">
|
||||||
|
@ -83,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</set>
|
</set>
|
||||||
where dict_id = #{dictId}
|
where dict_id = #{dictId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<insert id="insertDictType" parameterType="SysDictType">
|
<insert id="insertDictType" parameterType="SysDictType">
|
||||||
insert into sys_dict_type(
|
insert into sys_dict_type(
|
||||||
<if test="dictName != null and dictName != ''">dict_name,</if>
|
<if test="dictName != null and dictName != ''">dict_name,</if>
|
||||||
|
@ -101,5 +102,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sysdate()
|
sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -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 {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
Loading…
Reference in New Issue