From ddfd027746199b874ef56712a80e458fd504566b Mon Sep 17 00:00:00 2001 From: GeDashi <2531216855@qq.com> Date: Sun, 22 Dec 2024 18:00:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A47?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/RecommendController.java | 104 ++++++++++++++++++ .../com/ruoyi/system/domain/Recommend.java | 93 ++++++++++++++++ .../ruoyi/system/mapper/RecommendMapper.java | 61 ++++++++++ .../system/service/IRecommendService.java | 61 ++++++++++ .../service/impl/RecommendServiceImpl.java | 93 ++++++++++++++++ .../mapper/system/RecommendMapper.xml | 71 ++++++++++++ 6 files changed, 483 insertions(+) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/controller/RecommendController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/Recommend.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/RecommendMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IRecommendService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RecommendServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/RecommendMapper.xml diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/RecommendController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/RecommendController.java new file mode 100644 index 0000000..8d68360 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/RecommendController.java @@ -0,0 +1,104 @@ +package com.ruoyi.system.controller; + +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.Recommend; +import com.ruoyi.system.service.IRecommendService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 推荐表Controller + * + * @author LG + * @date 2024-12-22 + */ +@RestController +@RequestMapping("/system/recommend") +public class RecommendController extends BaseController +{ + @Autowired + private IRecommendService recommendService; + + /** + * 查询推荐表列表 + */ + @PreAuthorize("@ss.hasPermi('system:recommend:list')") + @GetMapping("/list") + public TableDataInfo list(Recommend recommend) + { + startPage(); + List list = recommendService.selectRecommendList(recommend); + return getDataTable(list); + } + + /** + * 导出推荐表列表 + */ + @PreAuthorize("@ss.hasPermi('system:recommend:export')") + @Log(title = "推荐表", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, Recommend recommend) + { + List list = recommendService.selectRecommendList(recommend); + ExcelUtil util = new ExcelUtil(Recommend.class); + util.exportExcel(response, list, "推荐表数据"); + } + + /** + * 获取推荐表详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:recommend:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(recommendService.selectRecommendById(id)); + } + + /** + * 新增推荐表 + */ + @PreAuthorize("@ss.hasPermi('system:recommend:add')") + @Log(title = "推荐表", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody Recommend recommend) + { + return toAjax(recommendService.insertRecommend(recommend)); + } + + /** + * 修改推荐表 + */ + @PreAuthorize("@ss.hasPermi('system:recommend:edit')") + @Log(title = "推荐表", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody Recommend recommend) + { + return toAjax(recommendService.updateRecommend(recommend)); + } + + /** + * 删除推荐表 + */ + @PreAuthorize("@ss.hasPermi('system:recommend:remove')") + @Log(title = "推荐表", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(recommendService.deleteRecommendByIds(ids)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/Recommend.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Recommend.java new file mode 100644 index 0000000..2fc55b0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Recommend.java @@ -0,0 +1,93 @@ +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; + +/** + * 推荐表对象 recommend + * + * @author LG + * @date 2024-12-22 + */ +public class Recommend extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 推荐名 */ + @Excel(name = "推荐名") + private String tuijianname; + + /** 推荐数量 */ + @Excel(name = "推荐数量") + private Long tuijiannumber; + + /** 推荐语 */ + @Excel(name = "推荐语") + private String tuijianyu; + + /** 图片展示 */ + @Excel(name = "图片展示") + private String picture; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setTuijianname(String tuijianname) + { + this.tuijianname = tuijianname; + } + + public String getTuijianname() + { + return tuijianname; + } + public void setTuijiannumber(Long tuijiannumber) + { + this.tuijiannumber = tuijiannumber; + } + + public Long getTuijiannumber() + { + return tuijiannumber; + } + public void setTuijianyu(String tuijianyu) + { + this.tuijianyu = tuijianyu; + } + + public String getTuijianyu() + { + return tuijianyu; + } + public void setPicture(String picture) + { + this.picture = picture; + } + + public String getPicture() + { + return picture; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("tuijianname", getTuijianname()) + .append("tuijiannumber", getTuijiannumber()) + .append("tuijianyu", getTuijianyu()) + .append("picture", getPicture()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RecommendMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RecommendMapper.java new file mode 100644 index 0000000..1cd62f4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RecommendMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.Recommend; + +/** + * 推荐表Mapper接口 + * + * @author LG + * @date 2024-12-22 + */ +public interface RecommendMapper +{ + /** + * 查询推荐表 + * + * @param id 推荐表主键 + * @return 推荐表 + */ + public Recommend selectRecommendById(Long id); + + /** + * 查询推荐表列表 + * + * @param recommend 推荐表 + * @return 推荐表集合 + */ + public List selectRecommendList(Recommend recommend); + + /** + * 新增推荐表 + * + * @param recommend 推荐表 + * @return 结果 + */ + public int insertRecommend(Recommend recommend); + + /** + * 修改推荐表 + * + * @param recommend 推荐表 + * @return 结果 + */ + public int updateRecommend(Recommend recommend); + + /** + * 删除推荐表 + * + * @param id 推荐表主键 + * @return 结果 + */ + public int deleteRecommendById(Long id); + + /** + * 批量删除推荐表 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteRecommendByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IRecommendService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IRecommendService.java new file mode 100644 index 0000000..7f7619a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IRecommendService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.Recommend; + +/** + * 推荐表Service接口 + * + * @author LG + * @date 2024-12-22 + */ +public interface IRecommendService +{ + /** + * 查询推荐表 + * + * @param id 推荐表主键 + * @return 推荐表 + */ + public Recommend selectRecommendById(Long id); + + /** + * 查询推荐表列表 + * + * @param recommend 推荐表 + * @return 推荐表集合 + */ + public List selectRecommendList(Recommend recommend); + + /** + * 新增推荐表 + * + * @param recommend 推荐表 + * @return 结果 + */ + public int insertRecommend(Recommend recommend); + + /** + * 修改推荐表 + * + * @param recommend 推荐表 + * @return 结果 + */ + public int updateRecommend(Recommend recommend); + + /** + * 批量删除推荐表 + * + * @param ids 需要删除的推荐表主键集合 + * @return 结果 + */ + public int deleteRecommendByIds(Long[] ids); + + /** + * 删除推荐表信息 + * + * @param id 推荐表主键 + * @return 结果 + */ + public int deleteRecommendById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RecommendServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RecommendServiceImpl.java new file mode 100644 index 0000000..8dda8ac --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RecommendServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.RecommendMapper; +import com.ruoyi.system.domain.Recommend; +import com.ruoyi.system.service.IRecommendService; + +/** + * 推荐表Service业务层处理 + * + * @author LG + * @date 2024-12-22 + */ +@Service +public class RecommendServiceImpl implements IRecommendService +{ + @Autowired + private RecommendMapper recommendMapper; + + /** + * 查询推荐表 + * + * @param id 推荐表主键 + * @return 推荐表 + */ + @Override + public Recommend selectRecommendById(Long id) + { + return recommendMapper.selectRecommendById(id); + } + + /** + * 查询推荐表列表 + * + * @param recommend 推荐表 + * @return 推荐表 + */ + @Override + public List selectRecommendList(Recommend recommend) + { + return recommendMapper.selectRecommendList(recommend); + } + + /** + * 新增推荐表 + * + * @param recommend 推荐表 + * @return 结果 + */ + @Override + public int insertRecommend(Recommend recommend) + { + return recommendMapper.insertRecommend(recommend); + } + + /** + * 修改推荐表 + * + * @param recommend 推荐表 + * @return 结果 + */ + @Override + public int updateRecommend(Recommend recommend) + { + return recommendMapper.updateRecommend(recommend); + } + + /** + * 批量删除推荐表 + * + * @param ids 需要删除的推荐表主键 + * @return 结果 + */ + @Override + public int deleteRecommendByIds(Long[] ids) + { + return recommendMapper.deleteRecommendByIds(ids); + } + + /** + * 删除推荐表信息 + * + * @param id 推荐表主键 + * @return 结果 + */ + @Override + public int deleteRecommendById(Long id) + { + return recommendMapper.deleteRecommendById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/RecommendMapper.xml b/ruoyi-system/src/main/resources/mapper/system/RecommendMapper.xml new file mode 100644 index 0000000..e7baef7 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/RecommendMapper.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + select id, tuijianname, tuijiannumber, tuijianyu, picture from recommend + + + + + + + + insert into recommend + + tuijianname, + tuijiannumber, + tuijianyu, + picture, + + + #{tuijianname}, + #{tuijiannumber}, + #{tuijianyu}, + #{picture}, + + + + + update recommend + + tuijianname = #{tuijianname}, + tuijiannumber = #{tuijiannumber}, + tuijianyu = #{tuijianyu}, + picture = #{picture}, + + where id = #{id} + + + + delete from recommend where id = #{id} + + + + delete from recommend where id in + + #{id} + + + \ No newline at end of file