feat(hw-portal): 新增Hw资料文件管理模块新增HwWebDocument实体类及相关接口实现,包括控制器、服务层、数据访问层及前端API调用。支持资料文件的增删改查、导出功能,并提供对应权限控制和操作日志记录。

master
zangch@mesnac.com 3 months ago
parent ed5cd44dc8
commit 8003a57595

@ -0,0 +1,105 @@
package com.ruoyi.portal.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.HwWebDocument;
import com.ruoyi.portal.service.IHwWebDocumentService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* HwController
*
* @author zch
* @date 2025-09-22
*/
@RestController
@RequestMapping("/hwWebDocument")
public class HwWebDocumentController extends BaseController
{
@Autowired
private IHwWebDocumentService hwWebDocumentService;
/**
* Hw
*/
@RequiresPermissions("com.ruoyi.portal:hwWebDocument:list")
@GetMapping("/list")
public TableDataInfo list(HwWebDocument hwWebDocument)
{
startPage();
List<HwWebDocument> list = hwWebDocumentService.selectHwWebDocumentList(hwWebDocument);
return getDataTable(list);
}
/**
* Hw
*/
@RequiresPermissions("com.ruoyi.portal:hwWebDocument:export")
@Log(title = "Hw资料文件", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, HwWebDocument hwWebDocument)
{
List<HwWebDocument> list = hwWebDocumentService.selectHwWebDocumentList(hwWebDocument);
ExcelUtil<HwWebDocument> util = new ExcelUtil<HwWebDocument>(HwWebDocument.class);
util.exportExcel(response, list, "Hw资料文件数据");
}
/**
* Hw
*/
@RequiresPermissions("com.ruoyi.portal:hwWebDocument:query")
@GetMapping(value = "/{documentId}")
public AjaxResult getInfo(@PathVariable("documentId") Long documentId)
{
return success(hwWebDocumentService.selectHwWebDocumentByDocumentId(documentId));
}
/**
* Hw
*/
@RequiresPermissions("com.ruoyi.portal:hwWebDocument:add")
@Log(title = "Hw资料文件", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody HwWebDocument hwWebDocument)
{
return toAjax(hwWebDocumentService.insertHwWebDocument(hwWebDocument));
}
/**
* Hw
*/
@RequiresPermissions("com.ruoyi.portal:hwWebDocument:edit")
@Log(title = "Hw资料文件", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody HwWebDocument hwWebDocument)
{
return toAjax(hwWebDocumentService.updateHwWebDocument(hwWebDocument));
}
/**
* Hw
*/
@RequiresPermissions("com.ruoyi.portal:hwWebDocument:remove")
@Log(title = "Hw资料文件", businessType = BusinessType.DELETE)
@DeleteMapping("/{documentIds}")
public AjaxResult remove(@PathVariable Long[] documentIds)
{
return toAjax(hwWebDocumentService.deleteHwWebDocumentByDocumentIds(documentIds));
}
}

@ -0,0 +1,94 @@
package com.ruoyi.portal.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* Hw hw_web_document
*
* @author zch
* @date 2025-09-22
*/
public class HwWebDocument extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long documentId;
/** 租户id */
@Excel(name = "租户id")
private Long tenantId;
/** 文件存储地址 */
@Excel(name = "文件存储地址")
private String documentAddress;
/** 页面编码,用来连表查询 */
@Excel(name = "页面编码,用来连表查询")
private String webCode;
/** 密钥 */
@Excel(name = "密钥")
private String secretKey;
public void setDocumentId(Long documentId)
{
this.documentId = documentId;
}
public Long getDocumentId()
{
return documentId;
}
public void setTenantId(Long tenantId)
{
this.tenantId = tenantId;
}
public Long getTenantId()
{
return tenantId;
}
public void setDocumentAddress(String documentAddress)
{
this.documentAddress = documentAddress;
}
public String getDocumentAddress()
{
return documentAddress;
}
public void setWebCode(String webCode)
{
this.webCode = webCode;
}
public String getWebCode()
{
return webCode;
}
public void setSecretKey(String secretKey)
{
this.secretKey = secretKey;
}
public String getSecretKey()
{
return secretKey;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("documentId", getDocumentId())
.append("tenantId", getTenantId())
.append("documentAddress", getDocumentAddress())
.append("createTime", getCreateTime())
.append("webCode", getWebCode())
.append("secretKey", getSecretKey())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.portal.mapper;
import java.util.List;
import com.ruoyi.portal.domain.HwWebDocument;
/**
* HwMapper
*
* @author zch
* @date 2025-09-22
*/
public interface HwWebDocumentMapper
{
/**
* Hw
*
* @param documentId Hw
* @return Hw
*/
public HwWebDocument selectHwWebDocumentByDocumentId(Long documentId);
/**
* Hw
*
* @param hwWebDocument Hw
* @return Hw
*/
public List<HwWebDocument> selectHwWebDocumentList(HwWebDocument hwWebDocument);
/**
* Hw
*
* @param hwWebDocument Hw
* @return
*/
public int insertHwWebDocument(HwWebDocument hwWebDocument);
/**
* Hw
*
* @param hwWebDocument Hw
* @return
*/
public int updateHwWebDocument(HwWebDocument hwWebDocument);
/**
* Hw
*
* @param documentId Hw
* @return
*/
public int deleteHwWebDocumentByDocumentId(Long documentId);
/**
* Hw
*
* @param documentIds
* @return
*/
public int deleteHwWebDocumentByDocumentIds(Long[] documentIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.portal.service;
import java.util.List;
import com.ruoyi.portal.domain.HwWebDocument;
/**
* HwService
*
* @author zch
* @date 2025-09-22
*/
public interface IHwWebDocumentService
{
/**
* Hw
*
* @param documentId Hw
* @return Hw
*/
public HwWebDocument selectHwWebDocumentByDocumentId(Long documentId);
/**
* Hw
*
* @param hwWebDocument Hw
* @return Hw
*/
public List<HwWebDocument> selectHwWebDocumentList(HwWebDocument hwWebDocument);
/**
* Hw
*
* @param hwWebDocument Hw
* @return
*/
public int insertHwWebDocument(HwWebDocument hwWebDocument);
/**
* Hw
*
* @param hwWebDocument Hw
* @return
*/
public int updateHwWebDocument(HwWebDocument hwWebDocument);
/**
* Hw
*
* @param documentIds Hw
* @return
*/
public int deleteHwWebDocumentByDocumentIds(Long[] documentIds);
/**
* Hw
*
* @param documentId Hw
* @return
*/
public int deleteHwWebDocumentByDocumentId(Long documentId);
}

@ -0,0 +1,95 @@
package com.ruoyi.portal.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.portal.mapper.HwWebDocumentMapper;
import com.ruoyi.portal.domain.HwWebDocument;
import com.ruoyi.portal.service.IHwWebDocumentService;
/**
* HwService
*
* @author zch
* @date 2025-09-22
*/
@Service
public class HwWebDocumentServiceImpl implements IHwWebDocumentService
{
@Autowired
private HwWebDocumentMapper hwWebDocumentMapper;
/**
* Hw
*
* @param documentId Hw
* @return Hw
*/
@Override
public HwWebDocument selectHwWebDocumentByDocumentId(Long documentId)
{
return hwWebDocumentMapper.selectHwWebDocumentByDocumentId(documentId);
}
/**
* Hw
*
* @param hwWebDocument Hw
* @return Hw
*/
@Override
public List<HwWebDocument> selectHwWebDocumentList(HwWebDocument hwWebDocument)
{
return hwWebDocumentMapper.selectHwWebDocumentList(hwWebDocument);
}
/**
* Hw
*
* @param hwWebDocument Hw
* @return
*/
@Override
public int insertHwWebDocument(HwWebDocument hwWebDocument)
{
hwWebDocument.setCreateTime(DateUtils.getNowDate());
return hwWebDocumentMapper.insertHwWebDocument(hwWebDocument);
}
/**
* Hw
*
* @param hwWebDocument Hw
* @return
*/
@Override
public int updateHwWebDocument(HwWebDocument hwWebDocument)
{
return hwWebDocumentMapper.updateHwWebDocument(hwWebDocument);
}
/**
* Hw
*
* @param documentIds Hw
* @return
*/
@Override
public int deleteHwWebDocumentByDocumentIds(Long[] documentIds)
{
return hwWebDocumentMapper.deleteHwWebDocumentByDocumentIds(documentIds);
}
/**
* Hw
*
* @param documentId Hw
* @return
*/
@Override
public int deleteHwWebDocumentByDocumentId(Long documentId)
{
return hwWebDocumentMapper.deleteHwWebDocumentByDocumentId(documentId);
}
}

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.portal.mapper.HwWebDocumentMapper">
<resultMap type="HwWebDocument" id="HwWebDocumentResult">
<result property="documentId" column="document_id" />
<result property="tenantId" column="tenant_id" />
<result property="documentAddress" column="document_address" />
<result property="createTime" column="create_time" />
<result property="webCode" column="web_code" />
<result property="secretKey" column="secretKey" />
</resultMap>
<sql id="selectHwWebDocumentVo">
select document_id, tenant_id, document_address, create_time, web_code, secretKey from hw_web_document
</sql>
<select id="selectHwWebDocumentList" parameterType="HwWebDocument" resultMap="HwWebDocumentResult">
<include refid="selectHwWebDocumentVo"/>
<where>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="documentAddress != null and documentAddress != ''"> and document_address = #{documentAddress}</if>
<if test="webCode != null and webCode != ''"> and web_code = #{webCode}</if>
<if test="secretKey != null and secretKey != ''"> and secretKey = #{secretKey}</if>
</where>
</select>
<select id="selectHwWebDocumentByDocumentId" parameterType="Long" resultMap="HwWebDocumentResult">
<include refid="selectHwWebDocumentVo"/>
where document_id = #{documentId}
</select>
<insert id="insertHwWebDocument" parameterType="HwWebDocument" useGeneratedKeys="true" keyProperty="documentId">
insert into hw_web_document
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tenantId != null">tenant_id,</if>
<if test="documentAddress != null">document_address,</if>
<if test="createTime != null">create_time,</if>
<if test="webCode != null">web_code,</if>
<if test="secretKey != null">secretKey,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tenantId != null">#{tenantId},</if>
<if test="documentAddress != null">#{documentAddress},</if>
<if test="createTime != null">#{createTime},</if>
<if test="webCode != null">#{webCode},</if>
<if test="secretKey != null">#{secretKey},</if>
</trim>
</insert>
<update id="updateHwWebDocument" parameterType="HwWebDocument">
update hw_web_document
<trim prefix="SET" suffixOverrides=",">
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="documentAddress != null">document_address = #{documentAddress},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="webCode != null">web_code = #{webCode},</if>
<if test="secretKey != null">secretKey = #{secretKey},</if>
</trim>
where document_id = #{documentId}
</update>
<delete id="deleteHwWebDocumentByDocumentId" parameterType="Long">
delete from hw_web_document where document_id = #{documentId}
</delete>
<delete id="deleteHwWebDocumentByDocumentIds" parameterType="String">
delete from hw_web_document where document_id in
<foreach item="documentId" collection="array" open="(" separator="," close=")">
#{documentId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询Hw资料文件列表
export function listHwWebDocument(query) {
return request({
url: '/com.ruoyi.portal/hwWebDocument/list',
method: 'get',
params: query
})
}
// 查询Hw资料文件详细
export function getHwWebDocument(documentId) {
return request({
url: '/com.ruoyi.portal/hwWebDocument/' + documentId,
method: 'get'
})
}
// 新增Hw资料文件
export function addHwWebDocument(data) {
return request({
url: '/com.ruoyi.portal/hwWebDocument',
method: 'post',
data: data
})
}
// 修改Hw资料文件
export function updateHwWebDocument(data) {
return request({
url: '/com.ruoyi.portal/hwWebDocument',
method: 'put',
data: data
})
}
// 删除Hw资料文件
export function delHwWebDocument(documentId) {
return request({
url: '/com.ruoyi.portal/hwWebDocument/' + documentId,
method: 'delete'
})
}
Loading…
Cancel
Save