添加线路信息、绘图草稿数据及一些接口
This commit is contained in:
parent
2615bbf3d6
commit
1be24d9298
@ -0,0 +1,73 @@
|
||||
package club.joylink.xiannccda.controller;
|
||||
|
||||
import club.joylink.xiannccda.dto.DraftingQueryDto;
|
||||
import club.joylink.xiannccda.entity.Drafting;
|
||||
import club.joylink.xiannccda.entity.Drafting.Creation;
|
||||
import club.joylink.xiannccda.repository.IDraftingRepository;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 绘图草稿 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/drafting")
|
||||
@Tag(name = "绘图草稿管理接口")
|
||||
public class DraftingController {
|
||||
|
||||
final IDraftingRepository draftingRepository;
|
||||
|
||||
public DraftingController(IDraftingRepository draftingRepository) {
|
||||
this.draftingRepository = draftingRepository;
|
||||
}
|
||||
|
||||
@GetMapping("/paging")
|
||||
@SecurityRequirement(name = "jwt")
|
||||
@Operation(summary = "分页查询绘图草稿信息")
|
||||
@ApiResponse(description = "绘图草稿信息")
|
||||
public Page<Drafting> paging(DraftingQueryDto query) {
|
||||
return this.draftingRepository.pageQuery(query);
|
||||
}
|
||||
|
||||
@PostMapping("")
|
||||
@SecurityRequirement(name = "jwt")
|
||||
@Operation(summary = "创建绘图草稿")
|
||||
@ApiResponse(description = "绘图草稿信息")
|
||||
public Drafting create(@RequestBody @Validated(Creation.class) Drafting drafting) {
|
||||
return this.draftingRepository.create(drafting);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@SecurityRequirement(name = "jwt")
|
||||
@Operation(summary = "获取绘图草稿数据")
|
||||
@ApiResponse(description = "绘图草稿数据")
|
||||
public Drafting getById(@PathVariable Long id) {
|
||||
return this.draftingRepository.getById(id);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@SecurityRequirement(name = "jwt")
|
||||
@Operation(summary = "删除绘图草稿数据")
|
||||
@ApiResponse(description = "绘图草稿数据")
|
||||
public boolean deleteById(@PathVariable Long id) {
|
||||
return this.draftingRepository.removeById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package club.joylink.xiannccda.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/lineInfo")
|
||||
public class LineInfoController {
|
||||
|
||||
}
|
@ -5,14 +5,10 @@ import club.joylink.xiannccda.entity.User;
|
||||
import club.joylink.xiannccda.entity.User.Register;
|
||||
import club.joylink.xiannccda.service.UserService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.util.List;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -28,7 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/user")
|
||||
@Tag(name = "用户管理接口", description = "用户管理接口描述")
|
||||
@Tag(name = "用户管理接口")
|
||||
public class UserController {
|
||||
|
||||
private UserService userService;
|
||||
|
@ -0,0 +1,5 @@
|
||||
package club.joylink.xiannccda.dto;
|
||||
|
||||
public class DraftingDto {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package club.joylink.xiannccda.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DraftingQueryDto extends PageDTO {
|
||||
|
||||
@Schema(description = "草稿图名称")
|
||||
String name;
|
||||
|
||||
}
|
@ -12,8 +12,8 @@ import lombok.Setter;
|
||||
@Schema(name = "登录信息")
|
||||
public class LoginInfoDto {
|
||||
|
||||
@Schema(description = "账号", defaultValue = "19999999999")
|
||||
@Schema(description = "账号", defaultValue = "17791995809")
|
||||
String account;
|
||||
@Schema(description = "密码", defaultValue = "123456")
|
||||
@Schema(description = "密码", defaultValue = "95129dbaace576e46f41a629e6f35d5c")
|
||||
String password;
|
||||
}
|
||||
|
56
src/main/java/club/joylink/xiannccda/entity/Drafting.java
Normal file
56
src/main/java/club/joylink/xiannccda/entity/Drafting.java
Normal file
@ -0,0 +1,56 @@
|
||||
package club.joylink.xiannccda.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 绘图草稿
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@Schema(name = "Drafting", description = "$!{table.comment}")
|
||||
public class Drafting {
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "草稿图名称")
|
||||
@NotBlank(message = "草稿图名称不能为空", groups = {Creation.class})
|
||||
private String name;
|
||||
|
||||
@Schema(description = "绘图数据")
|
||||
private byte[] proto;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateAt;
|
||||
|
||||
public static final String ID = "id";
|
||||
|
||||
public static final String NAME = "name";
|
||||
|
||||
public static final String PROTO = "proto";
|
||||
|
||||
public static final String CREATED_AT = "created_at";
|
||||
|
||||
public static final String UPDATE_AT = "update_at";
|
||||
|
||||
public interface Creation {
|
||||
|
||||
}
|
||||
}
|
57
src/main/java/club/joylink/xiannccda/entity/LineInfo.java
Normal file
57
src/main/java/club/joylink/xiannccda/entity/LineInfo.java
Normal file
@ -0,0 +1,57 @@
|
||||
package club.joylink.xiannccda.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("line_info")
|
||||
@Schema(name = "LineInfo", description = "$!{table.comment}")
|
||||
public class LineInfo {
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "线路名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "线路号")
|
||||
private Integer lineId;
|
||||
|
||||
@Schema(description = "线路配置")
|
||||
private String config;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateAt;
|
||||
|
||||
public static final String ID = "id";
|
||||
|
||||
public static final String NAME = "name";
|
||||
|
||||
public static final String LINE_ID = "line_id";
|
||||
|
||||
public static final String CONFIG = "config";
|
||||
|
||||
public static final String CREATED_AT = "created_at";
|
||||
|
||||
public static final String UPDATE_AT = "update_at";
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package club.joylink.xiannccda.mapper;
|
||||
|
||||
import club.joylink.xiannccda.entity.Drafting;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 绘图草稿 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@Mapper
|
||||
public interface DraftingMapper extends BaseMapper<Drafting> {
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package club.joylink.xiannccda.mapper;
|
||||
|
||||
import club.joylink.xiannccda.entity.LineInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@Mapper
|
||||
public interface LineInfoMapper extends BaseMapper<LineInfo> {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?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="club.joylink.xiannccda.mapper.DraftingMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="club.joylink.xiannccda.entity.Drafting">
|
||||
<id column="id" property="id" />
|
||||
<result column="name" property="name" />
|
||||
<result column="proto" property="proto" />
|
||||
<result column="created_at" property="createdAt" />
|
||||
<result column="update_at" property="updateAt" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, name, proto, created_at, update_at
|
||||
</sql>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,20 @@
|
||||
<?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="club.joylink.xiannccda.mapper.LineInfoMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="club.joylink.xiannccda.entity.LineInfo">
|
||||
<id column="id" property="id" />
|
||||
<result column="name" property="name" />
|
||||
<result column="line_id" property="lineId" />
|
||||
<result column="config" property="config" />
|
||||
<result column="created_at" property="createdAt" />
|
||||
<result column="update_at" property="updateAt" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, name, line_id, config, created_at, update_at
|
||||
</sql>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,27 @@
|
||||
package club.joylink.xiannccda.repository;
|
||||
|
||||
import club.joylink.xiannccda.dto.DraftingQueryDto;
|
||||
import club.joylink.xiannccda.entity.Drafting;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 绘图草稿 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
public interface IDraftingRepository extends IService<Drafting> {
|
||||
|
||||
/**
|
||||
* 分页查询绘图数据
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
Page<Drafting> pageQuery(DraftingQueryDto query);
|
||||
|
||||
Drafting create(Drafting drafting);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package club.joylink.xiannccda.repository;
|
||||
|
||||
import club.joylink.xiannccda.entity.LineInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
public interface ILineInfoRepository extends IService<LineInfo> {
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package club.joylink.xiannccda.repository.impl;
|
||||
|
||||
import club.joylink.xiannccda.dto.DraftingQueryDto;
|
||||
import club.joylink.xiannccda.entity.Drafting;
|
||||
import club.joylink.xiannccda.mapper.DraftingMapper;
|
||||
import club.joylink.xiannccda.repository.IDraftingRepository;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 绘图草稿 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DraftingRepository extends ServiceImpl<DraftingMapper, Drafting> implements
|
||||
IDraftingRepository {
|
||||
|
||||
@Override
|
||||
public Page<Drafting> pageQuery(DraftingQueryDto query) {
|
||||
log.info("分页查询参数: {},{},{}", query.getCurrent(), query.getSize(), query.getName());
|
||||
LambdaQueryWrapper<Drafting> wrapper = Wrappers.lambdaQuery();
|
||||
// 分页不查询具体proto数据
|
||||
wrapper.select(info -> !info.getColumn().equals("proto"));
|
||||
if (StringUtils.hasText(query.getName())) {
|
||||
wrapper.like(Drafting::getName, query.getName());
|
||||
}
|
||||
DraftingQueryDto page = this.page(query, wrapper);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drafting create(Drafting drafting) {
|
||||
drafting.setCreatedAt(LocalDateTime.now());
|
||||
this.save(drafting);
|
||||
return drafting;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package club.joylink.xiannccda.repository.impl;
|
||||
|
||||
import club.joylink.xiannccda.entity.LineInfo;
|
||||
import club.joylink.xiannccda.mapper.LineInfoMapper;
|
||||
import club.joylink.xiannccda.repository.ILineInfoRepository;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@Service
|
||||
public class LineInfoRepository extends ServiceImpl<LineInfoMapper, LineInfo> implements ILineInfoRepository {
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package club.joylink.xiannccda.occmock;
|
||||
|
||||
public class OccServer {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user