feat(portal): 添加 haiwei官网 JSON 数据接口

- 新增 HwWeb 实体类,用于存储官网 JSON 数据
- 实现 HwWeb 相关的 CRUD 接口和方法,包括列表查询、导出、详情、新增、修改和删除
- 添加对应的 Mapper 接口和 XML 文件,实现与数据库的交互
- 实现 HwWeb 服务层接口和具体实现类,提供业务逻辑处理
master
zch 2 days ago
parent a41e34a295
commit 0ff03d2195

@ -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.HwWeb;
import com.ruoyi.portal.service.IHwWebService;
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;
/**
* haiweijsonController
*
* @author ruoyi
* @date 2025-08-18
*/
@RestController
@RequestMapping("/hwWeb")
public class HwWebController extends BaseController
{
@Autowired
private IHwWebService hwWebService;
/**
* haiweijson
*/
@RequiresPermissions("portal:hwWeb:list")
@GetMapping("/list")
public TableDataInfo list(HwWeb hwWeb)
{
startPage();
List<HwWeb> list = hwWebService.selectHwWebList(hwWeb);
return getDataTable(list);
}
/**
* haiweijson
*/
@RequiresPermissions("portal:hwWeb:export")
@Log(title = "haiwei官网json", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, HwWeb hwWeb)
{
List<HwWeb> list = hwWebService.selectHwWebList(hwWeb);
ExcelUtil<HwWeb> util = new ExcelUtil<HwWeb>(HwWeb.class);
util.exportExcel(response, list, "haiwei官网json数据");
}
/**
* haiweijson
*/
@RequiresPermissions("portal:hwWeb:query")
@GetMapping(value = "/{webId}")
public AjaxResult getInfo(@PathVariable("webId") Long webId)
{
return success(hwWebService.selectHwWebByWebId(webId));
}
/**
* haiweijson
*/
@RequiresPermissions("portal:hwWeb:add")
@Log(title = "haiwei官网json", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody HwWeb hwWeb)
{
return toAjax(hwWebService.insertHwWeb(hwWeb));
}
/**
* haiweijson
*/
@RequiresPermissions("portal:hwWeb:edit")
@Log(title = "haiwei官网json", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody HwWeb hwWeb)
{
return toAjax(hwWebService.updateHwWeb(hwWeb));
}
/**
* haiweijson
*/
@RequiresPermissions("portal:hwWeb:remove")
@Log(title = "haiwei官网json", businessType = BusinessType.DELETE)
@DeleteMapping("/{webIds}")
public AjaxResult remove(@PathVariable Long[] webIds)
{
return toAjax(hwWebService.deleteHwWebByWebIds(webIds));
}
}

@ -0,0 +1,51 @@
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;
/**
* haiweijson hw_web
*
* @author ruoyi
* @date 2025-08-18
*/
public class HwWeb extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long webId;
/** json */
@Excel(name = "json")
private String webJson;
public void setWebId(Long webId)
{
this.webId = webId;
}
public Long getWebId()
{
return webId;
}
public void setWebJson(String webJson)
{
this.webJson = webJson;
}
public String getWebJson()
{
return webJson;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("webId", getWebId())
.append("webJson", getWebJson())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.portal.mapper;
import java.util.List;
import com.ruoyi.portal.domain.HwWeb;
/**
* haiweijsonMapper
*
* @author ruoyi
* @date 2025-08-18
*/
public interface HwWebMapper
{
/**
* haiweijson
*
* @param webId haiweijson
* @return haiweijson
*/
public HwWeb selectHwWebByWebId(Long webId);
/**
* haiweijson
*
* @param hwWeb haiweijson
* @return haiweijson
*/
public List<HwWeb> selectHwWebList(HwWeb hwWeb);
/**
* haiweijson
*
* @param hwWeb haiweijson
* @return
*/
public int insertHwWeb(HwWeb hwWeb);
/**
* haiweijson
*
* @param hwWeb haiweijson
* @return
*/
public int updateHwWeb(HwWeb hwWeb);
/**
* haiweijson
*
* @param webId haiweijson
* @return
*/
public int deleteHwWebByWebId(Long webId);
/**
* haiweijson
*
* @param webIds
* @return
*/
public int deleteHwWebByWebIds(Long[] webIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.portal.service;
import java.util.List;
import com.ruoyi.portal.domain.HwWeb;
/**
* haiweijsonService
*
* @author ruoyi
* @date 2025-08-18
*/
public interface IHwWebService
{
/**
* haiweijson
*
* @param webId haiweijson
* @return haiweijson
*/
public HwWeb selectHwWebByWebId(Long webId);
/**
* haiweijson
*
* @param hwWeb haiweijson
* @return haiweijson
*/
public List<HwWeb> selectHwWebList(HwWeb hwWeb);
/**
* haiweijson
*
* @param hwWeb haiweijson
* @return
*/
public int insertHwWeb(HwWeb hwWeb);
/**
* haiweijson
*
* @param hwWeb haiweijson
* @return
*/
public int updateHwWeb(HwWeb hwWeb);
/**
* haiweijson
*
* @param webIds haiweijson
* @return
*/
public int deleteHwWebByWebIds(Long[] webIds);
/**
* haiweijson
*
* @param webId haiweijson
* @return
*/
public int deleteHwWebByWebId(Long webId);
}

@ -0,0 +1,93 @@
package com.ruoyi.portal.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.portal.mapper.HwWebMapper;
import com.ruoyi.portal.domain.HwWeb;
import com.ruoyi.portal.service.IHwWebService;
/**
* haiweijsonService
*
* @author ruoyi
* @date 2025-08-18
*/
@Service
public class HwWebServiceImpl implements IHwWebService
{
@Autowired
private HwWebMapper hwWebMapper;
/**
* haiweijson
*
* @param webId haiweijson
* @return haiweijson
*/
@Override
public HwWeb selectHwWebByWebId(Long webId)
{
return hwWebMapper.selectHwWebByWebId(webId);
}
/**
* haiweijson
*
* @param hwWeb haiweijson
* @return haiweijson
*/
@Override
public List<HwWeb> selectHwWebList(HwWeb hwWeb)
{
return hwWebMapper.selectHwWebList(hwWeb);
}
/**
* haiweijson
*
* @param hwWeb haiweijson
* @return
*/
@Override
public int insertHwWeb(HwWeb hwWeb)
{
return hwWebMapper.insertHwWeb(hwWeb);
}
/**
* haiweijson
*
* @param hwWeb haiweijson
* @return
*/
@Override
public int updateHwWeb(HwWeb hwWeb)
{
return hwWebMapper.updateHwWeb(hwWeb);
}
/**
* haiweijson
*
* @param webIds haiweijson
* @return
*/
@Override
public int deleteHwWebByWebIds(Long[] webIds)
{
return hwWebMapper.deleteHwWebByWebIds(webIds);
}
/**
* haiweijson
*
* @param webId haiweijson
* @return
*/
@Override
public int deleteHwWebByWebId(Long webId)
{
return hwWebMapper.deleteHwWebByWebId(webId);
}
}

@ -0,0 +1,56 @@
<?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.HwWebMapper">
<resultMap type="HwWeb" id="HwWebResult">
<result property="webId" column="web_id" />
<result property="webJson" column="web_json" />
</resultMap>
<sql id="selectHwWebVo">
select web_id, web_json from hw_web
</sql>
<select id="selectHwWebList" parameterType="HwWeb" resultMap="HwWebResult">
<include refid="selectHwWebVo"/>
<where>
<if test="webJson != null and webJson != ''"> and web_json = #{webJson}</if>
</where>
</select>
<select id="selectHwWebByWebId" parameterType="Long" resultMap="HwWebResult">
<include refid="selectHwWebVo"/>
where web_id = #{webId}
</select>
<insert id="insertHwWeb" parameterType="HwWeb" useGeneratedKeys="true" keyProperty="webId">
insert into hw_web
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="webJson != null">web_json,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="webJson != null">#{webJson},</if>
</trim>
</insert>
<update id="updateHwWeb" parameterType="HwWeb">
update hw_web
<trim prefix="SET" suffixOverrides=",">
<if test="webJson != null">web_json = #{webJson},</if>
</trim>
where web_id = #{webId}
</update>
<delete id="deleteHwWebByWebId" parameterType="Long">
delete from hw_web where web_id = #{webId}
</delete>
<delete id="deleteHwWebByWebIds" parameterType="String">
delete from hw_web where web_id in
<foreach item="webId" collection="array" open="(" separator="," close=")">
#{webId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save