bihs 3 weeks ago
parent
commit
1cacd10194

+ 35 - 0
qmjszx-admin/src/main/java/beilv/web/controller/carousel/AppCarouselController.java

@@ -0,0 +1,35 @@
+package beilv.web.controller.carousel;
+
+import beilv.carousel.domain.BeilvCarousel;
+import beilv.carousel.service.IBeilvCarouselService;
+import beilv.common.core.controller.BaseController;
+import beilv.common.core.domain.AjaxResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+
+/**
+ * 轮播Controller
+ *
+ * @author ruoyi
+ * @date 2025-11-18
+ */
+@Controller
+@RequestMapping("/app-api/carousel")
+public class AppCarouselController extends BaseController {
+
+    @Autowired
+    private IBeilvCarouselService beilvCarouselService;
+
+    /**
+     * 查询轮播列表
+     */
+    @PostMapping("/selectAppCarouselList")
+    @ResponseBody
+    public AjaxResult selectAppCarouselList() {
+        return AjaxResult.success(beilvCarouselService.selectAppCarouselList());
+    }
+}

+ 111 - 0
qmjszx-admin/src/main/java/beilv/web/controller/carousel/CarouselController.java

@@ -0,0 +1,111 @@
+package beilv.web.controller.carousel;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import beilv.common.annotation.Log;
+import beilv.common.enums.BusinessType;
+import beilv.carousel.domain.BeilvCarousel;
+import beilv.carousel.service.IBeilvCarouselService;
+import beilv.common.core.controller.BaseController;
+import beilv.common.core.domain.AjaxResult;
+import beilv.common.utils.poi.ExcelUtil;
+import beilv.common.core.page.TableDataInfo;
+
+/**
+ * 轮播Controller
+ *
+ * @author ruoyi
+ * @date 2025-11-18
+ */
+@Controller
+@RequestMapping("/carousel")
+public class CarouselController extends BaseController {
+    private String prefix = "carousel";
+
+    @Autowired
+    private IBeilvCarouselService beilvCarouselService;
+
+    @GetMapping()
+    public String carousel() {
+        return prefix + "/carousel";
+    }
+
+    /**
+     * 查询轮播列表
+     */
+    @PostMapping("/list")
+    @ResponseBody
+    public TableDataInfo list(BeilvCarousel beilvCarousel) {
+        startPage();
+        List<BeilvCarousel> list = beilvCarouselService.selectBeilvCarouselList(beilvCarousel);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出轮播列表
+     */
+    @Log(title = "轮播", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(BeilvCarousel beilvCarousel) {
+        List<BeilvCarousel> list = beilvCarouselService.selectBeilvCarouselList(beilvCarousel);
+        ExcelUtil<BeilvCarousel> util = new ExcelUtil<BeilvCarousel>(BeilvCarousel.class);
+        return util.exportExcel(list, "轮播数据");
+    }
+
+    /**
+     * 新增轮播
+     */
+    @GetMapping("/add")
+    public String add() {
+        return prefix + "/add";
+    }
+
+    /**
+     * 新增保存轮播
+     */
+    @Log(title = "轮播", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public AjaxResult addSave(BeilvCarousel beilvCarousel) {
+        return toAjax(beilvCarouselService.insertBeilvCarousel(beilvCarousel));
+    }
+
+    /**
+     * 修改轮播
+     */
+    @GetMapping("/edit/{id}")
+    public String edit(@PathVariable("id") Long id, ModelMap mmap) {
+        BeilvCarousel beilvCarousel = beilvCarouselService.selectBeilvCarouselById(id);
+        mmap.put("beilvCarousel", beilvCarousel);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 修改保存轮播
+     */
+    @Log(title = "轮播", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    @ResponseBody
+    public AjaxResult editSave(BeilvCarousel beilvCarousel) {
+        return toAjax(beilvCarouselService.updateBeilvCarousel(beilvCarousel));
+    }
+
+    /**
+     * 删除轮播
+     */
+    @Log(title = "轮播", businessType = BusinessType.DELETE)
+    @PostMapping("/remove")
+    @ResponseBody
+    public AjaxResult remove(String ids) {
+        return toAjax(beilvCarouselService.deleteBeilvCarouselByIds(ids));
+    }
+}

+ 92 - 0
qmjszx-admin/src/main/resources/templates/carousel/add.html

@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <th:block th:include="include :: header('新增轮播')"/>
+    <th:block th:include="include :: bootstrap-fileinput-css"/>
+</head>
+<body class="white-bg">
+<div class="wrapper wrapper-content animated fadeInRight ibox-content">
+    <form class="form-horizontal m" id="form-carousel-add">
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">图片名称:</label>
+                <div class="col-sm-8">
+                    <input name="carouselName" class="form-control" type="text">
+                </div>
+            </div>
+        </div>
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">图片:</label>
+                <div class="col-sm-8">
+                    <input type="hidden" name="carouselImg">
+                    <div class="file-loading">
+                        <input class="form-control file-upload" id="carouselImg" name="file" type="file" multiple>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">排序:</label>
+                <div class="col-sm-8">
+                    <input name="sort" class="form-control" type="text">
+                </div>
+            </div>
+        </div>
+    </form>
+</div>
+<th:block th:include="include :: footer"/>
+<th:block th:include="include :: bootstrap-fileinput-js"/>
+<script th:inline="javascript">
+    var prefix = ctx + "carousel"
+    $("#form-carousel-add").validate({
+        focusCleanup: true
+    });
+
+    function submitHandler() {
+        if ($.validate.form()) {
+            $.operate.save(prefix + "/add", $('#form-carousel-add').serialize());
+        }
+    }
+
+    $(".file-upload").fileinput({
+        uploadUrl: ctx + 'common/upload',
+        maxFileCount: 5,
+        allowedFileExtensions: ['jpg', 'png'],
+        maxFileSize: 10240,
+        multiple: true,
+    }).on('fileuploaded', function (event, data, previewId, index) {
+        var inputName = event.currentTarget.id;
+        var existingValue = $("input[name='" + inputName + "']").val();
+        var fullUrl = data.response.url; // 获取完整的URL
+        /*var urlObject = new URL(fullUrl);
+        var relativePath = urlObject.pathname; // 获取路径部分
+        // var newBaseUrl = "http://192.168.4.27"; // 新的基URL
+        var newBaseUrl = "http://localhost"; // 新的基URL
+        var absoluteUrl = newBaseUrl + relativePath; // 拼接完整的URL*/
+
+        // 如果已经存在值,则在后面加上逗号分隔的新值
+        if (existingValue) {
+            $("input[name='" + inputName + "']").val(existingValue + ',' + fullUrl);
+        } else {
+            $("input[name='" + inputName + "']").val(fullUrl);
+        }
+    }).on('fileremoved', function (event, key, jqXHR, pd) {
+        var inputName = event.currentTarget.id;
+        var existingValue = $("input[name='" + inputName + "']").val();
+        var fileUrls = existingValue.split(',');
+
+        // 假设key是文件的key或者index,需要找到对应的URL并移除
+        // 这里假设key是文件的index
+        var index = key;
+        if (fileUrls[index]) {
+            fileUrls.splice(index, 1);
+        }
+
+        // 重新拼接文件路径
+        $("input[name='" + inputName + "']").val(fileUrls.join(','));
+    });
+</script>
+</body>
+</html>

+ 102 - 0
qmjszx-admin/src/main/resources/templates/carousel/carousel.html

@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+    <th:block th:include="include :: header('轮播列表')"/>
+</head>
+<body class="gray-bg">
+<div class="container-div">
+    <div class="row">
+        <div class="col-sm-12 search-collapse">
+            <form id="formId">
+                <div class="select-list">
+                    <ul>
+                        <li>
+                            <label>图片名称:</label>
+                            <input type="text" name="carouselName"/>
+                        </li>
+                        <li>
+                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
+                                    class="fa fa-search"></i>&nbsp;搜索</a>
+                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
+                                    class="fa fa-refresh"></i>&nbsp;重置</a>
+                        </li>
+                    </ul>
+                </div>
+            </form>
+        </div>
+
+        <div class="btn-group-sm" id="toolbar" role="group">
+            <a class="btn btn-success" onclick="$.operate.add()">
+                <i class="fa fa-plus"></i> 添加
+            </a>
+            <a class="btn btn-primary single disabled" onclick="$.operate.edit()">
+                <i class="fa fa-edit"></i> 修改
+            </a>
+            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
+                <i class="fa fa-remove"></i> 删除
+            </a>
+        </div>
+        <div class="col-sm-12 select-table table-striped">
+            <table id="bootstrap-table"></table>
+        </div>
+    </div>
+</div>
+<th:block th:include="include :: footer"/>
+<script th:inline="javascript">
+    var prefix = ctx + "carousel";
+
+    $(function () {
+        var options = {
+            url: prefix + "/list",
+            createUrl: prefix + "/add",
+            updateUrl: prefix + "/edit/{id}",
+            removeUrl: prefix + "/remove",
+            exportUrl: prefix + "/export",
+            modalName: "轮播",
+            columns: [{
+                checkbox: true
+            },
+                {
+                    field: 'id',
+                    title: '主键id',
+                    visible: false
+                },
+                {
+                    field: 'carouselName',
+                    title: '图片名称'
+                },
+                {
+                    field: 'sort',
+                    title: '排序'
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function (value, row, index) {
+                        var actions = [];
+                        actions.push('<a class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+                        actions.push('<a class="btn btn-danger btn-xs ' + '" href="javascript:void(0)" onclick="remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        return actions.join('');
+                    }
+                }]
+        };
+        $.table.init(options);
+    });
+    
+    function remove(id) {
+        $.modal.confirm("确定删除该条轮播图信息吗?", function() {
+            var url = prefix + "/remove";
+            var data = { "ids": id };
+            $.operate.submit(url, "post", "json", data, function (result) {
+                if (result.code == web_status.SUCCESS) {
+                    $.modal.msgSuccess(result.msg);
+                    $.table.refresh();
+                } else {
+                    $.modal.alertError(result.msg);
+                }
+            });
+        });
+    }
+</script>
+</body>
+</html>

+ 101 - 0
qmjszx-admin/src/main/resources/templates/carousel/edit.html

@@ -0,0 +1,101 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <th:block th:include="include :: header('修改轮播')"/>
+    <th:block th:include="include :: bootstrap-fileinput-css"/>
+</head>
+<body class="white-bg">
+<div class="wrapper wrapper-content animated fadeInRight ibox-content">
+    <form class="form-horizontal m" id="form-carousel-edit" th:object="${beilvCarousel}">
+        <input name="id" th:field="*{id}" type="hidden">
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">图片名称:</label>
+                <div class="col-sm-8">
+                    <input name="carouselName" th:field="*{carouselName}" class="form-control" type="text">
+                </div>
+            </div>
+        </div>
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">图片:</label>
+                <div class="col-sm-8">
+                    <input type="hidden" name="carouselImg" th:field="*{carouselImg}">
+                    <div class="file-loading">
+                        <input class="form-control file-upload" id="carouselImg" name="file" type="file" multiple>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="col-xs-12">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">排序:</label>
+                <div class="col-sm-8">
+                    <input name="sort" th:field="*{sort}" class="form-control" type="text">
+                </div>
+            </div>
+        </div>
+    </form>
+</div>
+<th:block th:include="include :: footer"/>
+<th:block th:include="include :: bootstrap-fileinput-js"/>
+<script th:inline="javascript">
+    var prefix = ctx + "carousel";
+    $("#form-carousel-edit").validate({
+        focusCleanup: true
+    });
+
+    function submitHandler() {
+        if ($.validate.form()) {
+            $.operate.save(prefix + "/edit", $('#form-carousel-edit').serialize());
+        }
+    }
+
+    $(".file-upload").each(function (i) {
+        var inputName = this.id;
+        var val = $("input[name='" + inputName + "']").val();
+
+        // 将已上传的图片路径分割成数组
+        var initialPreview = val ? val.split(',') : [];
+
+        $(this).fileinput({
+            uploadUrl: ctx + 'common/upload',
+            initialPreviewAsData: true,
+            initialPreview: initialPreview,
+            maxFileCount: 5,
+            allowedFileExtensions: ['jpg', 'png'],
+            maxFileSize: 10240,
+            multiple: true,
+        }).on('fileuploaded', function (event, data, previewId, index) {
+            var inputName = event.currentTarget.id;
+            var existingValue = $("input[name='" + inputName + "']").val();
+            var fullUrl = data.response.url; // 获取完整的URL
+            /*var urlObject = new URL(fullUrl);
+            var relativePath = urlObject.pathname; // 获取路径部分
+            // var newBaseUrl = "http://192.168.4.27"; // 新的基URL
+            var newBaseUrl = "http://localhost"; // 新的基URL
+            var absoluteUrl = newBaseUrl + relativePath; // 拼接完整的URL*/
+
+            // 如果已经存在值,则在后面加上逗号分隔的新值
+            if (existingValue) {
+                $("input[name='" + inputName + "']").val(existingValue + ',' + fullUrl);
+            } else {
+                $("input[name='" + inputName + "']").val(fullUrl);
+            }
+        }).on('fileremoved', function (event, id, index) {
+            var inputName = event.currentTarget.id;
+            var existingValue = $("input[name='" + inputName + "']").val();
+            var fileUrls = existingValue.split(',');
+
+            // 移除对应的文件路径
+            fileUrls.splice(index, 1);
+
+            // 重新拼接文件路径
+            $("input[name='" + inputName + "']").val(fileUrls.join(','));
+        });
+
+        $(this).fileinput('_initFileActions');
+    });
+</script>
+</body>
+</html>

+ 1 - 1
qmjszx-admin/src/main/resources/templates/index-topnav.html

@@ -27,7 +27,7 @@
         </div>
         <a th:href="@{/index}">
             <li class="logo hidden-xs">
-                <span class="logo-lg">RuoYi</span>
+                <span class="logo-lg">全民健身</span>
             </li>
          </a>
         <div class="sidebar-collapse tab-content" id="side-menu">

+ 1 - 1
qmjszx-admin/src/main/resources/templates/index.html

@@ -26,7 +26,7 @@
         </div>
         <a th:href="@{/index}">
             <li class="logo hidden-xs">
-                <span class="logo-lg">RuoYi</span>
+                <span class="logo-lg">全民健身</span>
             </li>
          </a>
         <div class="sidebar-collapse">

+ 39 - 0
qmjszx-business/src/main/java/beilv/carousel/domain/BeilvCarousel.java

@@ -0,0 +1,39 @@
+package beilv.carousel.domain;
+
+import lombok.Data;
+import beilv.common.annotation.Excel;
+import beilv.common.core.domain.BaseEntity;
+
+/**
+ * 轮播对象 beilv_carousel
+ *
+ * @author ruoyi
+ * @date 2025-11-18
+ */
+@Data
+public class BeilvCarousel extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 用户id
+     */
+    private Long id;
+
+    /**
+     * 图片名称
+     */
+    @Excel(name = "图片名称")
+    private String carouselName;
+    /**
+     * 图片
+     */
+    @Excel(name = "图片")
+    private String carouselImg;
+
+    /**
+     * 排序
+     */
+    @Excel(name = "排序")
+    private String sort;
+
+}

+ 63 - 0
qmjszx-business/src/main/java/beilv/carousel/mapper/BeilvCarouselMapper.java

@@ -0,0 +1,63 @@
+package beilv.carousel.mapper;
+
+import java.util.List;
+
+import beilv.carousel.domain.BeilvCarousel;
+
+/**
+ * 轮播Mapper接口
+ *
+ * @author ruoyi
+ * @date 2025-11-18
+ */
+public interface BeilvCarouselMapper {
+    /**
+     * 查询轮播
+     *
+     * @param id 轮播主键
+     * @return 轮播
+     */
+    public BeilvCarousel selectBeilvCarouselById(Long id);
+
+    /**
+     * 查询轮播列表
+     *
+     * @param beilvCarousel 轮播
+     * @return 轮播集合
+     */
+    public List<BeilvCarousel> selectBeilvCarouselList(BeilvCarousel beilvCarousel);
+
+    /**
+     * 新增轮播
+     *
+     * @param beilvCarousel 轮播
+     * @return 结果
+     */
+    public int insertBeilvCarousel(BeilvCarousel beilvCarousel);
+
+    /**
+     * 修改轮播
+     *
+     * @param beilvCarousel 轮播
+     * @return 结果
+     */
+    public int updateBeilvCarousel(BeilvCarousel beilvCarousel);
+
+    /**
+     * 删除轮播
+     *
+     * @param id 轮播主键
+     * @return 结果
+     */
+    public int deleteBeilvCarouselById(Long id);
+
+    /**
+     * 批量删除轮播
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteBeilvCarouselByIds(String[] ids);
+
+    List<BeilvCarousel> selectAppCarouselList();
+}

+ 64 - 0
qmjszx-business/src/main/java/beilv/carousel/service/IBeilvCarouselService.java

@@ -0,0 +1,64 @@
+package beilv.carousel.service;
+
+import java.util.List;
+
+import beilv.carousel.domain.BeilvCarousel;
+
+/**
+ * 轮播Service接口
+ *
+ * @author ruoyi
+ * @date 2025-11-18
+ */
+public interface IBeilvCarouselService {
+    /**
+     * 查询轮播
+     *
+     * @param id 轮播主键
+     * @return 轮播
+     */
+    public BeilvCarousel selectBeilvCarouselById(Long id);
+
+    /**
+     * 查询轮播列表
+     *
+     * @param beilvCarousel 轮播
+     * @return 轮播集合
+     */
+    public List<BeilvCarousel> selectBeilvCarouselList(BeilvCarousel beilvCarousel);
+
+    /**
+     * 新增轮播
+     *
+     * @param beilvCarousel 轮播
+     * @return 结果
+     */
+    public int insertBeilvCarousel(BeilvCarousel beilvCarousel);
+
+    /**
+     * 修改轮播
+     *
+     * @param beilvCarousel 轮播
+     * @return 结果
+     */
+    public int updateBeilvCarousel(BeilvCarousel beilvCarousel);
+
+    /**
+     * 批量删除轮播
+     *
+     * @param ids 需要删除的轮播主键集合
+     * @return 结果
+     */
+    public int deleteBeilvCarouselByIds(String ids);
+
+    /**
+     * 删除轮播信息
+     *
+     * @param id 轮播主键
+     * @return 结果
+     */
+    public int deleteBeilvCarouselById(Long id);
+
+    List<BeilvCarousel> selectAppCarouselList();
+
+}

+ 96 - 0
qmjszx-business/src/main/java/beilv/carousel/service/impl/BeilvCarouselServiceImpl.java

@@ -0,0 +1,96 @@
+package beilv.carousel.service.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import beilv.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import beilv.carousel.mapper.BeilvCarouselMapper;
+import beilv.carousel.domain.BeilvCarousel;
+import beilv.carousel.service.IBeilvCarouselService;
+import beilv.common.core.text.Convert;
+
+/**
+ * 轮播Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2025-11-18
+ */
+@Service
+public class BeilvCarouselServiceImpl implements IBeilvCarouselService {
+    @Autowired
+    private BeilvCarouselMapper beilvCarouselMapper;
+
+    /**
+     * 查询轮播
+     *
+     * @param id 轮播主键
+     * @return 轮播
+     */
+    @Override
+    public BeilvCarousel selectBeilvCarouselById(Long id) {
+        return beilvCarouselMapper.selectBeilvCarouselById(id);
+    }
+
+    /**
+     * 查询轮播列表
+     *
+     * @param beilvCarousel 轮播
+     * @return 轮播
+     */
+    @Override
+    public List<BeilvCarousel> selectBeilvCarouselList(BeilvCarousel beilvCarousel) {
+        return beilvCarouselMapper.selectBeilvCarouselList(beilvCarousel);
+    }
+
+    /**
+     * 新增轮播
+     *
+     * @param beilvCarousel 轮播
+     * @return 结果
+     */
+    @Override
+    public int insertBeilvCarousel(BeilvCarousel beilvCarousel) {
+        beilvCarousel.setCreateTime(DateUtils.getNowDate());
+        return beilvCarouselMapper.insertBeilvCarousel(beilvCarousel);
+    }
+
+    /**
+     * 修改轮播
+     *
+     * @param beilvCarousel 轮播
+     * @return 结果
+     */
+    @Override
+    public int updateBeilvCarousel(BeilvCarousel beilvCarousel) {
+        return beilvCarouselMapper.updateBeilvCarousel(beilvCarousel);
+    }
+
+    /**
+     * 批量删除轮播
+     *
+     * @param ids 需要删除的轮播主键
+     * @return 结果
+     */
+    @Override
+    public int deleteBeilvCarouselByIds(String ids) {
+        return beilvCarouselMapper.deleteBeilvCarouselByIds(Convert.toStrArray(ids));
+    }
+
+    /**
+     * 删除轮播信息
+     *
+     * @param id 轮播主键
+     * @return 结果
+     */
+    @Override
+    public int deleteBeilvCarouselById(Long id) {
+        return beilvCarouselMapper.deleteBeilvCarouselById(id);
+    }
+
+    @Override
+    public List<BeilvCarousel> selectAppCarouselList() {
+        return beilvCarouselMapper.selectAppCarouselList();
+    }
+}

+ 77 - 0
qmjszx-business/src/main/resources/mapper/carousel/BeilvCarouselMapper.xml

@@ -0,0 +1,77 @@
+<?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="beilv.carousel.mapper.BeilvCarouselMapper">
+
+    <resultMap type="BeilvCarousel" id="BeilvCarouselResult">
+        <result property="id" column="id"/>
+        <result property="carouselName" column="carousel_name"/>
+        <result property="carouselImg" column="carousel_img"/>
+        <result property="sort" column="sort"/>
+        <result property="createTime" column="create_time"/>
+    </resultMap>
+
+    <sql id="selectBeilvCarouselVo">
+        select id, carousel_name, carousel_img, sort, create_time
+        from beilv_carousel
+    </sql>
+
+    <select id="selectBeilvCarouselList" parameterType="BeilvCarousel" resultMap="BeilvCarouselResult">
+        <include refid="selectBeilvCarouselVo"/>
+        <where>
+            <if test="carouselName != null  and carouselName != ''">and carousel_name like concat('%',#{carouselName},'%')</if>
+            <if test="sort != null  and sort != ''">and sort = #{sort}</if>
+        </where>
+    </select>
+
+    <select id="selectBeilvCarouselById" parameterType="Long" resultMap="BeilvCarouselResult">
+        <include refid="selectBeilvCarouselVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertBeilvCarousel" parameterType="BeilvCarousel" useGeneratedKeys="true" keyProperty="id">
+        insert into beilv_carousel
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="carouselName != null">carousel_name,</if>
+            <if test="carouselImg != null">carousel_img,</if>
+            <if test="sort != null">sort,</if>
+            <if test="createTime != null">create_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="carouselName != null">#{carouselName},</if>
+            <if test="carouselImg != null">#{carouselImg},</if>
+            <if test="sort != null">#{sort},</if>
+            <if test="createTime != null">#{createTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateBeilvCarousel" parameterType="BeilvCarousel">
+        update beilv_carousel
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="carouselName != null">carousel_name = #{carouselName},</if>
+            <if test="carouselImg != null">carousel_img = #{carouselImg},</if>
+            <if test="sort != null">sort = #{sort},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteBeilvCarouselById" parameterType="Long">
+        delete
+        from beilv_carousel
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteBeilvCarouselByIds" parameterType="String">
+        delete from beilv_carousel where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="selectAppCarouselList" resultMap="BeilvCarouselResult">
+        <include refid="selectBeilvCarouselVo"/>
+        limit 3
+    </select>
+</mapper>