feat(portal): 添加 haiwei官网 JSON 数据接口
- 新增 HwWeb 实体类,用于存储官网 JSON 数据 - 实现 HwWeb 相关的 CRUD 接口和方法,包括列表查询、导出、详情、新增、修改和删除 - 添加对应的 Mapper 接口和 XML 文件,实现与数据库的交互 - 实现 HwWeb 服务层接口和具体实现类,提供业务逻辑处理master
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* haiwei官网jsonController
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-08-18
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/hwWeb")
|
||||||
|
public class HwWebController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IHwWebService hwWebService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询haiwei官网json列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("portal:hwWeb:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(HwWeb hwWeb)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<HwWeb> list = hwWebService.selectHwWebList(hwWeb);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出haiwei官网json列表
|
||||||
|
*/
|
||||||
|
@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数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取haiwei官网json详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("portal:hwWeb:query")
|
||||||
|
@GetMapping(value = "/{webId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("webId") Long webId)
|
||||||
|
{
|
||||||
|
return success(hwWebService.selectHwWebByWebId(webId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增haiwei官网json
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("portal:hwWeb:add")
|
||||||
|
@Log(title = "haiwei官网json", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody HwWeb hwWeb)
|
||||||
|
{
|
||||||
|
return toAjax(hwWebService.insertHwWeb(hwWeb));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改haiwei官网json
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("portal:hwWeb:edit")
|
||||||
|
@Log(title = "haiwei官网json", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody HwWeb hwWeb)
|
||||||
|
{
|
||||||
|
return toAjax(hwWebService.updateHwWeb(hwWeb));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除haiwei官网json
|
||||||
|
*/
|
||||||
|
@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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* haiwei官网json对象 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* haiwei官网jsonMapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-08-18
|
||||||
|
*/
|
||||||
|
public interface HwWebMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询haiwei官网json
|
||||||
|
*
|
||||||
|
* @param webId haiwei官网json主键
|
||||||
|
* @return haiwei官网json
|
||||||
|
*/
|
||||||
|
public HwWeb selectHwWebByWebId(Long webId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询haiwei官网json列表
|
||||||
|
*
|
||||||
|
* @param hwWeb haiwei官网json
|
||||||
|
* @return haiwei官网json集合
|
||||||
|
*/
|
||||||
|
public List<HwWeb> selectHwWebList(HwWeb hwWeb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增haiwei官网json
|
||||||
|
*
|
||||||
|
* @param hwWeb haiwei官网json
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertHwWeb(HwWeb hwWeb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改haiwei官网json
|
||||||
|
*
|
||||||
|
* @param hwWeb haiwei官网json
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateHwWeb(HwWeb hwWeb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除haiwei官网json
|
||||||
|
*
|
||||||
|
* @param webId haiwei官网json主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteHwWebByWebId(Long webId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除haiwei官网json
|
||||||
|
*
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* haiwei官网jsonService接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-08-18
|
||||||
|
*/
|
||||||
|
public interface IHwWebService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询haiwei官网json
|
||||||
|
*
|
||||||
|
* @param webId haiwei官网json主键
|
||||||
|
* @return haiwei官网json
|
||||||
|
*/
|
||||||
|
public HwWeb selectHwWebByWebId(Long webId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询haiwei官网json列表
|
||||||
|
*
|
||||||
|
* @param hwWeb haiwei官网json
|
||||||
|
* @return haiwei官网json集合
|
||||||
|
*/
|
||||||
|
public List<HwWeb> selectHwWebList(HwWeb hwWeb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增haiwei官网json
|
||||||
|
*
|
||||||
|
* @param hwWeb haiwei官网json
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertHwWeb(HwWeb hwWeb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改haiwei官网json
|
||||||
|
*
|
||||||
|
* @param hwWeb haiwei官网json
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateHwWeb(HwWeb hwWeb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除haiwei官网json
|
||||||
|
*
|
||||||
|
* @param webIds 需要删除的haiwei官网json主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteHwWebByWebIds(Long[] webIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除haiwei官网json信息
|
||||||
|
*
|
||||||
|
* @param webId haiwei官网json主键
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* haiwei官网jsonService业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-08-18
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class HwWebServiceImpl implements IHwWebService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private HwWebMapper hwWebMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询haiwei官网json
|
||||||
|
*
|
||||||
|
* @param webId haiwei官网json主键
|
||||||
|
* @return haiwei官网json
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HwWeb selectHwWebByWebId(Long webId)
|
||||||
|
{
|
||||||
|
return hwWebMapper.selectHwWebByWebId(webId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询haiwei官网json列表
|
||||||
|
*
|
||||||
|
* @param hwWeb haiwei官网json
|
||||||
|
* @return haiwei官网json
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<HwWeb> selectHwWebList(HwWeb hwWeb)
|
||||||
|
{
|
||||||
|
return hwWebMapper.selectHwWebList(hwWeb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增haiwei官网json
|
||||||
|
*
|
||||||
|
* @param hwWeb haiwei官网json
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertHwWeb(HwWeb hwWeb)
|
||||||
|
{
|
||||||
|
return hwWebMapper.insertHwWeb(hwWeb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改haiwei官网json
|
||||||
|
*
|
||||||
|
* @param hwWeb haiwei官网json
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateHwWeb(HwWeb hwWeb)
|
||||||
|
{
|
||||||
|
return hwWebMapper.updateHwWeb(hwWeb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除haiwei官网json
|
||||||
|
*
|
||||||
|
* @param webIds 需要删除的haiwei官网json主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteHwWebByWebIds(Long[] webIds)
|
||||||
|
{
|
||||||
|
return hwWebMapper.deleteHwWebByWebIds(webIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除haiwei官网json信息
|
||||||
|
*
|
||||||
|
* @param webId haiwei官网json主键
|
||||||
|
* @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…
Reference in New Issue