Bladeren bron

Merge remote-tracking branch 'origin/master'

Administrator 2 jaren geleden
bovenliggende
commit
236269462b

+ 107 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/UpdateAppController.java

@@ -0,0 +1,107 @@
+package com.ruoyi.web.controller.system;
+
+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.UpdateApp;
+import com.ruoyi.system.service.IUpdateAppService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 【请填写功能名称】Controller
+ * 
+ * @author ruoyi
+ * @date 2023-02-16
+ */
+@RestController
+@RequestMapping("/system/app")
+public class UpdateAppController extends BaseController
+{
+    @Autowired
+    private IUpdateAppService updateAppService;
+
+    /**
+     * 查询【请填写功能名称】列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(UpdateApp updateApp)
+    {
+        startPage();
+        List<UpdateApp> list = updateAppService.selectUpdateAppList(updateApp);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出【请填写功能名称】列表
+     */
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, UpdateApp updateApp)
+    {
+        List<UpdateApp> list = updateAppService.selectUpdateAppList(updateApp);
+        ExcelUtil<UpdateApp> util = new ExcelUtil<UpdateApp>(UpdateApp.class);
+        util.exportExcel(response, list, "【请填写功能名称】数据");
+    }
+
+    /**
+     * 获取【请填写功能名称】详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(updateAppService.selectUpdateAppById(id));
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     */
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody UpdateApp updateApp)
+    {
+        return toAjax(updateAppService.insertUpdateApp(updateApp));
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     */
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody UpdateApp updateApp)
+    {
+        return toAjax(updateAppService.updateUpdateApp(updateApp));
+    }
+
+    /**
+     * 删除【请填写功能名称】
+     */
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(updateAppService.deleteUpdateAppByIds(ids));
+    }
+
+    /**
+     * 获取当前最新版本数据
+     */
+    @GetMapping(value = "/new")
+    public AjaxResult getInfoNew(UpdateApp updateApp)
+    {
+        return success(updateAppService.getInfoNew(updateApp));
+    }
+}

+ 3 - 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java

@@ -36,7 +36,9 @@ public class MimeTypeUtils
             // 视频格式
             "mp4", "avi", "rmvb",
             // pdf
-            "pdf" };
+            "pdf"  ,
+            //app
+            "wgt","apk"};
 
     public static String getExtension(String prefix)
     {

+ 122 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/UpdateApp.java

@@ -0,0 +1,122 @@
+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;
+
+/**
+ * 【请填写功能名称】对象 update_app
+ * 
+ * @author ruoyi
+ * @date 2023-02-16
+ */
+public class UpdateApp extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /**  */
+    private Long id;
+
+    /** 系统:Android:安卓系统,Apple:苹果系统 */
+    @Excel(name = "系统:Android:安卓系统,Apple:苹果系统")
+    private String model;
+
+    /** 版本名称 */
+    @Excel(name = "版本名称")
+    private String name;
+
+    /** 版本号 */
+    @Excel(name = "版本号")
+    private String code;
+
+    /** 版本描述 */
+    @Excel(name = "版本描述")
+    private String description;
+
+    /** 下载地址 */
+    @Excel(name = "下载地址")
+    private String path;
+
+    /** 是否有效 0:失效 1:有效 */
+    @Excel(name = "是否有效 0:失效 1:有效")
+    private String isDel;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setModel(String model) 
+    {
+        this.model = model;
+    }
+
+    public String getModel() 
+    {
+        return model;
+    }
+    public void setName(String name) 
+    {
+        this.name = name;
+    }
+
+    public String getName() 
+    {
+        return name;
+    }
+    public void setCode(String code) 
+    {
+        this.code = code;
+    }
+
+    public String getCode() 
+    {
+        return code;
+    }
+    public void setDescription(String description) 
+    {
+        this.description = description;
+    }
+
+    public String getDescription() 
+    {
+        return description;
+    }
+    public void setPath(String path) 
+    {
+        this.path = path;
+    }
+
+    public String getPath() 
+    {
+        return path;
+    }
+    public void setIsDel(String isDel) 
+    {
+        this.isDel = isDel;
+    }
+
+    public String getIsDel() 
+    {
+        return isDel;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("model", getModel())
+            .append("name", getName())
+            .append("code", getCode())
+            .append("description", getDescription())
+            .append("path", getPath())
+            .append("isDel", getIsDel())
+            .append("createTime", getCreateTime())
+            .toString();
+    }
+}

+ 65 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UpdateAppMapper.java

@@ -0,0 +1,65 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.UpdateApp;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-02-16
+ */
+public interface UpdateAppMapper 
+{
+    /**
+     * 查询【请填写功能名称】
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public UpdateApp selectUpdateAppById(Long id);
+
+    /**
+     * 查询【请填写功能名称】列表
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<UpdateApp> selectUpdateAppList(UpdateApp updateApp);
+
+    /**
+     * 新增【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertUpdateApp(UpdateApp updateApp);
+
+    /**
+     * 修改【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateUpdateApp(UpdateApp updateApp);
+
+    /**
+     * 删除【请填写功能名称】
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteUpdateAppById(Long id);
+
+    /**
+     * 批量删除【请填写功能名称】
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteUpdateAppByIds(Long[] ids);
+
+    UpdateApp getInfo(UpdateApp updateApp);
+
+    void updateUpdateAppAll(UpdateApp update);
+}

+ 63 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IUpdateAppService.java

@@ -0,0 +1,63 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.UpdateApp;
+
+/**
+ * 【请填写功能名称】Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-02-16
+ */
+public interface IUpdateAppService 
+{
+    /**
+     * 查询【请填写功能名称】
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public UpdateApp selectUpdateAppById(Long id);
+
+    /**
+     * 查询【请填写功能名称】列表
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<UpdateApp> selectUpdateAppList(UpdateApp updateApp);
+
+    /**
+     * 新增【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertUpdateApp(UpdateApp updateApp);
+
+    /**
+     * 修改【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateUpdateApp(UpdateApp updateApp);
+
+    /**
+     * 批量删除【请填写功能名称】
+     * 
+     * @param ids 需要删除的【请填写功能名称】主键集合
+     * @return 结果
+     */
+    public int deleteUpdateAppByIds(Long[] ids);
+
+    /**
+     * 删除【请填写功能名称】信息
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteUpdateAppById(Long id);
+
+    UpdateApp getInfoNew(UpdateApp updateApp);
+}

+ 109 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UpdateAppServiceImpl.java

@@ -0,0 +1,109 @@
+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.UpdateAppMapper;
+import com.ruoyi.system.domain.UpdateApp;
+import com.ruoyi.system.service.IUpdateAppService;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-02-16
+ */
+@Service
+public class UpdateAppServiceImpl implements IUpdateAppService 
+{
+    @Autowired
+    private UpdateAppMapper updateAppMapper;
+
+    /**
+     * 查询【请填写功能名称】
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public UpdateApp selectUpdateAppById(Long id)
+    {
+        return updateAppMapper.selectUpdateAppById(id);
+    }
+
+    /**
+     * 查询【请填写功能名称】列表
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public List<UpdateApp> selectUpdateAppList(UpdateApp updateApp)
+    {
+        return updateAppMapper.selectUpdateAppList(updateApp);
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int insertUpdateApp(UpdateApp updateApp)
+    {
+        //将之前的数据全改为失效
+        UpdateApp update = new UpdateApp();
+        update.setIsDel("0");
+        update.setModel(updateApp.getModel());
+        updateAppMapper.updateUpdateAppAll(update);
+        //保存当前数据
+        updateApp.setCreateTime(DateUtils.getNowDate());
+        return updateAppMapper.insertUpdateApp(updateApp);
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    public int updateUpdateApp(UpdateApp updateApp)
+    {
+        return updateAppMapper.updateUpdateApp(updateApp);
+    }
+
+    /**
+     * 批量删除【请填写功能名称】
+     * 
+     * @param ids 需要删除的【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteUpdateAppByIds(Long[] ids)
+    {
+        return updateAppMapper.deleteUpdateAppByIds(ids);
+    }
+
+    /**
+     * 删除【请填写功能名称】信息
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteUpdateAppById(Long id)
+    {
+        return updateAppMapper.deleteUpdateAppById(id);
+    }
+
+    @Override
+    public UpdateApp getInfoNew(UpdateApp updateApp) {
+        updateApp.setIsDel("1");
+        return updateAppMapper.getInfo(updateApp);
+    }
+}

+ 103 - 0
ruoyi-system/src/main/resources/mapper/system/UpdateAppMapper.xml

@@ -0,0 +1,103 @@
+<?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.UpdateAppMapper">
+    
+    <resultMap type="UpdateApp" id="UpdateAppResult">
+        <result property="id"    column="id"    />
+        <result property="model"    column="model"    />
+        <result property="name"    column="name"    />
+        <result property="code"    column="code"    />
+        <result property="description"    column="description"    />
+        <result property="path"    column="path"    />
+        <result property="isDel"    column="is_del"    />
+        <result property="createTime"    column="create_time"    />
+    </resultMap>
+
+    <sql id="selectUpdateAppVo">
+        select id, model, name, code, description, path, is_del, create_time from update_app
+    </sql>
+
+    <select id="selectUpdateAppList" parameterType="UpdateApp" resultMap="UpdateAppResult">
+        <include refid="selectUpdateAppVo"/>
+        <where>  
+            <if test="model != null  and model != ''"> and model = #{model}</if>
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="code != null  and code != ''"> and code = #{code}</if>
+            <if test="description != null  and description != ''"> and description = #{description}</if>
+            <if test="path != null  and path != ''"> and path = #{path}</if>
+            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
+        </where>
+    </select>
+    
+    <select id="selectUpdateAppById" parameterType="Long" resultMap="UpdateAppResult">
+        <include refid="selectUpdateAppVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertUpdateApp" parameterType="UpdateApp">
+        insert into update_app
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="model != null">model,</if>
+            <if test="name != null">name,</if>
+            <if test="code != null">code,</if>
+            <if test="description != null">description,</if>
+            <if test="path != null">path,</if>
+            <if test="isDel != null">is_del,</if>
+            <if test="createTime != null">create_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="model != null">#{model},</if>
+            <if test="name != null">#{name},</if>
+            <if test="code != null">#{code},</if>
+            <if test="description != null">#{description},</if>
+            <if test="path != null">#{path},</if>
+            <if test="isDel != null">#{isDel},</if>
+            <if test="createTime != null">#{createTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateUpdateApp" parameterType="UpdateApp">
+        update update_app
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="model != null">model = #{model},</if>
+            <if test="name != null">name = #{name},</if>
+            <if test="code != null">code = #{code},</if>
+            <if test="description != null">description = #{description},</if>
+            <if test="path != null">path = #{path},</if>
+            <if test="isDel != null">is_del = #{isDel},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteUpdateAppById" parameterType="Long">
+        delete from update_app where id = #{id}
+    </delete>
+
+    <delete id="deleteUpdateAppByIds" parameterType="String">
+        delete from update_app where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="getInfo" parameterType="UpdateApp" resultMap="UpdateAppResult">
+        <include refid="selectUpdateAppVo"/>
+        <where>
+            <if test="model != null  and model != ''"> and model = #{model}</if>
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="code != null  and code != ''"> and code = #{code}</if>
+            <if test="description != null  and description != ''"> and description = #{description}</if>
+            <if test="path != null  and path != ''"> and path = #{path}</if>
+            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
+        </where>
+    </select>
+    <update id="updateUpdateAppAll" parameterType="UpdateApp">
+        update update_app set is_del = #{isDel}
+        where model = #{model}
+    </update>
+</mapper>