Browse Source

超链接

LIVE_YE 1 year ago
parent
commit
5fa621e8b6

+ 104 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/hyperlink/HyperlinkController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.web.controller.hyperlink;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+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.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.Hyperlink;
+import com.ruoyi.system.service.IHyperlinkService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 超链接Controller
+ *
+ * @author boman
+ * @date 2024-04-30
+ */
+@RestController
+@RequestMapping("/system/hyperlink")
+public class HyperlinkController extends BaseController
+{
+    @Autowired
+    private IHyperlinkService hyperlinkService;
+
+/**
+ * 查询超链接列表
+ */
+@PreAuthorize("@ss.hasPermi('system:hyperlink:list')")
+@GetMapping("/list")
+    public TableDataInfo list(Hyperlink hyperlink)
+    {
+        startPage();
+        List<Hyperlink> list = hyperlinkService.selectHyperlinkList(hyperlink);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出超链接列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:hyperlink:export')")
+    @Log(title = "超链接", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, Hyperlink hyperlink)
+    {
+        List<Hyperlink> list = hyperlinkService.selectHyperlinkList(hyperlink);
+        ExcelUtil<Hyperlink> util = new ExcelUtil<Hyperlink>(Hyperlink.class);
+        util.exportExcel(response, list, "超链接数据");
+    }
+
+    /**
+     * 获取超链接详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:hyperlink:query')")
+    @GetMapping(value = "/{hyperlinkId}")
+    public AjaxResult getInfo(@PathVariable("hyperlinkId") Long hyperlinkId)
+    {
+        return success(hyperlinkService.selectHyperlinkByHyperlinkId(hyperlinkId));
+    }
+
+    /**
+     * 新增超链接
+     */
+    @PreAuthorize("@ss.hasPermi('system:hyperlink:add')")
+    @Log(title = "超链接", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody Hyperlink hyperlink)
+    {
+        return toAjax(hyperlinkService.insertHyperlink(hyperlink));
+    }
+
+    /**
+     * 修改超链接
+     */
+    @PreAuthorize("@ss.hasPermi('system:hyperlink:edit')")
+    @Log(title = "超链接", businessType = BusinessType.UPDATE)
+    @PostMapping("/put")
+    public AjaxResult edit(@RequestBody Hyperlink hyperlink)
+    {
+        return toAjax(hyperlinkService.updateHyperlink(hyperlink));
+    }
+
+    /**
+     * 删除超链接
+     */
+    @PreAuthorize("@ss.hasPermi('system:hyperlink:remove')")
+    @Log(title = "超链接", businessType = BusinessType.DELETE)
+    @GetMapping("/delete/{hyperlinkIds}")
+    public AjaxResult remove(@PathVariable Long[] hyperlinkIds)
+    {
+        return toAjax(hyperlinkService.deleteHyperlinkByHyperlinkIds(hyperlinkIds));
+    }
+}

+ 84 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/Hyperlink.java

@@ -0,0 +1,84 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 超链接对象 hyperlink
+ * 
+ * @author boman
+ * @date 2024-04-30
+ */
+public class Hyperlink extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 超链接ID */
+    private Long hyperlinkId;
+
+    /** 名称 */
+    @Excel(name = "名称")
+    private String name;
+
+    /** 地址 */
+    @Excel(name = "地址")
+    private String url;
+
+    /** 类型 1:外部工具平台,2:出具合同 */
+    @Excel(name = "类型 1:外部工具平台,2:出具合同")
+    private String type;
+
+    public void setHyperlinkId(Long hyperlinkId) 
+    {
+        this.hyperlinkId = hyperlinkId;
+    }
+
+    public Long getHyperlinkId() 
+    {
+        return hyperlinkId;
+    }
+    public void setName(String name) 
+    {
+        this.name = name;
+    }
+
+    public String getName() 
+    {
+        return name;
+    }
+    public void setUrl(String url) 
+    {
+        this.url = url;
+    }
+
+    public String getUrl() 
+    {
+        return url;
+    }
+    public void setType(String type) 
+    {
+        this.type = type;
+    }
+
+    public String getType() 
+    {
+        return type;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("hyperlinkId", getHyperlinkId())
+            .append("name", getName())
+            .append("url", getUrl())
+            .append("type", getType())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/HyperlinkMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.Hyperlink;
+
+/**
+ * 超链接Mapper接口
+ * 
+ * @author boman
+ * @date 2024-04-30
+ */
+public interface HyperlinkMapper 
+{
+    /**
+     * 查询超链接
+     * 
+     * @param hyperlinkId 超链接主键
+     * @return 超链接
+     */
+    public Hyperlink selectHyperlinkByHyperlinkId(Long hyperlinkId);
+
+    /**
+     * 查询超链接列表
+     * 
+     * @param hyperlink 超链接
+     * @return 超链接集合
+     */
+    public List<Hyperlink> selectHyperlinkList(Hyperlink hyperlink);
+
+    /**
+     * 新增超链接
+     * 
+     * @param hyperlink 超链接
+     * @return 结果
+     */
+    public int insertHyperlink(Hyperlink hyperlink);
+
+    /**
+     * 修改超链接
+     * 
+     * @param hyperlink 超链接
+     * @return 结果
+     */
+    public int updateHyperlink(Hyperlink hyperlink);
+
+    /**
+     * 删除超链接
+     * 
+     * @param hyperlinkId 超链接主键
+     * @return 结果
+     */
+    public int deleteHyperlinkByHyperlinkId(Long hyperlinkId);
+
+    /**
+     * 批量删除超链接
+     * 
+     * @param hyperlinkIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteHyperlinkByHyperlinkIds(Long[] hyperlinkIds);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IHyperlinkService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.Hyperlink;
+
+/**
+ * 超链接Service接口
+ * 
+ * @author boman
+ * @date 2024-04-30
+ */
+public interface IHyperlinkService 
+{
+    /**
+     * 查询超链接
+     * 
+     * @param hyperlinkId 超链接主键
+     * @return 超链接
+     */
+    public Hyperlink selectHyperlinkByHyperlinkId(Long hyperlinkId);
+
+    /**
+     * 查询超链接列表
+     * 
+     * @param hyperlink 超链接
+     * @return 超链接集合
+     */
+    public List<Hyperlink> selectHyperlinkList(Hyperlink hyperlink);
+
+    /**
+     * 新增超链接
+     * 
+     * @param hyperlink 超链接
+     * @return 结果
+     */
+    public int insertHyperlink(Hyperlink hyperlink);
+
+    /**
+     * 修改超链接
+     * 
+     * @param hyperlink 超链接
+     * @return 结果
+     */
+    public int updateHyperlink(Hyperlink hyperlink);
+
+    /**
+     * 批量删除超链接
+     * 
+     * @param hyperlinkIds 需要删除的超链接主键集合
+     * @return 结果
+     */
+    public int deleteHyperlinkByHyperlinkIds(Long[] hyperlinkIds);
+
+    /**
+     * 删除超链接信息
+     * 
+     * @param hyperlinkId 超链接主键
+     * @return 结果
+     */
+    public int deleteHyperlinkByHyperlinkId(Long hyperlinkId);
+}

+ 96 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/HyperlinkServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.HyperlinkMapper;
+import com.ruoyi.system.domain.Hyperlink;
+import com.ruoyi.system.service.IHyperlinkService;
+
+/**
+ * 超链接Service业务层处理
+ * 
+ * @author boman
+ * @date 2024-04-30
+ */
+@Service
+public class HyperlinkServiceImpl implements IHyperlinkService 
+{
+    @Autowired
+    private HyperlinkMapper hyperlinkMapper;
+
+    /**
+     * 查询超链接
+     * 
+     * @param hyperlinkId 超链接主键
+     * @return 超链接
+     */
+    @Override
+    public Hyperlink selectHyperlinkByHyperlinkId(Long hyperlinkId)
+    {
+        return hyperlinkMapper.selectHyperlinkByHyperlinkId(hyperlinkId);
+    }
+
+    /**
+     * 查询超链接列表
+     * 
+     * @param hyperlink 超链接
+     * @return 超链接
+     */
+    @Override
+    public List<Hyperlink> selectHyperlinkList(Hyperlink hyperlink)
+    {
+        return hyperlinkMapper.selectHyperlinkList(hyperlink);
+    }
+
+    /**
+     * 新增超链接
+     * 
+     * @param hyperlink 超链接
+     * @return 结果
+     */
+    @Override
+    public int insertHyperlink(Hyperlink hyperlink)
+    {
+        hyperlink.setCreateTime(DateUtils.getNowDate());
+        return hyperlinkMapper.insertHyperlink(hyperlink);
+    }
+
+    /**
+     * 修改超链接
+     * 
+     * @param hyperlink 超链接
+     * @return 结果
+     */
+    @Override
+    public int updateHyperlink(Hyperlink hyperlink)
+    {
+        hyperlink.setUpdateTime(DateUtils.getNowDate());
+        return hyperlinkMapper.updateHyperlink(hyperlink);
+    }
+
+    /**
+     * 批量删除超链接
+     * 
+     * @param hyperlinkIds 需要删除的超链接主键
+     * @return 结果
+     */
+    @Override
+    public int deleteHyperlinkByHyperlinkIds(Long[] hyperlinkIds)
+    {
+        return hyperlinkMapper.deleteHyperlinkByHyperlinkIds(hyperlinkIds);
+    }
+
+    /**
+     * 删除超链接信息
+     * 
+     * @param hyperlinkId 超链接主键
+     * @return 结果
+     */
+    @Override
+    public int deleteHyperlinkByHyperlinkId(Long hyperlinkId)
+    {
+        return hyperlinkMapper.deleteHyperlinkByHyperlinkId(hyperlinkId);
+    }
+}

+ 87 - 0
ruoyi-system/src/main/resources/mapper/system/HyperlinkMapper.xml

@@ -0,0 +1,87 @@
+<?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.system.mapper.HyperlinkMapper">
+    
+    <resultMap type="Hyperlink" id="HyperlinkResult">
+        <result property="hyperlinkId"    column="hyperlink_id"    />
+        <result property="name"    column="name"    />
+        <result property="url"    column="url"    />
+        <result property="type"    column="type"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectHyperlinkVo">
+        select hyperlink_id, name, url, type, create_by, create_time, update_by, update_time, remark from hyperlink
+    </sql>
+
+    <select id="selectHyperlinkList" parameterType="Hyperlink" resultMap="HyperlinkResult">
+        <include refid="selectHyperlinkVo"/>
+        <where>  
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="url != null  and url != ''"> and url = #{url}</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+        </where>
+        order by create_time
+    </select>
+    
+    <select id="selectHyperlinkByHyperlinkId" parameterType="Long" resultMap="HyperlinkResult">
+        <include refid="selectHyperlinkVo"/>
+        where hyperlink_id = #{hyperlinkId}
+    </select>
+        
+    <insert id="insertHyperlink" parameterType="Hyperlink" useGeneratedKeys="true" keyProperty="hyperlinkId">
+        insert into hyperlink
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null and name != ''">name,</if>
+            <if test="url != null">url,</if>
+            <if test="type != null">type,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="name != null and name != ''">#{name},</if>
+            <if test="url != null">#{url},</if>
+            <if test="type != null">#{type},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateHyperlink" parameterType="Hyperlink">
+        update hyperlink
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="name != null and name != ''">name = #{name},</if>
+            <if test="url != null">url = #{url},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where hyperlink_id = #{hyperlinkId}
+    </update>
+
+    <delete id="deleteHyperlinkByHyperlinkId" parameterType="Long">
+        delete from hyperlink where hyperlink_id = #{hyperlinkId}
+    </delete>
+
+    <delete id="deleteHyperlinkByHyperlinkIds" parameterType="String">
+        delete from hyperlink where hyperlink_id in 
+        <foreach item="hyperlinkId" collection="array" open="(" separator="," close=")">
+            #{hyperlinkId}
+        </foreach>
+    </delete>
+</mapper>