导航图标相关接口

master
rong.liu 5 months ago
parent 40e4fd255f
commit b355a3cd9c
  1. 2872
      log/project_manager.2024-07-02.log
  2. 2
      src/main/java/com/huoran/iasf/controller/CategoryController.java
  3. 2
      src/main/java/com/huoran/iasf/controller/SysColumnController.java
  4. 2
      src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java
  5. 2
      src/main/java/com/huoran/iasf/controller/SysContentClassificationController.java
  6. 2
      src/main/java/com/huoran/iasf/controller/SysContentController.java
  7. 2
      src/main/java/com/huoran/iasf/controller/SysContentLabelController.java
  8. 85
      src/main/java/com/huoran/iasf/controller/SysNavigationIconController.java
  9. 2
      src/main/java/com/huoran/iasf/controller/SysNavigationStyleController.java
  10. 2
      src/main/java/com/huoran/iasf/controller/SysPageManagementController.java
  11. 2
      src/main/java/com/huoran/iasf/controller/SysProductDetailsController.java
  12. 89
      src/main/java/com/huoran/iasf/entity/SysNavigationIcon.java
  13. 21
      src/main/java/com/huoran/iasf/mapper/SysNavigationIconMapper.java
  14. 5
      src/main/java/com/huoran/iasf/mapper/xml/SysNavigationIconMapper.xml
  15. 22
      src/main/java/com/huoran/iasf/service/SysNavigationIconService.java
  16. 41
      src/main/java/com/huoran/iasf/service/impl/SysNavigationIconServiceImpl.java
  17. 12
      src/main/java/com/huoran/iasf/vo/req/SortOrderReq.java
  18. 4
      src/test/java/com/company/project/CodeGenerator.java

File diff suppressed because it is too large Load Diff

@ -25,7 +25,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/categoryService/Category") @RequestMapping("/categoryService/Category")
@Api(value = "产品与课程分类管理接口", tags = "A-产品与课程分类管理") @Api(value = "产品与课程分类管理接口", tags = "产品与课程分类管理")
public class CategoryController { public class CategoryController {
@Autowired @Autowired

@ -35,7 +35,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/sysColumn") @RequestMapping("/sysColumn")
@Api(value = "栏目基础信息:SysColumnController", tags = "R-栏目管理") @Api(value = "栏目基础信息:SysColumnController", tags = "栏目管理")
public class SysColumnController { public class SysColumnController {
@Autowired @Autowired

@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit;
*/ */
@RestController @RestController
@RequestMapping("/sysColumnLongPage") @RequestMapping("/sysColumnLongPage")
@Api(value = "长页栏目拓展表:SysColumnLongPageController", tags = "R-长页栏目拓展信息") @Api(value = "长页栏目拓展表:SysColumnLongPageController", tags = "长页栏目拓展信息")
public class SysColumnLongPageController { public class SysColumnLongPageController {
@Autowired @Autowired

@ -31,7 +31,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/content/classification") @RequestMapping("/content/classification")
@Api(value = "文章所属分类:SysContentClassificationController", tags = "R-文章所属分类") @Api(value = "文章所属分类:SysContentClassificationController", tags = "文章所属分类")
public class SysContentClassificationController { public class SysContentClassificationController {
@Autowired @Autowired

@ -40,7 +40,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/sysContent") @RequestMapping("/sysContent")
@Api(value = "文章管理:SysContentController", tags = "R-文章管理") @Api(value = "文章管理:SysContentController", tags = "文章管理")
public class SysContentController { public class SysContentController {
@Autowired @Autowired

@ -29,7 +29,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/content/label") @RequestMapping("/content/label")
@Api(value = "文章主题标签:SysContentLabelController", tags = "R-文章主题标签") @Api(value = "文章主题标签:SysContentLabelController", tags = "文章主题标签")
public class SysContentLabelController { public class SysContentLabelController {
@Autowired @Autowired

@ -0,0 +1,85 @@
package com.huoran.iasf.controller;
import com.huoran.iasf.common.utils.R;
import com.huoran.iasf.entity.SysNavigationIcon;
import com.huoran.iasf.service.SysNavigationIconService;
import com.huoran.iasf.vo.req.SortOrderReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @描述导航图标设置控制类
* @作者: Rong
* @日期: 2024-07-04
*/
@RestController
@RequestMapping("/SysNavigationIconService/SysNavigationIcon")
@Api(value = "导航图标设置:SysNavigationIconController", tags = "A-导航图标设置:导航图标设置")
public class SysNavigationIconController {
@Autowired
public SysNavigationIconService service;
/**
* 保存或更新导航图标设置记录
* 如果ID为空则执行保存操作如果ID有值则视为更新操作
*
* @param sysNavigationIcon 要保存或更新的导航图标设置对象
* @return R 结果对象包含操作状态信息
*/
@PostMapping("/saveOrUpdate")
@ApiOperation(value = "保存或更新导航图标设置记录", response = SysNavigationIcon.class)
public R saveOrUpdate(@RequestBody @ApiParam(name = "导航图标设置对象", value = "包含导航图标设置详细信息,若id不存在则新建,否则视为更新", required = true) SysNavigationIcon sysNavigationIcon) {
if (sysNavigationIcon.getId() == null) {
// 保存操作
boolean addState = service.save(sysNavigationIcon);
return addState ? R.success(sysNavigationIcon.getId()) : R.fail("新增失败");
} else {
// 更新操作
boolean updateState = service.updateById(sysNavigationIcon);
return updateState ? R.success() : R.fail("编辑失败");
}
}
@PostMapping("/updateSortOrder")
@ApiOperation(value = "批量更新导航图标的排序顺序", notes = "接收一个包含ID和对应排序值的列表")
public R updateSortOrder(@RequestBody List<SortOrderReq> sortOrderRequests) {
// 调用服务层方法来批量更新排序值
service.batchUpdateSortOrder(sortOrderRequests);
// 返回操作成功的结果
return R.success("排序顺序更新成功");
}
@PostMapping("/list")
@ApiOperation(value = "根据站点ID查询列表数据,可选过滤禁用状态", response = SysNavigationIcon.class, responseContainer = "List")
public R listSysNavigationIconsByCondition(@ApiParam(value = "站点ID", required = true) @RequestParam Integer siteId, @ApiParam(value = "禁用状态:0-启用,1-禁用,默认查询所有状态") @RequestParam(required = false) Integer isDisable) {
List<SysNavigationIcon> sysNavigationIcons = service.listBySiteIdAndStatus(siteId, isDisable);
return R.success(sysNavigationIcons);
}
@PostMapping("/findById")
@ApiOperation(value = "查询详情", response = SysNavigationIcon.class)
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
SysNavigationIcon sysNavigationIcon = service.getById(id);
return R.success(sysNavigationIcon);
}
@PostMapping("/batchDeletion")
@ApiOperation(value = "批量删除", response = SysNavigationIcon.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) {
boolean delState = service.removeByIds(ids);
return delState ? R.success() : R.fail("删除失败");
}
}

@ -28,7 +28,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/sysNavigationStyle") @RequestMapping("/sysNavigationStyle")
@Api(value = "导航样式配置:SysNavigationStyleController", tags = "R-导航样式配置") @Api(value = "导航样式配置:SysNavigationStyleController", tags = "导航样式配置")
public class SysNavigationStyleController { public class SysNavigationStyleController {
@Autowired @Autowired

@ -30,7 +30,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/pageManagement") @RequestMapping("/pageManagement")
@Api(value = "页面管理:SysPageManagementController", tags = "R-页面管理") @Api(value = "页面管理:SysPageManagementController", tags = "页面管理")
public class SysPageManagementController { public class SysPageManagementController {
@Autowired @Autowired

@ -31,7 +31,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/productDetails") @RequestMapping("/productDetails")
@Api(value = "A-综合产品与课程详情", tags = "A-综合产品与课程详情") @Api(value = "综合产品与课程详情", tags = "综合产品与课程详情")
@Slf4j @Slf4j
public class SysProductDetailsController { public class SysProductDetailsController {

@ -0,0 +1,89 @@
package com.huoran.iasf.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 导航图标设置
* </p>
*
* @author cheney
* @since 2024-07-04
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "SysNavigationIcon对象", description = "导航图标设置")
public class SysNavigationIcon implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "站点ID")
private Integer siteId;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "按钮文字")
private String buttonText;
@ApiModelProperty(value = "图标")
private String icon;
@ApiModelProperty(value = "按钮内容")
private String buttonContent;
@ApiModelProperty(value = "链接地址")
private String linkAddress;
@ApiModelProperty(value = "图片路径")
private String imagePath;
@ApiModelProperty(value = "设置内容类型:0-跳转链接,1-图片上传")
private Integer type;
@ApiModelProperty(value = "是否新开页面")
private Integer newTab;
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "更新时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
@ApiModelProperty(value = "创建人ID")
private Integer founderId;
@ApiModelProperty(value = "编辑人ID")
private Integer editorId;
@ApiModelProperty(value = "是否删除:1-未删除;0-已删除")
private Integer deleted;
@ApiModelProperty(value = "发布状态:0-草稿,1-已发布")
private Integer publishStatus;
@ApiModelProperty(value = "是否禁用:0-启用,1-禁用")
private Integer isDisable;
@ApiModelProperty(value = "排序顺序")
private Integer sortOrder;
}

@ -0,0 +1,21 @@
package com.huoran.iasf.mapper;
import com.huoran.iasf.entity.SysNavigationIcon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
/**
* <p>
* 导航图标设置 Mapper 接口
* </p>
*
* @author cheney
* @since 2024-07-04
*/
public interface SysNavigationIconMapper extends BaseMapper<SysNavigationIcon> {
// 更新单个记录的sort_order
@Update("UPDATE sys_navigation_icon SET sort_order = #{sortOrder} WHERE id = #{id}")
void updateSortOrder(@Param("id") Integer id, @Param("sortOrder") Integer sortOrder);
}

@ -0,0 +1,5 @@
<?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.huoran.iasf.mapper.SysNavigationIconMapper">
</mapper>

@ -0,0 +1,22 @@
package com.huoran.iasf.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.huoran.iasf.entity.SysNavigationIcon;
import com.huoran.iasf.vo.req.SortOrderReq;
import java.util.List;
/**
* <p>
* 导航图标设置 服务类
* </p>
*
* @author cheney
* @since 2024-07-04
*/
public interface SysNavigationIconService extends IService<SysNavigationIcon> {
List<SysNavigationIcon> listBySiteIdAndStatus(Integer siteId, Integer disableStatus);
void batchUpdateSortOrder(List<SortOrderReq> sortOrderRequests);
}

@ -0,0 +1,41 @@
package com.huoran.iasf.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huoran.iasf.entity.SysNavigationIcon;
import com.huoran.iasf.mapper.SysNavigationIconMapper;
import com.huoran.iasf.service.SysNavigationIconService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huoran.iasf.vo.req.SortOrderReq;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 导航图标设置 服务实现类
* </p>
*
* @author cheney
* @since 2024-07-04
*/
@Service
public class SysNavigationIconServiceImpl extends ServiceImpl<SysNavigationIconMapper, SysNavigationIcon> implements SysNavigationIconService {
@Override
public List<SysNavigationIcon> listBySiteIdAndStatus(Integer siteId, Integer disableStatus) {
QueryWrapper<SysNavigationIcon> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("site_id", siteId);
if (disableStatus != null) {
queryWrapper.eq("disable_status", disableStatus);
}
return this.list(queryWrapper);
}
@Override
public void batchUpdateSortOrder(List<SortOrderReq> sortOrderRequests) {
for (SortOrderReq request : sortOrderRequests) {
// 根据ID更新每个记录的sort_order字段
baseMapper.updateSortOrder(request.getId(), request.getSortOrder());
}
}
}

@ -0,0 +1,12 @@
package com.huoran.iasf.vo.req;
import lombok.Data;
@Data
/**
* 接收排序请求的数据结构
*/
public class SortOrderReq {
private Integer id;
private Integer sortOrder;
}

@ -61,9 +61,9 @@ public class CodeGenerator {
// 5、策略配置 // 5、策略配置
StrategyConfig strategy = new StrategyConfig(); StrategyConfig strategy = new StrategyConfig();
strategy.setInclude("s_discipline","s_professional","s_professional_class"); strategy.setInclude("sys_navigation_icon");
strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略 strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略
strategy.setTablePrefix("s"); //生成实体时去掉表前缀 //strategy.setTablePrefix("s"); //生成实体时去掉表前缀
strategy.setColumnNaming(NamingStrategy.underline_to_camel);//数据库表字段映射到实体的命名策略 strategy.setColumnNaming(NamingStrategy.underline_to_camel);//数据库表字段映射到实体的命名策略
strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作 strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作

Loading…
Cancel
Save