Bläddra i källkod

首页轮播图

LiRong 3 veckor sedan
förälder
incheckning
2c54cd5091

+ 115 - 0
leromro-core/src/main/java/com/leromro/core/controller/LSlideshowController.java

@@ -0,0 +1,115 @@
+package com.leromro.core.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.leromro.common.core.domain.R;
+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.leromro.common.annotation.Log;
+import com.leromro.common.core.controller.BaseController;
+import com.leromro.common.core.domain.AjaxResult;
+import com.leromro.common.enums.BusinessType;
+import com.leromro.core.domain.Slideshow;
+import com.leromro.core.service.ILSlideshowService;
+import com.leromro.common.utils.poi.ExcelUtil;
+import com.leromro.common.core.page.TableDataInfo;
+
+/**
+ * 主页轮播图或后续其他广告图片Controller
+ * 
+ * @author ruoyi
+ * @date 2025-04-24
+ */
+@RestController
+@Api(tags = "主页轮播图或后续其他广告图片")
+@RequestMapping("/web/core/slideshow")
+public class LSlideshowController extends BaseController
+{
+    @Autowired
+    private ILSlideshowService lSlideshowService;
+
+    /**
+     * 查询主页轮播图或后续其他广告图片列表
+     */
+    @ApiOperation("web查询图片列表")
+  //  @PreAuthorize("@ss.hasPermi('core:slideshow:list')")
+    @GetMapping("/list")
+    public TableDataInfo<Slideshow> list(Slideshow slideshow)
+    {
+        startPage();
+        List<Slideshow> list = lSlideshowService.selectLSlideshowList(slideshow);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出主页轮播图或后续其他广告图片列表
+     */
+    @ApiOperation("导出主页轮播图或后续其他广告图片列表")
+  //  @PreAuthorize("@ss.hasPermi('core:slideshow:export')")
+    @Log(title = "主页轮播图或后续其他广告图片", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, Slideshow slideshow)
+    {
+        List<Slideshow> list = lSlideshowService.selectLSlideshowList(slideshow);
+        ExcelUtil<Slideshow> util = new ExcelUtil<Slideshow>(Slideshow.class);
+        util.exportExcel(response, list, "主页轮播图或后续其他广告图片数据");
+    }
+
+    /**
+     * 获取主页轮播图或后续其他广告图片详细信息
+     */
+    @ApiOperation("小程序端根据轮播图id查询")
+ //   @PreAuthorize("@ss.hasPermi('core:slideshow:query')")
+    @GetMapping(value = "/{slideshowId}")
+    public R<Slideshow> getInfo(@PathVariable("slideshowId") Long slideshowId)
+    {
+        return R.ok(lSlideshowService.selectLSlideshowBySlideshowId(slideshowId));
+    }
+
+    /**
+     * 新增主页轮播图或后续其他广告图片
+     */
+    @ApiOperation("web新增主页轮播图图片,传入图片 前端分割")
+    /*@PreAuthorize("@ss.hasPermi('core:slideshow:add')")*/
+    @Log(title = "主页轮播图或后续其他广告图片", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody Slideshow slideshow)
+    {
+        return toAjax(lSlideshowService.save(slideshow));
+    }
+
+    /**
+     * 修改主页轮播图或后续其他广告图片
+     */
+    @ApiOperation("web修改主页轮播图或后续其他广告图片")
+  //  @PreAuthorize("@ss.hasPermi('core:slideshow:edit')")
+    @Log(title = "主页轮播图或后续其他广告图片", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody Slideshow slideshow)
+    {
+        return toAjax(lSlideshowService.updateLSlideshow(slideshow));
+    }
+
+    /**
+     * 删除主页轮播图或后续其他广告图片
+     */
+    @ApiOperation("删除主页轮播图或后续其他广告图片")
+ //   @PreAuthorize("@ss.hasPermi('core:slideshow:remove')")
+    @Log(title = "主页轮播图或后续其他广告图片", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{slideshowIds}")
+    public R<Integer> remove(@PathVariable Long[] slideshowIds)
+    {
+        return R.ok(lSlideshowService.deleteLSlideshowBySlideshowIds(slideshowIds));
+    }
+}

+ 62 - 0
leromro-core/src/main/java/com/leromro/core/mapper/LSlideshowMapper.java

@@ -0,0 +1,62 @@
+package com.leromro.core.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.leromro.core.domain.Slideshow;
+
+/**
+ * 主页轮播图或后续其他广告图片Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2025-04-24
+ */
+public interface LSlideshowMapper extends BaseMapper<Slideshow>
+{
+    /**
+     * 查询主页轮播图或后续其他广告图片
+     * 
+     * @param slideshowId 主页轮播图或后续其他广告图片主键
+     * @return 主页轮播图或后续其他广告图片
+     */
+    public Slideshow selectLSlideshowBySlideshowId(Long slideshowId);
+
+    /**
+     * 查询主页轮播图或后续其他广告图片列表
+     * 
+     * @param slideshow 主页轮播图或后续其他广告图片
+     * @return 主页轮播图或后续其他广告图片集合
+     */
+    public List<Slideshow> selectLSlideshowList(Slideshow slideshow);
+
+    /**
+     * 新增主页轮播图或后续其他广告图片
+     * 
+     * @param slideshow 主页轮播图或后续其他广告图片
+     * @return 结果
+     */
+    public int insertLSlideshow(Slideshow slideshow);
+
+    /**
+     * 修改主页轮播图或后续其他广告图片
+     * 
+     * @param slideshow 主页轮播图或后续其他广告图片
+     * @return 结果
+     */
+    public int updateLSlideshow(Slideshow slideshow);
+
+    /**
+     * 删除主页轮播图或后续其他广告图片
+     * 
+     * @param slideshowId 主页轮播图或后续其他广告图片主键
+     * @return 结果
+     */
+    public int deleteLSlideshowBySlideshowId(Long slideshowId);
+
+    /**
+     * 批量删除主页轮播图或后续其他广告图片
+     * 
+     * @param slideshowIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteLSlideshowBySlideshowIds(Long[] slideshowIds);
+}

+ 62 - 0
leromro-core/src/main/java/com/leromro/core/service/ILSlideshowService.java

@@ -0,0 +1,62 @@
+package com.leromro.core.service;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.leromro.core.domain.Slideshow;
+
+/**
+ * 主页轮播图或后续其他广告图片Service接口
+ * 
+ * @author ruoyi
+ * @date 2025-04-24
+ */
+public interface ILSlideshowService extends IService<Slideshow>
+{
+    /**
+     * 查询主页轮播图或后续其他广告图片
+     * 
+     * @param slideshowId 主页轮播图或后续其他广告图片主键
+     * @return 主页轮播图或后续其他广告图片
+     */
+    public Slideshow selectLSlideshowBySlideshowId(Long slideshowId);
+
+    /**
+     * 查询主页轮播图或后续其他广告图片列表
+     * 
+     * @param slideshow 主页轮播图或后续其他广告图片
+     * @return 主页轮播图或后续其他广告图片集合
+     */
+    public List<Slideshow> selectLSlideshowList(Slideshow slideshow);
+
+    /**
+     * 新增主页轮播图或后续其他广告图片
+     * 
+     * @param slideshow 主页轮播图或后续其他广告图片
+     * @return 结果
+     */
+    public Boolean insertLSlideshow(Slideshow slideshow);
+
+    /**
+     * 修改主页轮播图或后续其他广告图片
+     * 
+     * @param slideshow 主页轮播图或后续其他广告图片
+     * @return 结果
+     */
+    public Boolean updateLSlideshow(Slideshow slideshow);
+
+    /**
+     * 批量删除主页轮播图或后续其他广告图片
+     * 
+     * @param slideshowIds 需要删除的主页轮播图或后续其他广告图片主键集合
+     * @return 结果
+     */
+    public int deleteLSlideshowBySlideshowIds(Long[] slideshowIds);
+
+    /**
+     * 删除主页轮播图或后续其他广告图片信息
+     * 
+     * @param slideshowId 主页轮播图或后续其他广告图片主键
+     * @return 结果
+     */
+    public int deleteLSlideshowBySlideshowId(Long slideshowId);
+}

+ 94 - 0
leromro-core/src/main/java/com/leromro/core/service/impl/LSlideshowServiceImpl.java

@@ -0,0 +1,94 @@
+package com.leromro.core.service.impl;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.leromro.core.mapper.LSlideshowMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.leromro.core.domain.Slideshow;
+import com.leromro.core.service.ILSlideshowService;
+
+/**
+ * 主页轮播图或后续其他广告图片Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2025-04-24
+ */
+@Service
+public class LSlideshowServiceImpl extends ServiceImpl<LSlideshowMapper, Slideshow> implements ILSlideshowService
+{
+    @Autowired
+    private LSlideshowMapper lSlideshowMapper;
+
+    /**
+     * 查询主页轮播图或后续其他广告图片
+     * 
+     * @param slideshowId 主页轮播图或后续其他广告图片主键
+     * @return 主页轮播图或后续其他广告图片
+     */
+    @Override
+    public Slideshow selectLSlideshowBySlideshowId(Long slideshowId)
+    {
+        return lSlideshowMapper.selectLSlideshowBySlideshowId(slideshowId);
+    }
+
+    /**
+     * 查询主页轮播图或后续其他广告图片列表
+     * 
+     * @param slideshow 主页轮播图或后续其他广告图片
+     * @return 主页轮播图或后续其他广告图片
+     */
+    @Override
+    public List<Slideshow> selectLSlideshowList(Slideshow slideshow)
+    {
+        return lSlideshowMapper.selectLSlideshowList(slideshow);
+    }
+
+    /**
+     * 新增主页轮播图或后续其他广告图片
+     * 
+     * @param slideshow 主页轮播图或后续其他广告图片
+     * @return 结果
+     */
+    @Override
+    public Boolean insertLSlideshow(Slideshow slideshow)
+    {
+        return this.save(slideshow);
+    }
+
+    /**
+     * 修改主页轮播图或后续其他广告图片
+     * 
+     * @param slideshow 主页轮播图或后续其他广告图片
+     * @return 结果
+     */
+    @Override
+    public Boolean updateLSlideshow(Slideshow slideshow)
+    {
+        return this.updateById(slideshow);
+    }
+
+    /**
+     * 批量删除主页轮播图或后续其他广告图片
+     * 
+     * @param slideshowIds 需要删除的主页轮播图或后续其他广告图片主键
+     * @return 结果
+     */
+    @Override
+    public int deleteLSlideshowBySlideshowIds(Long[] slideshowIds)
+    {
+        return lSlideshowMapper.deleteLSlideshowBySlideshowIds(slideshowIds);
+    }
+
+    /**
+     * 删除主页轮播图或后续其他广告图片信息
+     * 
+     * @param slideshowId 主页轮播图或后续其他广告图片主键
+     * @return 结果
+     */
+    @Override
+    public int deleteLSlideshowBySlideshowId(Long slideshowId)
+    {
+        return lSlideshowMapper.deleteLSlideshowBySlideshowId(slideshowId);
+    }
+}

+ 76 - 0
leromro-core/src/main/resources/mapper/core/LSlideshowMapper.xml

@@ -0,0 +1,76 @@
+<?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.leromro.core.mapper.LSlideshowMapper">
+    
+    <resultMap type="Slideshow" id="LSlideshowResult">
+        <result property="slideshowId"    column="slideshow_id"    />
+        <result property="picture"    column="picture"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectLSlideshowVo">
+        select slideshow_id, picture, create_time, create_by, update_time, update_by, remark from l_slideshow
+    </sql>
+
+    <select id="selectLSlideshowList" parameterType="Slideshow" resultMap="LSlideshowResult">
+        <include refid="selectLSlideshowVo"/>
+        <where>  
+            <if test="picture != null  and picture != ''"> and picture = #{picture}</if>
+        </where>
+    </select>
+    
+    <select id="selectLSlideshowBySlideshowId" parameterType="Long" resultMap="LSlideshowResult">
+        <include refid="selectLSlideshowVo"/>
+        where slideshow_id = #{slideshowId}
+    </select>
+
+    <insert id="insertLSlideshow" parameterType="Slideshow" useGeneratedKeys="true" keyProperty="slideshowId">
+        insert into l_slideshow
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="picture != null">picture,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="picture != null">#{picture},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateLSlideshow" parameterType="Slideshow">
+        update l_slideshow
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="picture != null">picture = #{picture},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where slideshow_id = #{slideshowId}
+    </update>
+
+    <delete id="deleteLSlideshowBySlideshowId" parameterType="Long">
+        delete from l_slideshow where slideshow_id = #{slideshowId}
+    </delete>
+
+    <delete id="deleteLSlideshowBySlideshowIds" parameterType="String">
+        delete from l_slideshow where slideshow_id in 
+        <foreach item="slideshowId" collection="array" open="(" separator="," close=")">
+            #{slideshowId}
+        </foreach>
+    </delete>
+</mapper>