lyhzzz 3 лет назад
Родитель
Сommit
ce49da8028

+ 59 - 0
src/main/java/com/fdkankan/fusion/controller/FusionGuideController.java

@@ -0,0 +1,59 @@
+package com.fdkankan.fusion.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.fusion.entity.FusionGuide;
+import com.fdkankan.fusion.exception.BusinessException;
+import com.fdkankan.fusion.service.IFusionGuideService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2022-08-11
+ */
+@RestController
+@RequestMapping("/fusionGuide")
+public class FusionGuideController {
+
+    @Autowired
+    IFusionGuideService fusionGuideService;
+
+    @GetMapping("/allList")
+    public ResultData allList(@RequestParam(required = false) Integer fusionId){
+        return ResultData.ok(fusionGuideService.getAllList(fusionId));
+    }
+
+    @PostMapping("/add")
+    public ResultData add(@RequestBody FusionGuide fusionGuide){
+        fusionGuideService.add(fusionGuide);
+        return ResultData.ok();
+    }
+    @PostMapping("/updateSort")
+    public ResultData updateSort(@RequestBody FusionGuide fusionGuide){
+        if(fusionGuide.getFusionGuideId() == null || fusionGuide.getSort() == null){
+            throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        LambdaUpdateWrapper<FusionGuide> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(FusionGuide::getFusionGuideId,fusionGuide.getFusionGuideId());
+        wrapper.set(FusionGuide::getSort,fusionGuide.getSort());
+        fusionGuideService.update(wrapper);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/delete")
+    public ResultData delete(@RequestBody FusionGuide fusionGuide){
+        if(fusionGuide.getFusionGuideId() == null){
+            throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        fusionGuideService.removeById(fusionGuide.getFusionGuideId());
+        return ResultData.ok();
+    }
+}
+

+ 75 - 0
src/main/java/com/fdkankan/fusion/entity/FusionGuide.java

@@ -0,0 +1,75 @@
+package com.fdkankan.fusion.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2022-08-11
+ */
+@Getter
+@Setter
+@TableName("t_fusion_guide")
+public class FusionGuide implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 融合场景导览,路线
+     */
+    @TableId(value = "fusion_guide_id", type = IdType.AUTO)
+    private Integer fusionGuideId;
+
+    /**
+     * 融合场景id
+     */
+    @TableField("fusion_id")
+    private Integer fusionId;
+
+    /**
+     * 位置
+     */
+    @TableField("position")
+    private String position;
+
+    /**
+     * 持续时间 秒
+     */
+    @TableField("time")
+    private Integer time;
+
+    /**
+     * 速度 m/s
+     */
+    @TableField("speed")
+    private Double speed;
+
+    /**
+     * 排序
+     */
+    @TableField("sort")
+    private Long sort;
+
+    @TableField("tb_status")
+    @TableLogic
+    private Integer tbStatus;
+
+    @TableField("create_time")
+    private String createTime;
+
+    @TableField("update_time")
+    private String updateTime;
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/fusion/generate/AutoGenerate.java

@@ -18,7 +18,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir") ;
 
         generate(path,"fusion", getTables(new String[]{
-                "t_case_video_folder",
+                "t_fusion_guide",
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 18 - 0
src/main/java/com/fdkankan/fusion/mapper/IFusionGuideMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.fusion.mapper;
+
+import com.fdkankan.fusion.entity.FusionGuide;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2022-08-11
+ */
+@Mapper
+public interface IFusionGuideMapper extends BaseMapper<FusionGuide> {
+
+}

+ 23 - 0
src/main/java/com/fdkankan/fusion/service/IFusionGuideService.java

@@ -0,0 +1,23 @@
+package com.fdkankan.fusion.service;
+
+import com.fdkankan.fusion.entity.FusionGuide;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2022-08-11
+ */
+public interface IFusionGuideService extends IService<FusionGuide> {
+
+    List<FusionGuide> getAllList(Integer fusionId);
+
+    void add(FusionGuide fusionGuide);
+
+    Long getCountByFusionId(Integer fusionId);
+}

+ 52 - 0
src/main/java/com/fdkankan/fusion/service/impl/FusionGuideServiceImpl.java

@@ -0,0 +1,52 @@
+package com.fdkankan.fusion.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.fusion.entity.FusionGuide;
+import com.fdkankan.fusion.mapper.IFusionGuideMapper;
+import com.fdkankan.fusion.service.IFusionGuideService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2022-08-11
+ */
+@Service
+public class FusionGuideServiceImpl extends ServiceImpl<IFusionGuideMapper, FusionGuide> implements IFusionGuideService {
+
+    @Override
+    public List<FusionGuide> getAllList(Integer fusionId) {
+        LambdaQueryWrapper<FusionGuide> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(FusionGuide::getFusionId,fusionId);
+        wrapper.orderByAsc(FusionGuide::getSort);
+        wrapper.orderByAsc(FusionGuide::getCreateTime);
+        return this.list(wrapper);
+    }
+
+    @Override
+    public Long getCountByFusionId(Integer fusionId) {
+        LambdaQueryWrapper<FusionGuide> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(FusionGuide::getFusionId,fusionId);
+        return this.count(wrapper);
+    }
+
+    @Override
+    public void add(FusionGuide fusionGuide) {
+        if(fusionGuide.getFusionId() == null || StringUtils.isEmpty(fusionGuide.getPosition())
+            || fusionGuide.getTime() == null || fusionGuide.getSpeed() == null){
+
+        }
+        Long count = this.getCountByFusionId(fusionGuide.getFusionId());
+        fusionGuide.setSort(count + 1);
+        this.save(fusionGuide);
+    }
+
+
+}

+ 5 - 0
src/main/resources/mapper/fusion/FusionGuideMapper.xml

@@ -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.fdkankan.fusion.mapper.IFusionGuideMapper">
+
+</mapper>