门户网站配置完善
master
xs 4 weeks ago
parent 97420b1cb9
commit 0b0a8f5f90

@ -8,7 +8,9 @@ import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.portal.domain.HwPortalConfig;
import com.ruoyi.portal.domain.HwPortalConfigType;
import com.ruoyi.portal.service.IHwPortalConfigService;
import com.ruoyi.portal.service.IHwPortalConfigTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -28,6 +30,9 @@ public class HwPortalConfigController extends BaseController
@Autowired
private IHwPortalConfigService hwPortalConfigService;
@Autowired
private IHwPortalConfigTypeService hwPortalConfigTypeService;
/**
*
*/
@ -36,7 +41,7 @@ public class HwPortalConfigController extends BaseController
public TableDataInfo list(HwPortalConfig hwPortalConfig)
{
startPage();
List<HwPortalConfig> list = hwPortalConfigService.selectHwPortalConfigList(hwPortalConfig);
List<HwPortalConfig> list = hwPortalConfigService.selectHwPortalConfigJoinList(hwPortalConfig);
return getDataTable(list);
}
@ -95,4 +100,15 @@ public class HwPortalConfigController extends BaseController
{
return toAjax(hwPortalConfigService.deleteHwPortalConfigByPortalConfigIds(portalConfigIds));
}
/**
*
*/
@RequiresPermissions("portal:portalConfig:list")
@GetMapping("/portalConfigTypeTree")
public AjaxResult portalConfigTypeTree(HwPortalConfigType hwPortalConfigType) {
return success(hwPortalConfigTypeService.selectPortalConfigTypeTreeList(hwPortalConfigType));
}
}

@ -49,6 +49,8 @@ public class HwPortalConfig extends BaseEntity
@Excel(name = "主图地址")
private String portalConfigPic;
private String configTypeName;
public void setPortalConfigId(Long portalConfigId)
{
this.portalConfigId = portalConfigId;
@ -131,6 +133,14 @@ public class HwPortalConfig extends BaseEntity
return portalConfigPic;
}
public String getConfigTypeName() {
return configTypeName;
}
public void setConfigTypeName(String configTypeName) {
this.configTypeName = configTypeName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -1,10 +1,12 @@
package com.ruoyi.portal.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import com.ruoyi.common.core.web.domain.TreeEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.ArrayList;
import java.util.List;
/**
@ -13,7 +15,7 @@ import java.util.List;
* @author xins
* @date 2024-12-11
*/
public class HwPortalConfigType extends TreeEntity
public class HwPortalConfigType extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -44,8 +46,14 @@ public class HwPortalConfigType extends TreeEntity
@Excel(name = "首页图片地址")
private String homeConfigTypePic;
private Long parentId;
private String ancestors;
private List<HwProductCaseInfo> hwProductCaseInfoList;
/** 子类型 */
private List<HwPortalConfigType> children = new ArrayList<HwPortalConfigType>();
public void setConfigTypeId(Long configTypeId)
{
@ -111,6 +119,22 @@ public class HwPortalConfigType extends TreeEntity
return homeConfigTypePic;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public List<HwProductCaseInfo> getHwProductCaseInfoList() {
return hwProductCaseInfoList;
}
@ -119,6 +143,14 @@ public class HwPortalConfigType extends TreeEntity
this.hwProductCaseInfoList = hwProductCaseInfoList;
}
public List<HwPortalConfigType> getChildren() {
return children;
}
public void setChildren(List<HwPortalConfigType> children) {
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -0,0 +1,69 @@
package com.ruoyi.portal.domain.vo;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.portal.domain.HwPortalConfigType;
/**
* Treeselect
*
* @author ruoyi
*/
public class TreeSelect implements Serializable
{
private static final long serialVersionUID = 1L;
/** 节点ID */
private Long id;
/** 节点名称 */
private String label;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
public TreeSelect()
{
}
public TreeSelect(HwPortalConfigType portalConfigType)
{
this.id = portalConfigType.getConfigTypeId();
this.label = portalConfigType.getConfigTypeName();
this.children = portalConfigType.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getLabel()
{
return label;
}
public void setLabel(String label)
{
this.label = label;
}
public List<TreeSelect> getChildren()
{
return children;
}
public void setChildren(List<TreeSelect> children)
{
this.children = children;
}
}

@ -59,4 +59,14 @@ public interface HwPortalConfigMapper
* @return
*/
public int deleteHwPortalConfigByPortalConfigIds(Long[] portalConfigIds);
/**
* ,join hw_portal_config_type
*
* @param hwPortalConfig
* @return
*/
public List<HwPortalConfig> selectHwPortalConfigJoinList(HwPortalConfig hwPortalConfig);
}

@ -59,4 +59,12 @@ public interface IHwPortalConfigService
* @return
*/
public int deleteHwPortalConfigByPortalConfigId(Long portalConfigId);
/**
* ,Join hw_portal_config_type
*
* @param hwPortalConfig
* @return
*/
public List<HwPortalConfig> selectHwPortalConfigJoinList(HwPortalConfig hwPortalConfig);
}

@ -1,6 +1,7 @@
package com.ruoyi.portal.service;
import com.ruoyi.portal.domain.HwPortalConfigType;
import com.ruoyi.portal.domain.vo.TreeSelect;
import java.util.List;
@ -59,4 +60,28 @@ public interface IHwPortalConfigTypeService
* @return
*/
public int deleteHwPortalConfigTypeByConfigTypeId(Long configTypeId);
/**
*
*
* @param portalConfigType
* @return
*/
public List<TreeSelect> selectPortalConfigTypeTreeList(HwPortalConfigType portalConfigType);
/**
*
*
* @param portalConfigTypes
* @return
*/
public List<TreeSelect> buildPortalConfigTypeTreeSelect(List<HwPortalConfigType> portalConfigTypes);
/**
*
*
* @param portalConfigTypes
* @return
*/
public List<HwPortalConfigType> buildPortalConfigTypeTree(List<HwPortalConfigType> portalConfigTypes);
}

@ -94,4 +94,18 @@ public class HwPortalConfigServiceImpl implements IHwPortalConfigService
{
return hwPortalConfigMapper.deleteHwPortalConfigByPortalConfigId(portalConfigId);
}
/**
* ,Join hw_portal_config_type
*
* @param hwPortalConfig
* @return
*/
@Override
public List<HwPortalConfig> selectHwPortalConfigJoinList(HwPortalConfig hwPortalConfig)
{
return hwPortalConfigMapper.selectHwPortalConfigJoinList(hwPortalConfig);
}
}

@ -1,13 +1,20 @@
package com.ruoyi.portal.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.SpringUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.portal.domain.HwPortalConfigType;
import com.ruoyi.portal.domain.vo.TreeSelect;
import com.ruoyi.portal.mapper.HwPortalConfigTypeMapper;
import com.ruoyi.portal.service.IHwPortalConfigTypeService;
import com.ruoyi.system.api.domain.SysDept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
/**
* Service
@ -94,4 +101,91 @@ public class HwPortalConfigTypeServiceImpl implements IHwPortalConfigTypeService
{
return hwPortalConfigTypeMapper.deleteHwPortalConfigTypeByConfigTypeId(configTypeId);
}
/**
*
*
* @param portalConfigType
* @return
*/
@Override
public List<TreeSelect> selectPortalConfigTypeTreeList(HwPortalConfigType portalConfigType) {
List<HwPortalConfigType> portalConfigTypes = this.selectHwPortalConfigTypeList(portalConfigType);
System.out.println("1");
return buildPortalConfigTypeTreeSelect(portalConfigTypes);
}
/**
*
*
* @param portalConfigTypes
* @return
*/
@Override
public List<TreeSelect> buildPortalConfigTypeTreeSelect(List<HwPortalConfigType> portalConfigTypes) {
List<HwPortalConfigType> deptTrees = buildPortalConfigTypeTree(portalConfigTypes);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
*
*
* @param portalConfigTypes
* @return
*/
@Override
public List<HwPortalConfigType> buildPortalConfigTypeTree(List<HwPortalConfigType> portalConfigTypes) {
List<HwPortalConfigType> returnList = new ArrayList<HwPortalConfigType>();
List<Long> tempList = portalConfigTypes.stream().map(HwPortalConfigType::getConfigTypeId).collect(Collectors.toList());
for (HwPortalConfigType portalConfigType : portalConfigTypes) {
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(portalConfigType.getParentId())) {
recursionFn(portalConfigTypes, portalConfigType);
returnList.add(portalConfigType);
}
}
if (returnList.isEmpty()) {
returnList = portalConfigTypes;
}
return returnList;
}
/**
*
*/
private void recursionFn(List<HwPortalConfigType> list, HwPortalConfigType t) {
// 得到子节点列表
List<HwPortalConfigType> childList = getChildList(list, t);
t.setChildren(childList);
for (HwPortalConfigType tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
/**
*
*/
private List<HwPortalConfigType> getChildList(List<HwPortalConfigType> list, HwPortalConfigType t) {
List<HwPortalConfigType> tlist = new ArrayList<HwPortalConfigType>();
Iterator<HwPortalConfigType> it = list.iterator();
while (it.hasNext()) {
HwPortalConfigType n = (HwPortalConfigType) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getConfigTypeId().longValue()) {
tlist.add(n);
}
}
return tlist;
}
/**
*
*/
private boolean hasChild(List<HwPortalConfigType> list, HwPortalConfigType t) {
return getChildList(list, t).size() > 0 ? true : false;
}
}

@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="configTypeName" column="config_type_name" />
</resultMap>
<sql id="selectHwPortalConfigVo">
@ -29,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="portalConfigType != null and portalConfigType != ''"> and portal_config_type = #{portalConfigType}</if>
<if test="portalConfigTypeId != null "> and portal_config_type_id = #{portalConfigTypeId}</if>
<if test="portalConfigTitle != null and portalConfigTitle != ''"> and portal_config_title = #{portalConfigTitle}</if>
<if test="portalConfigTitle != null and portalConfigTitle != ''"> and portal_config_title like concat('%', #{portalConfigTitle}, '%')</if>
<if test="portalConfigOrder != null "> and portal_config_order = #{portalConfigOrder}</if>
<if test="portalConfigDesc != null and portalConfigDesc != ''"> and portal_config_desc = #{portalConfigDesc}</if>
<if test="buttonName != null and buttonName != ''"> and button_name like concat('%', #{buttonName}, '%')</if>
@ -104,4 +105,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{portalConfigId}
</foreach>
</delete>
<sql id="selectHwPortalConfigJoinVo">
select hpc.portal_config_id, hpc.portal_config_type,hpc.portal_config_type_id,
hpc.portal_config_title, hpc.portal_config_order, hpc.portal_config_desc,
hpc.button_name, hpc.router_address, hpc.portal_config_pic,
hpc.create_time, hpc.create_by, hpc.update_time, hpc.update_by,hpct.config_type_name from hw_portal_config hpc
left join hw_portal_config_type hpct on hpc.portal_config_type_id = hpct.config_type_id
</sql>
<select id="selectHwPortalConfigJoinList" parameterType="HwPortalConfig" resultMap="HwPortalConfigResult">
<include refid="selectHwPortalConfigJoinVo"/>
<where>
<if test="portalConfigType != null and portalConfigType != ''"> and hpc.portal_config_type = #{portalConfigType}</if>
<if test="portalConfigTypeId != null "> and hpc.portal_config_type_id = #{portalConfigTypeId}</if>
<if test="portalConfigTitle != null and portalConfigTitle != ''"> and hpc.portal_config_title like concat('%', #{portalConfigTitle}, '%')</if>
<if test="portalConfigOrder != null "> and hpc.portal_config_order = #{portalConfigOrder}</if>
<if test="portalConfigDesc != null and portalConfigDesc != ''"> and hpc.portal_config_desc = #{portalConfigDesc}</if>
<if test="buttonName != null and buttonName != ''"> and hpc.button_name like concat('%', #{buttonName}, '%')</if>
<if test="routerAddress != null and routerAddress != ''"> and hpc.router_address = #{routerAddress}</if>
<if test="portalConfigPic != null and portalConfigPic != ''"> and hpc.portal_config_pic = #{portalConfigPic}</if>
</where>
</select>
</mapper>

@ -42,3 +42,12 @@ export function delPortalConfig(portalConfigId) {
method: 'delete'
})
}
// 查询门户网站配置类型下拉树结构
export function portalConfigTypeTree(query) {
return request({
url: '/portal/portalConfig/portalConfigTypeTree',
method: 'get',
params: query
})
}

@ -9,37 +9,15 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="顺序" prop="portalConfigOrder">
<el-input
v-model="queryParams.portalConfigOrder"
placeholder="请输入顺序"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="按钮名称" prop="buttonName">
<el-input
v-model="queryParams.buttonName"
placeholder="请输入按钮名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="按钮跳转地址" prop="routerAddress">
<el-input
v-model="queryParams.routerAddress"
placeholder="请输入按钮跳转地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="主图地址" prop="portalConfigPic">
<el-input
v-model="queryParams.portalConfigPic"
placeholder="请输入主图地址"
clearable
@keyup.enter.native="handleQuery"
/>
<el-form-item label="类型" prop="portalConfigType">
<el-select v-model="queryParams.portalConfigType" placeholder="请选择类型" clearable>
<el-option
v-for="dict in dict.type.hw_portal_config_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
@ -96,8 +74,13 @@
<el-table v-loading="loading" :data="portalConfigList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键标识" align="center" prop="portalConfigId" />
<el-table-column label="类型(1首页大图 2产品中心大图)" align="center" prop="portalConfigType" />
<el-table-column label="类型ID" align="center" prop="portalConfigTypeId" />
<el-table-column label="类型" align="center" prop="portalConfigType" >
<template slot-scope="scope">
<dict-tag :options="dict.type.hw_portal_config_type" :value="scope.row.portalConfigType"/>
</template>
</el-table-column>
<el-table-column label="门户网站配置类型ID" align="center" prop="portalConfigTypeId" v-if="false"/>
<el-table-column label="门户网站配置类型名称" align="center" prop="configTypeName" />
<el-table-column label="标题" align="center" prop="portalConfigTitle" />
<el-table-column label="顺序" align="center" prop="portalConfigOrder" />
<el-table-column label="内容" align="center" prop="portalConfigDesc" />
@ -134,13 +117,18 @@
<!-- 添加或修改门户网站配置对话框 -->
<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="120px">
<el-form-item label="标题" prop="portalConfigTitle">
<el-input v-model="form.portalConfigTitle" placeholder="请输入标题" />
</el-form-item>
<el-form-item label="配置类型ID" prop="portalConfigTypeId">
<el-input v-model="form.portalConfigTypeId" placeholder="请输入配置类型ID" />
<!-- <el-form-item label="配置类型ID" prop="portalConfigTypeId">-->
<!-- <el-input v-model="form.portalConfigTypeId" placeholder="请输入配置类型ID" />-->
<!-- </el-form-item>-->
<el-form-item label="门户网站配置类型" prop="portalConfigTypeId">
<treeselect v-model="form.portalConfigTypeId" :options="editedPortalConfigTypes" :show-count="true"
placeholder="请选择门户网站配置类型"/>
</el-form-item>
@ -222,10 +210,13 @@
</template>
<script>
import { listPortalConfig, getPortalConfig, delPortalConfig, addPortalConfig, updatePortalConfig } from "@/api/portal/portalConfig";
import { listPortalConfig, getPortalConfig, delPortalConfig, addPortalConfig, updatePortalConfig,portalConfigTypeTree } from "@/api/portal/portalConfig";
import {getToken} from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
components: {Treeselect},
dicts: ['hw_portal_config_type'],
name: "PortalConfig",
props: {
@ -285,6 +276,8 @@ export default {
},
//
form: {},
//
editedPortalConfigTypes: [],
//
rules: {
portalConfigType: [
@ -367,12 +360,22 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.getEditPortalConfigTypeTree();
this.open = true;
this.title = "添加门户网站配置";
},
/** 用户编辑页面查询部门下拉树结构 */
getEditPortalConfigTypeTree() {
portalConfigTypeTree({}).then(response => {
this.editedPortalConfigTypes = response.data;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getEditPortalConfigTypeTree();
const portalConfigId = row.portalConfigId || this.ids
getPortalConfig(portalConfigId).then(response => {
this.form = response.data;

Loading…
Cancel
Save