From d5a6086ba380563bd64f8bb87e0696a9348f36bc Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Thu, 24 Feb 2022 09:02:58 +0800
Subject: [PATCH] 轮播图
---
src/main/java/org/springblade/modules/auth/utils/TokenUtil.java | 1
src/main/java/org/springblade/modules/rotation/entity/Rotation.java | 76 +++++
src/main/java/org/springblade/modules/rotation/service/IRotationService.java | 41 ++
src/main/java/org/springblade/modules/proclamation/dto/ProclamationDTO.java | 34 ++
src/main/java/org/springblade/modules/rotation/vo/RotationVO.java | 36 ++
src/main/java/org/springblade/modules/rotation/dto/RotationDTO.java | 34 ++
src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml | 18 +
src/main/java/org/springblade/modules/proclamation/entity/Proclamation.java | 61 ++++
src/main/java/org/springblade/modules/rotation/service/impl/RotationServiceImpl.java | 41 ++
src/main/java/org/springblade/modules/proclamation/mapper/ProclamationMapper.java | 43 +++
src/main/java/org/springblade/modules/proclamation/mapper/ProclamationMapper.xml | 17 +
src/main/java/org/springblade/modules/proclamation/service/IProclamationService.java | 41 ++
src/main/java/org/springblade/modules/proclamation/service/impl/ProclamationServiceImpl.java | 41 ++
src/main/java/org/springblade/modules/proclamation/vo/ProclamationVO.java | 36 ++
src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.java | 43 +++
src/main/java/org/springblade/modules/rotation/controller/RotationController.java | 128 +++++++++
src/main/java/org/springblade/modules/proclamation/controller/ProclamationController.java | 128 +++++++++
17 files changed, 819 insertions(+), 0 deletions(-)
diff --git a/src/main/java/org/springblade/modules/auth/utils/TokenUtil.java b/src/main/java/org/springblade/modules/auth/utils/TokenUtil.java
index f27d206..d287d47 100644
--- a/src/main/java/org/springblade/modules/auth/utils/TokenUtil.java
+++ b/src/main/java/org/springblade/modules/auth/utils/TokenUtil.java
@@ -106,6 +106,7 @@
.set(TokenConstant.ROLE_ID, user.getRoleId())
.set("jurisdiction", user.getJurisdiction())
.set("stype", user.getStype())
+ .set("cardid", user.getCardid())
.set(TokenConstant.OAUTH_ID, userInfo.getOauthId())
.set(TokenConstant.ACCOUNT, user.getAccount())
.set(TokenConstant.USER_NAME, user.getAccount())
diff --git a/src/main/java/org/springblade/modules/proclamation/controller/ProclamationController.java b/src/main/java/org/springblade/modules/proclamation/controller/ProclamationController.java
new file mode 100644
index 0000000..c235f33
--- /dev/null
+++ b/src/main/java/org/springblade/modules/proclamation/controller/ProclamationController.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.proclamation.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.proclamation.entity.Proclamation;
+import org.springblade.modules.proclamation.service.IProclamationService;
+import org.springblade.modules.proclamation.vo.ProclamationVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.Date;
+
+/**
+ * 控制器
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("proclamation/proclamation")
+@Api(value = "", tags = "接口")
+public class ProclamationController extends BladeController {
+
+ private final IProclamationService proclamationService;
+
+ /**
+ * 详情
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @ApiOperation(value = "详情", notes = "传入proclamation")
+ public R<Proclamation> detail(Proclamation proclamation) {
+ Proclamation detail = proclamationService.getOne(Condition.getQueryWrapper(proclamation));
+ return R.data(detail);
+ }
+
+ /**
+ * 分页
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @ApiOperation(value = "分页", notes = "传入proclamation")
+ public R<IPage<Proclamation>> list(Proclamation proclamation, Query query) {
+ IPage<Proclamation> pages = proclamationService.page(Condition.getPage(query), Condition.getQueryWrapper(proclamation));
+ return R.data(pages);
+ }
+
+ /**
+ * 自定义分页
+ */
+ @GetMapping("/page")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "分页", notes = "传入proclamation")
+ public R<IPage<ProclamationVO>> page(ProclamationVO proclamation, Query query) {
+ IPage<ProclamationVO> pages = proclamationService.selectProclamationPage(Condition.getPage(query), proclamation);
+ return R.data(pages);
+ }
+
+ /**
+ * 新增
+ */
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 4)
+ @ApiOperation(value = "新增", notes = "传入proclamation")
+ public R save(@Valid @RequestBody Proclamation proclamation) {
+ return R.status(proclamationService.save(proclamation));
+ }
+
+ /**
+ * 修改
+ */
+ @PostMapping("/update")
+ @ApiOperationSupport(order = 5)
+ @ApiOperation(value = "修改", notes = "传入proclamation")
+ public R update(@Valid @RequestBody Proclamation proclamation) {
+ return R.status(proclamationService.updateById(proclamation));
+ }
+
+ /**
+ * 新增或修改
+ */
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 6)
+ @ApiOperation(value = "新增或修改", notes = "传入proclamation")
+ public R submit(@Valid @RequestBody Proclamation proclamation) {
+ proclamation.setTime(new Date());
+ return R.status(proclamationService.saveOrUpdate(proclamation));
+ }
+
+
+ /**
+ * 删除
+ */
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 8)
+ @ApiOperation(value = "删除", notes = "传入ids")
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ return R.status(proclamationService.removeByIds(Func.toLongList(ids)));
+ }
+
+
+}
diff --git a/src/main/java/org/springblade/modules/proclamation/dto/ProclamationDTO.java b/src/main/java/org/springblade/modules/proclamation/dto/ProclamationDTO.java
new file mode 100644
index 0000000..869a5c5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/proclamation/dto/ProclamationDTO.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.proclamation.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.proclamation.entity.Proclamation;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProclamationDTO extends Proclamation {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/proclamation/entity/Proclamation.java b/src/main/java/org/springblade/modules/proclamation/entity/Proclamation.java
new file mode 100644
index 0000000..3edee2c
--- /dev/null
+++ b/src/main/java/org/springblade/modules/proclamation/entity/Proclamation.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.proclamation.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+@Data
+@TableName("sys_proclamation")
+@ApiModel(value = "Proclamation对象", description = "Proclamation对象")
+public class Proclamation implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+ /**
+ * 公告名称
+ */
+ @ApiModelProperty(value = "公告名称")
+ private String name;
+ /**
+ * 公告内容
+ */
+ @ApiModelProperty(value = "公告内容")
+ private String context;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date time;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/proclamation/mapper/ProclamationMapper.java b/src/main/java/org/springblade/modules/proclamation/mapper/ProclamationMapper.java
new file mode 100644
index 0000000..e34f640
--- /dev/null
+++ b/src/main/java/org/springblade/modules/proclamation/mapper/ProclamationMapper.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.proclamation.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.proclamation.entity.Proclamation;
+import org.springblade.modules.proclamation.vo.ProclamationVO;
+
+import java.util.List;
+
+/**
+ * Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+public interface ProclamationMapper extends BaseMapper<Proclamation> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param proclamation
+ * @return
+ */
+ List<ProclamationVO> selectProclamationPage(IPage page, ProclamationVO proclamation);
+
+}
diff --git a/src/main/java/org/springblade/modules/proclamation/mapper/ProclamationMapper.xml b/src/main/java/org/springblade/modules/proclamation/mapper/ProclamationMapper.xml
new file mode 100644
index 0000000..9e17f6e
--- /dev/null
+++ b/src/main/java/org/springblade/modules/proclamation/mapper/ProclamationMapper.xml
@@ -0,0 +1,17 @@
+<?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="org.springblade.modules.proclamation.mapper.ProclamationMapper">
+
+ <!-- 通用查询映射结果 -->
+ <resultMap id="proclamationResultMap" type="org.springblade.modules.proclamation.entity.Proclamation">
+ <id column="id" property="id"/>
+ <result column="name" property="name"/>
+ <result column="context" property="context"/>
+ </resultMap>
+
+
+ <select id="selectProclamationPage" resultMap="proclamationResultMap">
+ select * from sys_proclamation where is_deleted = 0
+ </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/proclamation/service/IProclamationService.java b/src/main/java/org/springblade/modules/proclamation/service/IProclamationService.java
new file mode 100644
index 0000000..95c2841
--- /dev/null
+++ b/src/main/java/org/springblade/modules/proclamation/service/IProclamationService.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.proclamation.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.proclamation.entity.Proclamation;
+import org.springblade.modules.proclamation.vo.ProclamationVO;
+
+/**
+ * 服务类
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+public interface IProclamationService extends IService<Proclamation> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param proclamation
+ * @return
+ */
+ IPage<ProclamationVO> selectProclamationPage(IPage<ProclamationVO> page, ProclamationVO proclamation);
+
+}
diff --git a/src/main/java/org/springblade/modules/proclamation/service/impl/ProclamationServiceImpl.java b/src/main/java/org/springblade/modules/proclamation/service/impl/ProclamationServiceImpl.java
new file mode 100644
index 0000000..5c3e0ee
--- /dev/null
+++ b/src/main/java/org/springblade/modules/proclamation/service/impl/ProclamationServiceImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.proclamation.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.proclamation.entity.Proclamation;
+import org.springblade.modules.proclamation.mapper.ProclamationMapper;
+import org.springblade.modules.proclamation.service.IProclamationService;
+import org.springblade.modules.proclamation.vo.ProclamationVO;
+import org.springframework.stereotype.Service;
+
+/**
+ * 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+@Service
+public class ProclamationServiceImpl extends ServiceImpl<ProclamationMapper, Proclamation> implements IProclamationService {
+
+ @Override
+ public IPage<ProclamationVO> selectProclamationPage(IPage<ProclamationVO> page, ProclamationVO proclamation) {
+ return page.setRecords(baseMapper.selectProclamationPage(page, proclamation));
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/proclamation/vo/ProclamationVO.java b/src/main/java/org/springblade/modules/proclamation/vo/ProclamationVO.java
new file mode 100644
index 0000000..e2ddae2
--- /dev/null
+++ b/src/main/java/org/springblade/modules/proclamation/vo/ProclamationVO.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.proclamation.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.proclamation.entity.Proclamation;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "ProclamationVO对象", description = "ProclamationVO对象")
+public class ProclamationVO extends Proclamation {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/rotation/controller/RotationController.java b/src/main/java/org/springblade/modules/rotation/controller/RotationController.java
new file mode 100644
index 0000000..908e0a5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/rotation/controller/RotationController.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.rotation.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.rotation.entity.Rotation;
+import org.springblade.modules.rotation.service.IRotationService;
+import org.springblade.modules.rotation.vo.RotationVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.Date;
+
+/**
+ * 轮播图 控制器
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("rotation/rotation")
+@Api(value = "轮播图", tags = "轮播图接口")
+public class RotationController extends BladeController {
+
+ private final IRotationService rotationService;
+
+ /**
+ * 详情
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @ApiOperation(value = "详情", notes = "传入rotation")
+ public R<Rotation> detail(Rotation rotation) {
+ Rotation detail = rotationService.getOne(Condition.getQueryWrapper(rotation));
+ return R.data(detail);
+ }
+
+ /**
+ * 分页 轮播图
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @ApiOperation(value = "分页", notes = "传入rotation")
+ public R<IPage<Rotation>> list(Rotation rotation, Query query) {
+ IPage<Rotation> pages = rotationService.page(Condition.getPage(query), Condition.getQueryWrapper(rotation));
+ return R.data(pages);
+ }
+
+ /**
+ * 自定义分页 轮播图
+ */
+ @GetMapping("/page")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "分页", notes = "传入rotation")
+ public R<IPage<RotationVO>> page(RotationVO rotation, Query query) {
+ IPage<RotationVO> pages = rotationService.selectRotationPage(Condition.getPage(query), rotation);
+ return R.data(pages);
+ }
+
+ /**
+ * 新增 轮播图
+ */
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 4)
+ @ApiOperation(value = "新增", notes = "传入rotation")
+ public R save(@Valid @RequestBody Rotation rotation) {
+ return R.status(rotationService.save(rotation));
+ }
+
+ /**
+ * 修改 轮播图
+ */
+ @PostMapping("/update")
+ @ApiOperationSupport(order = 5)
+ @ApiOperation(value = "修改", notes = "传入rotation")
+ public R update(@Valid @RequestBody Rotation rotation) {
+ return R.status(rotationService.updateById(rotation));
+ }
+
+ /**
+ * 新增或修改 轮播图
+ */
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 6)
+ @ApiOperation(value = "新增或修改", notes = "传入rotation")
+ public R submit(@Valid @RequestBody Rotation rotation) {
+ rotation.setTime(new Date());
+ return R.status(rotationService.saveOrUpdate(rotation));
+ }
+
+
+ /**
+ * 删除 轮播图
+ */
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 8)
+ @ApiOperation(value = "删除", notes = "传入ids")
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ return R.status(rotationService.removeByIds(Func.toLongList(ids)));
+ }
+
+
+}
diff --git a/src/main/java/org/springblade/modules/rotation/dto/RotationDTO.java b/src/main/java/org/springblade/modules/rotation/dto/RotationDTO.java
new file mode 100644
index 0000000..12b5b60
--- /dev/null
+++ b/src/main/java/org/springblade/modules/rotation/dto/RotationDTO.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.rotation.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.rotation.entity.Rotation;
+
+/**
+ * 轮播图数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class RotationDTO extends Rotation {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/rotation/entity/Rotation.java b/src/main/java/org/springblade/modules/rotation/entity/Rotation.java
new file mode 100644
index 0000000..a8e3f45
--- /dev/null
+++ b/src/main/java/org/springblade/modules/rotation/entity/Rotation.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.rotation.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 轮播图实体类
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+@Data
+@TableName("sys_rotation")
+@ApiModel(value = "Rotation对象", description = "轮播图")
+public class Rotation implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+ /**
+ * 图片地址
+ */
+ @ApiModelProperty(value = "图片地址")
+ private String url;
+ /**
+ * 跳转地址
+ */
+ @ApiModelProperty(value = "跳转地址")
+ @TableField("junpUrl")
+ private String junpurl;
+ /**
+ * 发布时间
+ */
+ @ApiModelProperty(value = "名称")
+ private String name;
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date time;
+
+ /**
+ * 类型 0:轮播图 1:公告
+ */
+ private String type;
+ /**
+ * 内容
+ */
+ private String context;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.java b/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.java
new file mode 100644
index 0000000..64d129d
--- /dev/null
+++ b/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.rotation.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.rotation.entity.Rotation;
+import org.springblade.modules.rotation.vo.RotationVO;
+
+import java.util.List;
+
+/**
+ * 轮播图 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+public interface RotationMapper extends BaseMapper<Rotation> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param rotation
+ * @return
+ */
+ List<RotationVO> selectRotationPage(IPage page, RotationVO rotation);
+
+}
diff --git a/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml b/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml
new file mode 100644
index 0000000..d6a8ee6
--- /dev/null
+++ b/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml
@@ -0,0 +1,18 @@
+<?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="org.springblade.modules.rotation.mapper.RotationMapper">
+
+ <!-- 通用查询映射结果 -->
+ <resultMap id="rotationResultMap" type="org.springblade.modules.rotation.entity.Rotation">
+ <id column="id" property="id"/>
+ <result column="url" property="url"/>
+ <result column="junpUrl" property="junpurl"/>
+ <result column="name" property="name"/>
+ </resultMap>
+
+
+ <select id="selectRotationPage" resultMap="rotationResultMap">
+ select * from sys_rotation where is_deleted = 0
+ </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/rotation/service/IRotationService.java b/src/main/java/org/springblade/modules/rotation/service/IRotationService.java
new file mode 100644
index 0000000..36e4e57
--- /dev/null
+++ b/src/main/java/org/springblade/modules/rotation/service/IRotationService.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.rotation.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.rotation.entity.Rotation;
+import org.springblade.modules.rotation.vo.RotationVO;
+
+/**
+ * 轮播图 服务类
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+public interface IRotationService extends IService<Rotation> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param rotation
+ * @return
+ */
+ IPage<RotationVO> selectRotationPage(IPage<RotationVO> page, RotationVO rotation);
+
+}
diff --git a/src/main/java/org/springblade/modules/rotation/service/impl/RotationServiceImpl.java b/src/main/java/org/springblade/modules/rotation/service/impl/RotationServiceImpl.java
new file mode 100644
index 0000000..48ca143
--- /dev/null
+++ b/src/main/java/org/springblade/modules/rotation/service/impl/RotationServiceImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.rotation.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.rotation.entity.Rotation;
+import org.springblade.modules.rotation.mapper.RotationMapper;
+import org.springblade.modules.rotation.service.IRotationService;
+import org.springblade.modules.rotation.vo.RotationVO;
+import org.springframework.stereotype.Service;
+
+/**
+ * 轮播图 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+@Service
+public class RotationServiceImpl extends ServiceImpl<RotationMapper, Rotation> implements IRotationService {
+
+ @Override
+ public IPage<RotationVO> selectRotationPage(IPage<RotationVO> page, RotationVO rotation) {
+ return page.setRecords(baseMapper.selectRotationPage(page, rotation));
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/rotation/vo/RotationVO.java b/src/main/java/org/springblade/modules/rotation/vo/RotationVO.java
new file mode 100644
index 0000000..ad33645
--- /dev/null
+++ b/src/main/java/org/springblade/modules/rotation/vo/RotationVO.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.rotation.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.rotation.entity.Rotation;
+
+/**
+ * 轮播图视图实体类
+ *
+ * @author BladeX
+ * @since 2022-02-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "RotationVO对象", description = "轮播图")
+public class RotationVO extends Rotation {
+ private static final long serialVersionUID = 1L;
+
+}
--
Gitblit v1.9.3