Administrator 1 tahun lalu
induk
melakukan
7314b01d2b

+ 103 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/annex/BomanAnnexController.java

@@ -0,0 +1,103 @@
+package com.ruoyi.web.controller.annex;
+
+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.BomanAnnex;
+import com.ruoyi.system.service.IBomanAnnexService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 附件Controller
+ * 
+ * @author boman
+ * @date 2023-11-13
+ */
+@RestController
+@RequestMapping("/system/annex")
+public class BomanAnnexController extends BaseController
+{
+    @Autowired
+    private IBomanAnnexService bomanAnnexService;
+
+    /**
+     * 查询附件列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(BomanAnnex bomanAnnex)
+    {
+        startPage();
+        List<BomanAnnex> list = bomanAnnexService.selectBomanAnnexList(bomanAnnex);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出附件列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:annex:export')")
+    @Log(title = "附件", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BomanAnnex bomanAnnex)
+    {
+        List<BomanAnnex> list = bomanAnnexService.selectBomanAnnexList(bomanAnnex);
+        ExcelUtil<BomanAnnex> util = new ExcelUtil<BomanAnnex>(BomanAnnex.class);
+        util.exportExcel(response, list, "附件数据");
+    }
+
+    /**
+     * 获取附件详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:annex:query')")
+    @GetMapping(value = "/{annexId}")
+    public AjaxResult getInfo(@PathVariable("annexId") Long annexId)
+    {
+        return success(bomanAnnexService.selectBomanAnnexByAnnexId(annexId));
+    }
+
+    /**
+     * 新增附件
+     */
+    @PreAuthorize("@ss.hasPermi('system:annex:add')")
+    @Log(title = "附件", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody BomanAnnex bomanAnnex)
+    {
+        return toAjax(bomanAnnexService.insertBomanAnnex(bomanAnnex));
+    }
+
+    /**
+     * 修改附件
+     */
+    @PreAuthorize("@ss.hasPermi('system:annex:edit')")
+    @Log(title = "附件", businessType = BusinessType.UPDATE)
+    @PostMapping("/put")
+    public AjaxResult edit(@RequestBody BomanAnnex bomanAnnex)
+    {
+        return toAjax(bomanAnnexService.updateBomanAnnex(bomanAnnex));
+    }
+
+    /**
+     * 删除附件
+     */
+    @PreAuthorize("@ss.hasPermi('system:annex:remove')")
+    @Log(title = "附件", businessType = BusinessType.DELETE)
+	@GetMapping("/delete/{annexIds}")
+    public AjaxResult remove(@PathVariable Long[] annexIds)
+    {
+        return toAjax(bomanAnnexService.deleteBomanAnnexByAnnexIds(annexIds));
+    }
+}

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -90,6 +90,6 @@ xss:
   # 过滤开关
   enabled: true
   # 排除链接(多个用逗号分隔)
-  excludes: /system/notice,/system/news,/system/news/put
+  excludes: /system/notice,/system/news,/system/news/put,/system/annex/*
   # 匹配链接
   urlPatterns: /system/*,/monitor/*,/tool/*

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -112,7 +112,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .authorizeRequests()
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
                 .antMatchers("/login", "/register", "/captchaImage","/boman/common/**","/sendSms/**").permitAll()
-                .antMatchers("/system/personnel/**", "/reservat/config/**", "/reservat/time/**","/system/reservat/**","/system/news/**").permitAll()
+                .antMatchers("/system/personnel/**", "/reservat/config/**", "/reservat/time/**","/system/reservat/**","/system/news/**","/system/annex/list").permitAll()
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

+ 137 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/BomanAnnex.java

@@ -0,0 +1,137 @@
+package com.ruoyi.system.domain;
+
+import java.util.Date;
+import java.util.List;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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;
+
+/**
+ * 附件对象 boman_annex
+ * 
+ * @author boman
+ * @date 2023-11-13
+ */
+public class BomanAnnex extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 素材id */
+    private Long annexId;
+
+    /** 附件地址 */
+    @Excel(name = "附件地址")
+    private String annexUrl;
+
+    /** 附件名称 */
+    @Excel(name = "附件名称")
+    private String annexName;
+
+    /** 附件类型1:vr */
+    @Excel(name = "附件类型1:vr")
+    private String type;
+
+    /** 关键字 */
+    @Excel(name = "关键字")
+    private String keywords;
+
+    /** 发布时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date releaseTime;
+
+    private List<BomanAnnex> bomanAnnexList;
+    /**
+     * 标注
+     */
+    private String dimension;
+
+    public String getDimension() {
+        return dimension;
+    }
+
+    public void setDimension(String dimension) {
+        this.dimension = dimension;
+    }
+
+    public List<BomanAnnex> getBomanAnnexList() {
+        return bomanAnnexList;
+    }
+
+    public void setBomanAnnexList(List<BomanAnnex> bomanAnnexList) {
+        this.bomanAnnexList = bomanAnnexList;
+    }
+
+    public void setAnnexId(Long annexId)
+    {
+        this.annexId = annexId;
+    }
+
+    public Long getAnnexId() 
+    {
+        return annexId;
+    }
+    public void setAnnexUrl(String annexUrl) 
+    {
+        this.annexUrl = annexUrl;
+    }
+
+    public String getAnnexUrl() 
+    {
+        return annexUrl;
+    }
+    public void setAnnexName(String annexName) 
+    {
+        this.annexName = annexName;
+    }
+
+    public String getAnnexName() 
+    {
+        return annexName;
+    }
+    public void setType(String type) 
+    {
+        this.type = type;
+    }
+
+    public String getType() 
+    {
+        return type;
+    }
+    public void setKeywords(String keywords) 
+    {
+        this.keywords = keywords;
+    }
+
+    public String getKeywords() 
+    {
+        return keywords;
+    }
+    public void setReleaseTime(Date releaseTime) 
+    {
+        this.releaseTime = releaseTime;
+    }
+
+    public Date getReleaseTime() 
+    {
+        return releaseTime;
+    }
+
+    @Override
+    public String toString() {
+        return "BomanAnnex{" +
+                "annexId=" + annexId +
+                ", annexUrl='" + annexUrl + '\'' +
+                ", annexName='" + annexName + '\'' +
+                ", type='" + type + '\'' +
+                ", keywords='" + keywords + '\'' +
+                ", releaseTime=" + releaseTime +
+                ", bomanAnnexList=" + bomanAnnexList +
+                ", dimension=" + dimension +
+                '}';
+    }
+}

+ 62 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/BomanAnnexMapper.java

@@ -0,0 +1,62 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.BomanAnnex;
+
+/**
+ * 附件Mapper接口
+ * 
+ * @author boman
+ * @date 2023-11-13
+ */
+public interface BomanAnnexMapper 
+{
+    /**
+     * 查询附件
+     * 
+     * @param annexId 附件主键
+     * @return 附件
+     */
+    public BomanAnnex selectBomanAnnexByAnnexId(Long annexId);
+
+    /**
+     * 查询附件列表
+     * 
+     * @param bomanAnnex 附件
+     * @return 附件集合
+     */
+    public List<BomanAnnex> selectBomanAnnexList(BomanAnnex bomanAnnex);
+
+    /**
+     * 新增附件
+     * 
+     * @param bomanAnnex 附件
+     * @return 结果
+     */
+    public int insertBomanAnnex(BomanAnnex bomanAnnex);
+    public int batchBomanAnnex(List<BomanAnnex> bomanAnnex);
+
+    /**
+     * 修改附件
+     * 
+     * @param bomanAnnex 附件
+     * @return 结果
+     */
+    public int updateBomanAnnex(BomanAnnex bomanAnnex);
+
+    /**
+     * 删除附件
+     * 
+     * @param annexId 附件主键
+     * @return 结果
+     */
+    public int deleteBomanAnnexByAnnexId(Long annexId);
+
+    /**
+     * 批量删除附件
+     * 
+     * @param annexIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteBomanAnnexByAnnexIds(Long[] annexIds);
+}

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

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.BomanAnnex;
+
+/**
+ * 附件Service接口
+ * 
+ * @author boman
+ * @date 2023-11-13
+ */
+public interface IBomanAnnexService 
+{
+    /**
+     * 查询附件
+     * 
+     * @param annexId 附件主键
+     * @return 附件
+     */
+    public BomanAnnex selectBomanAnnexByAnnexId(Long annexId);
+
+    /**
+     * 查询附件列表
+     * 
+     * @param bomanAnnex 附件
+     * @return 附件集合
+     */
+    public List<BomanAnnex> selectBomanAnnexList(BomanAnnex bomanAnnex);
+
+    /**
+     * 新增附件
+     * 
+     * @param bomanAnnex 附件
+     * @return 结果
+     */
+    public int insertBomanAnnex(BomanAnnex bomanAnnex);
+
+    /**
+     * 修改附件
+     * 
+     * @param bomanAnnex 附件
+     * @return 结果
+     */
+    public int updateBomanAnnex(BomanAnnex bomanAnnex);
+
+    /**
+     * 批量删除附件
+     * 
+     * @param annexIds 需要删除的附件主键集合
+     * @return 结果
+     */
+    public int deleteBomanAnnexByAnnexIds(Long[] annexIds);
+
+    /**
+     * 删除附件信息
+     * 
+     * @param annexId 附件主键
+     * @return 结果
+     */
+    public int deleteBomanAnnexByAnnexId(Long annexId);
+}

+ 100 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanAnnexServiceImpl.java

@@ -0,0 +1,100 @@
+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.BomanAnnexMapper;
+import com.ruoyi.system.domain.BomanAnnex;
+import com.ruoyi.system.service.IBomanAnnexService;
+
+/**
+ * 附件Service业务层处理
+ * 
+ * @author boman
+ * @date 2023-11-13
+ */
+@Service
+public class BomanAnnexServiceImpl implements IBomanAnnexService 
+{
+    @Autowired
+    private BomanAnnexMapper bomanAnnexMapper;
+
+    /**
+     * 查询附件
+     * 
+     * @param annexId 附件主键
+     * @return 附件
+     */
+    @Override
+    public BomanAnnex selectBomanAnnexByAnnexId(Long annexId)
+    {
+        return bomanAnnexMapper.selectBomanAnnexByAnnexId(annexId);
+    }
+
+    /**
+     * 查询附件列表
+     * 
+     * @param bomanAnnex 附件
+     * @return 附件
+     */
+    @Override
+    public List<BomanAnnex> selectBomanAnnexList(BomanAnnex bomanAnnex)
+    {
+        return bomanAnnexMapper.selectBomanAnnexList(bomanAnnex);
+    }
+
+    /**
+     * 新增附件
+     * 
+     * @param bomanAnnex 附件
+     * @return 结果
+     */
+    @Override
+    public int insertBomanAnnex(BomanAnnex bomanAnnex)
+    {
+        List<BomanAnnex> bomanAnnexList = bomanAnnex.getBomanAnnexList();
+        int i = 0;
+        if (bomanAnnexList != null && bomanAnnexList.size() > 0){
+             i = bomanAnnexMapper.batchBomanAnnex(bomanAnnexList);
+        }
+        return i;
+    }
+
+    /**
+     * 修改附件
+     * 
+     * @param bomanAnnex 附件
+     * @return 结果
+     */
+    @Override
+    public int updateBomanAnnex(BomanAnnex bomanAnnex)
+    {
+        bomanAnnex.setUpdateTime(DateUtils.getNowDate());
+        return bomanAnnexMapper.updateBomanAnnex(bomanAnnex);
+    }
+
+    /**
+     * 批量删除附件
+     * 
+     * @param annexIds 需要删除的附件主键
+     * @return 结果
+     */
+    @Override
+    public int deleteBomanAnnexByAnnexIds(Long[] annexIds)
+    {
+        return bomanAnnexMapper.deleteBomanAnnexByAnnexIds(annexIds);
+    }
+
+    /**
+     * 删除附件信息
+     * 
+     * @param annexId 附件主键
+     * @return 结果
+     */
+    @Override
+    public int deleteBomanAnnexByAnnexId(Long annexId)
+    {
+        return bomanAnnexMapper.deleteBomanAnnexByAnnexId(annexId);
+    }
+}

+ 102 - 0
ruoyi-system/src/main/resources/mapper/system/BomanAnnexMapper.xml

@@ -0,0 +1,102 @@
+<?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.BomanAnnexMapper">
+    
+    <resultMap type="BomanAnnex" id="BomanAnnexResult">
+        <result property="annexId"    column="annex_id"    />
+        <result property="annexUrl"    column="annex_url"    />
+        <result property="annexName"    column="annex_name"    />
+        <result property="type"    column="type"    />
+        <result property="keywords"    column="keywords"    />
+        <result property="dimension"    column="dimension"    />
+        <result property="releaseTime"    column="release_time"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectBomanAnnexVo">
+        select annex_id, annex_url, annex_name, type,dimension, keywords, release_time, create_time, create_by, update_by, update_time from boman_annex
+    </sql>
+
+    <select id="selectBomanAnnexList" parameterType="BomanAnnex" resultMap="BomanAnnexResult">
+        <include refid="selectBomanAnnexVo"/>
+        <where>  
+            <if test="annexUrl != null  and annexUrl != ''"> and annex_url = #{annexUrl}</if>
+            <if test="annexName != null  and annexName != ''"> and annex_name like concat('%', #{annexName}, '%')</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+            <if test="keywords != null  and keywords != ''"> and keywords = #{keywords}</if>
+            <if test="releaseTime != null "> and release_time = #{releaseTime}</if>
+        </where>
+    </select>
+    
+    <select id="selectBomanAnnexByAnnexId" parameterType="Long" resultMap="BomanAnnexResult">
+        <include refid="selectBomanAnnexVo"/>
+        where annex_id = #{annexId}
+    </select>
+        
+    <insert id="insertBomanAnnex" parameterType="BomanAnnex" useGeneratedKeys="true" keyProperty="annexId">
+        insert into boman_annex
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="annexUrl != null and annexUrl != ''">annex_url,</if>
+            <if test="annexName != null and annexName != ''">annex_name,</if>
+            <if test="type != null">type,</if>
+            <if test="dimension != null ">dimension,</if>
+            <if test="keywords != null and keywords != ''">keywords,</if>
+            <if test="releaseTime != null">release_time,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="annexUrl != null and annexUrl != ''">#{annexUrl},</if>
+            <if test="annexName != null ">#{annexName},</if>
+            <if test="type != null">#{type},</if>
+            <if test="dimension != null and dimension != ''">#{dimension},</if>
+            <if test="keywords != null and keywords != ''">#{keywords},</if>
+            <if test="releaseTime != null">#{releaseTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <insert id="batchBomanAnnex">
+        insert into boman_annex(annex_url, annex_name,keywords,dimension,type,create_time) values
+        <foreach item="item" index="index" collection="list" separator=",">
+            (#{item.annexUrl},#{item.annexName},#{item.keywords},#{item.dimension},#{item.type},sysdate())
+        </foreach>
+    </insert>
+    <update id="updateBomanAnnex" parameterType="BomanAnnex">
+        update boman_annex
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="annexUrl != null and annexUrl != ''">annex_url = #{annexUrl},</if>
+            <if test="annexName != null and annexName != ''">annex_name = #{annexName},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="dimension != null ">dimension = #{dimension},</if>
+            <if test="keywords != null and keywords != ''">keywords = #{keywords},</if>
+            <if test="releaseTime != null">release_time = #{releaseTime},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where annex_id = #{annexId}
+    </update>
+
+    <delete id="deleteBomanAnnexByAnnexId" parameterType="Long">
+        delete from boman_annex where annex_id = #{annexId}
+    </delete>
+
+    <delete id="deleteBomanAnnexByAnnexIds" parameterType="String">
+        delete from boman_annex where annex_id in 
+        <foreach item="annexId" collection="array" open="(" separator="," close=")">
+            #{annexId}
+        </foreach>
+    </delete>
+</mapper>