Compare commits
4 Commits
e96c54c328
...
23511407ab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23511407ab | ||
|
|
ecfe64c188 | ||
|
|
58f512df4a | ||
|
|
77c1155b38 |
@@ -34,6 +34,8 @@ dependencies {
|
|||||||
implementation 'com.baomidou:mybatis-plus-generator' // 代码生成器
|
implementation 'com.baomidou:mybatis-plus-generator' // 代码生成器
|
||||||
implementation("com.baomidou:mybatis-plus-jsqlparser") // SQL 解析器
|
implementation("com.baomidou:mybatis-plus-jsqlparser") // SQL 解析器
|
||||||
implementation 'cn.dev33:sa-token-spring-boot-starter:1.44.0' // 权限认证
|
implementation 'cn.dev33:sa-token-spring-boot-starter:1.44.0' // 权限认证
|
||||||
|
implementation 'cn.dev33:sa-token-redis-template:1.44.0' // Sa-Token 整合 RedisTemplate
|
||||||
|
implementation 'org.apache.commons:commons-pool2' // 提供 Redis 连接池
|
||||||
implementation 'com.alibaba:druid-spring-boot-starter:1.2.27' // 数据库连接池
|
implementation 'com.alibaba:druid-spring-boot-starter:1.2.27' // 数据库连接池
|
||||||
implementation 'org.lionsoul:ip2region:2.7.0' // IP 归属地
|
implementation 'org.lionsoul:ip2region:2.7.0' // IP 归属地
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' // mongodb
|
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' // mongodb
|
||||||
@@ -43,7 +45,12 @@ dependencies {
|
|||||||
annotationProcessor 'org.projectlombok:lombok' // Lombok 注解处理
|
annotationProcessor 'org.projectlombok:lombok' // Lombok 注解处理
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test' // 测试框架
|
testImplementation 'org.springframework.boot:spring-boot-starter-test' // 测试框架
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' // thymeleaf模版引擎
|
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' // thymeleaf模版引擎
|
||||||
implementation 'com.aliyun.oss:aliyun-sdk-oss:3.18.1' // OSS SDK
|
implementation 'com.aliyun.oss:aliyun-sdk-oss:3.18.3' // OSS SDK
|
||||||
|
implementation 'cn.hutool:hutool-all:5.8.40' // hutool工具包
|
||||||
|
implementation 'io.springfox:springfox-swagger2:2.10.5'
|
||||||
|
implementation 'com.github.xiaoymin:knife4j-openapi2-spring-boot-starter:4.4.0'
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('test') {
|
tasks.named('test') {
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.corewing.app.common.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用删除标志枚举
|
||||||
|
*
|
||||||
|
* @author xuyuxiang
|
||||||
|
* @date 2021/10/11 14:02
|
||||||
|
**/
|
||||||
|
@Getter
|
||||||
|
public enum CommonDeleteFlagEnum {
|
||||||
|
|
||||||
|
/** 未删除 */
|
||||||
|
NOT_DELETE,
|
||||||
|
|
||||||
|
/** 已删除 */
|
||||||
|
DELETED
|
||||||
|
}
|
||||||
@@ -4,7 +4,9 @@ import cn.dev33.satoken.interceptor.SaInterceptor;
|
|||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.corewing.app.common.page.PageInterceptor;
|
import com.corewing.app.common.page.PageInterceptor;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.util.ResourceUtils;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,8 +42,9 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
|||||||
// .excludePathPatterns("/loading.html", "/admin/login.html")
|
// .excludePathPatterns("/loading.html", "/admin/login.html")
|
||||||
// 排除静态资源
|
// 排除静态资源
|
||||||
.excludePathPatterns("/", "/*.css", "/*.js", "/*.ico", "/static/**", "/assets/**")
|
.excludePathPatterns("/", "/*.css", "/*.js", "/*.ico", "/static/**", "/assets/**")
|
||||||
// 排除后台管理静态资源
|
// 排除接口静态资源
|
||||||
// .excludePathPatterns("/admin/**")
|
.excludePathPatterns("/doc.html", "/webjars/**")
|
||||||
|
.excludePathPatterns("/v3/api-docs/swagger-config", "/v3/api-docs/**", "/swagger-resources")
|
||||||
// 排除 Druid 监控
|
// 排除 Druid 监控
|
||||||
.excludePathPatterns("/druid/**")
|
.excludePathPatterns("/druid/**")
|
||||||
// 排除错误页面
|
// 排除错误页面
|
||||||
@@ -51,4 +54,10 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
|||||||
// 排除咨询接口
|
// 排除咨询接口
|
||||||
.excludePathPatterns("/contactMsg", "/contactMsg/**");
|
.excludePathPatterns("/contactMsg", "/contactMsg/**");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
|
registry.addResourceHandler("doc.html").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/META-INF/resources/");
|
||||||
|
registry.addResourceHandler("/webjars/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/META-INF/resources/webjars/");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelCategoryListRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "搜索参数(分类名称)")
|
||||||
|
private String searchKey;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelCategoryPageRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "搜索参数(分类名称)")
|
||||||
|
private String searchKey;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelCreateRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型标题", required = true)
|
||||||
|
@NotBlank(message = "模型标题不能为空")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型描述", required = true)
|
||||||
|
@NotBlank(message = "模型描述不能为空")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型分类id", required = true)
|
||||||
|
@NotBlank(message = "模型分类id不能为空")
|
||||||
|
private String categoryId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型封面", required = true)
|
||||||
|
@NotBlank(message = "模型封面不能为空")
|
||||||
|
private String coverImage;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注", required = false)
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty("模型文件")
|
||||||
|
@NotNull(message = "模型文件不能为空")
|
||||||
|
private List<MultipartFile> files;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelDownloadLogListRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型标题", required = false)
|
||||||
|
private String searchKey;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelDownloadLogPageRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型标题", required = false)
|
||||||
|
private String searchKey;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelDownloadRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型id", required = true)
|
||||||
|
@NotBlank(message = "模型id不能为空")
|
||||||
|
private String modelId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelFavoriteListRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型标题", required = false)
|
||||||
|
private String searchKey;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelFavoritePageRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型标题", required = false)
|
||||||
|
private String searchKey;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelFavoriteRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型id", required = true)
|
||||||
|
@NotBlank(message = "模型id不能为空")
|
||||||
|
private String modelId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelIdRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型id", required = true)
|
||||||
|
@NotBlank(message = "模型Id不能为空")
|
||||||
|
private String modelId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelLikeRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型id", required = true)
|
||||||
|
@NotBlank(message = "模型id不能为空")
|
||||||
|
private String modelId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelListRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "搜索参数(模型标题)")
|
||||||
|
private String searchKey;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型状态(1正常 0下架 2审核中)")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型公布状态(1公开 0私有)")
|
||||||
|
private String isPublic;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分类id")
|
||||||
|
private String categoryId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.corewing.app.dto.AppModel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ModelPageRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "搜索参数(模型标题)")
|
||||||
|
private String searchKey;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型状态(1正常 0下架 2审核中)")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模型公布状态(1公开 0私有)")
|
||||||
|
private String isPublic;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分类id")
|
||||||
|
private String categoryId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.corewing.app.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class ModelPageRequest {
|
|
||||||
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
private String searchKey;
|
|
||||||
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.corewing.app.entity;
|
package com.corewing.app.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@@ -7,6 +8,8 @@ import com.corewing.app.common.base.CommonEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@TableName("app_model")
|
@TableName("app_model")
|
||||||
@@ -40,7 +43,13 @@ public class AppModel extends CommonEntity {
|
|||||||
private String extJson;
|
private String extJson;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private AppModelFile modelFile;
|
private List<AppModelFile> modelFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类名称
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String categoryTitle;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.corewing.app.entity;
|
package com.corewing.app.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.corewing.app.common.base.CommonEntity;
|
import com.corewing.app.common.base.CommonEntity;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.corewing.app.entity;
|
package com.corewing.app.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.corewing.app.common.base.CommonEntity;
|
import com.corewing.app.common.base.CommonEntity;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.corewing.app.entity;
|
package com.corewing.app.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.corewing.app.common.base.CommonEntity;
|
import com.corewing.app.common.base.CommonEntity;
|
||||||
@@ -14,7 +15,7 @@ public class AppModelFavorite extends CommonEntity {
|
|||||||
@TableId
|
@TableId
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
private String userId;
|
private Long userId;
|
||||||
|
|
||||||
private String modelId;
|
private String modelId;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package com.corewing.app.handler;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.util.EnumUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import com.corewing.app.common.enums.CommonDeleteFlagEnum;
|
||||||
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
|
import org.apache.ibatis.reflection.ReflectionException;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MyBatis-Plus 自动填充处理器
|
||||||
|
* 用于自动填充创建时间和更新时间
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class CustomMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
|
/** 删除标志 */
|
||||||
|
private static final String DELETE_FLAG = "deleteFlag";
|
||||||
|
|
||||||
|
/** 创建人 */
|
||||||
|
private static final String CREATE_USER = "createUser";
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
private static final String CREATE_TIME = "createTime";
|
||||||
|
|
||||||
|
/** 更新人 */
|
||||||
|
private static final String UPDATE_USER = "updateUser";
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
private static final String UPDATE_TIME = "updateTime";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertFill(MetaObject metaObject) {
|
||||||
|
try {
|
||||||
|
//为空则设置deleteFlag
|
||||||
|
Object deleteFlag = metaObject.getValue(DELETE_FLAG);
|
||||||
|
if (ObjectUtil.isNull(deleteFlag)) {
|
||||||
|
setFieldValByName(DELETE_FLAG, EnumUtil.toString(CommonDeleteFlagEnum.NOT_DELETE), metaObject);
|
||||||
|
}
|
||||||
|
} catch (ReflectionException ignored) { }
|
||||||
|
try {
|
||||||
|
//为空则设置createUser
|
||||||
|
Object createUser = metaObject.getValue(CREATE_USER);
|
||||||
|
if (ObjectUtil.isNull(createUser)) {
|
||||||
|
setFieldValByName(CREATE_USER, this.getUserId(), metaObject);
|
||||||
|
}
|
||||||
|
} catch (ReflectionException ignored) { }
|
||||||
|
try {
|
||||||
|
//为空则设置createTime
|
||||||
|
Object createTime = metaObject.getValue(CREATE_TIME);
|
||||||
|
if (ObjectUtil.isNull(createTime)) {
|
||||||
|
setFieldValByName(CREATE_TIME, DateTime.now(), metaObject);
|
||||||
|
}
|
||||||
|
} catch (ReflectionException ignored) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFill(MetaObject metaObject) {
|
||||||
|
try {
|
||||||
|
//设置updateUser
|
||||||
|
setFieldValByName(UPDATE_USER, this.getUserId(), metaObject);
|
||||||
|
} catch (ReflectionException ignored) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
//设置updateTime
|
||||||
|
setFieldValByName(UPDATE_TIME, DateTime.now(), metaObject);
|
||||||
|
} catch (ReflectionException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户id
|
||||||
|
*/
|
||||||
|
private String getUserId() {
|
||||||
|
try {
|
||||||
|
String loginId = StpUtil.getLoginIdAsString();
|
||||||
|
if (ObjectUtil.isNotEmpty(loginId)) {
|
||||||
|
return loginId;
|
||||||
|
} else {
|
||||||
|
return "-1";
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "-1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.corewing.app.handler;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
|
||||||
import org.apache.ibatis.reflection.MetaObject;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MyBatis-Plus 自动填充处理器
|
|
||||||
* 用于自动填充创建时间和更新时间
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class MyMetaObjectHandler implements MetaObjectHandler {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入时的填充策略
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void insertFill(MetaObject metaObject) {
|
|
||||||
// 自动填充创建时间
|
|
||||||
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
|
|
||||||
// 自动填充更新时间
|
|
||||||
this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时的填充策略
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void updateFill(MetaObject metaObject) {
|
|
||||||
// 自动填充更新时间
|
|
||||||
this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.corewing.app.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.corewing.app.dto.AppModel.ModelCategoryListRequest;
|
||||||
|
import com.corewing.app.dto.AppModel.ModelCategoryPageRequest;
|
||||||
|
import com.corewing.app.entity.AppModelCategory;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AppModelCategoryMapper extends BaseMapper<AppModelCategory> {
|
||||||
|
Page<AppModelCategory> page(Page<AppModelCategory> page, @Param("modelCategoryPageRequest") ModelCategoryPageRequest modelCategoryPageRequest);
|
||||||
|
|
||||||
|
List<AppModelCategory> list(@Param("modelCategoryListRequest") ModelCategoryListRequest modelCategoryListRequest);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.corewing.app.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.corewing.app.entity.AppModelDownloadLog;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AppModelDownloadLogMapper extends BaseMapper<AppModelDownloadLog> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.corewing.app.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.corewing.app.entity.AppModelFavorite;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AppModelFavoriteMapper extends BaseMapper<AppModelFavorite> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.corewing.app.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.corewing.app.entity.AppModelFile;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AppModelFileMapper extends BaseMapper<AppModelFile> {
|
||||||
|
}
|
||||||
28
src/main/java/com/corewing/app/mapper/AppModelMapper.java
Normal file
28
src/main/java/com/corewing/app/mapper/AppModelMapper.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.corewing.app.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.corewing.app.dto.AppModel.*;
|
||||||
|
import com.corewing.app.entity.AppModel;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AppModelMapper extends BaseMapper<AppModel> {
|
||||||
|
|
||||||
|
Page<AppModel> page(Page<AppModel> page, @Param("modelPageRequest") ModelPageRequest modelPageRequest);
|
||||||
|
|
||||||
|
List<AppModel> list(@Param("modelPageRequest") ModelListRequest modelListRequest);
|
||||||
|
|
||||||
|
AppModel getModelById(@Param("modelId") String modelId);
|
||||||
|
|
||||||
|
List<AppModel> favoriteList(@Param("userId") Long userId, @Param("modelFavoriteListRequest") ModelFavoriteListRequest modelFavoriteListRequest);
|
||||||
|
|
||||||
|
Page<AppModel> favoritePage(Page<AppModel> page, @Param("userId") Long userId, @Param("modelFavoritePageRequest") ModelFavoritePageRequest modelFavoritePageRequest);
|
||||||
|
|
||||||
|
List<AppModel> downloadLogList(@Param("userId") Long userId, @Param("modelDownloadLogListRequest") ModelDownloadLogListRequest modelDownloadLogListRequest);
|
||||||
|
|
||||||
|
Page<AppModel> downloadLogPage(Page<AppModel> page, @Param("userId") Long userId, @Param("modelDownloadLogPageRequest") ModelDownloadLogPageRequest modelDownloadLogPageRequest);
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ package com.corewing.app.modules.app;
|
|||||||
import com.corewing.app.common.Result;
|
import com.corewing.app.common.Result;
|
||||||
import com.corewing.app.entity.ContactMsg;
|
import com.corewing.app.entity.ContactMsg;
|
||||||
import com.corewing.app.service.ContactMsgService;
|
import com.corewing.app.service.ContactMsgService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -10,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Api(tags = "官网反馈消息接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/contactMsg")
|
@RequestMapping("/contactMsg")
|
||||||
public class AppContactMsgController {
|
public class AppContactMsgController {
|
||||||
@@ -17,6 +20,7 @@ public class AppContactMsgController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ContactMsgService contactMsgService;
|
private ContactMsgService contactMsgService;
|
||||||
|
|
||||||
|
@ApiOperation("消息保存接口")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public Result<String> save(@RequestBody ContactMsg contactMsg) {
|
public Result<String> save(@RequestBody ContactMsg contactMsg) {
|
||||||
return Result.isBool(contactMsgService.save(contactMsg));
|
return Result.isBool(contactMsgService.save(contactMsg));
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import com.corewing.app.util.DingTalkUtil;
|
|||||||
import com.corewing.app.util.I18nUtil;
|
import com.corewing.app.util.I18nUtil;
|
||||||
import com.corewing.app.util.Ip2RegionUtil;
|
import com.corewing.app.util.Ip2RegionUtil;
|
||||||
import com.corewing.app.util.IpUtil;
|
import com.corewing.app.util.IpUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -21,6 +23,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 问题反馈 Controller
|
* 问题反馈 Controller
|
||||||
*/
|
*/
|
||||||
|
@Api(tags = "问题反馈接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/feedback")
|
@RequestMapping("/feedback")
|
||||||
public class AppFeedbackController {
|
public class AppFeedbackController {
|
||||||
@@ -38,6 +41,7 @@ public class AppFeedbackController {
|
|||||||
/**
|
/**
|
||||||
* 创建反馈(支持匿名提交)
|
* 创建反馈(支持匿名提交)
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("创建反馈")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result<String> create(@RequestBody FeedbackRequest request, HttpServletRequest httpRequest) {
|
public Result<String> create(@RequestBody FeedbackRequest request, HttpServletRequest httpRequest) {
|
||||||
try {
|
try {
|
||||||
@@ -75,6 +79,7 @@ public class AppFeedbackController {
|
|||||||
/**
|
/**
|
||||||
* 查询当前用户的反馈列表
|
* 查询当前用户的反馈列表
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("查询当前用户的反馈列表")
|
||||||
@GetMapping("/my")
|
@GetMapping("/my")
|
||||||
public Result<List<Feedback>> getMyFeedbackList() {
|
public Result<List<Feedback>> getMyFeedbackList() {
|
||||||
try {
|
try {
|
||||||
@@ -90,6 +95,7 @@ public class AppFeedbackController {
|
|||||||
/**
|
/**
|
||||||
* 根据ID查询反馈详情
|
* 根据ID查询反馈详情
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据id查询反馈详情")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public Result<Feedback> getById(@PathVariable Long id) {
|
public Result<Feedback> getById(@PathVariable Long id) {
|
||||||
try {
|
try {
|
||||||
@@ -112,6 +118,7 @@ public class AppFeedbackController {
|
|||||||
* @param feedbackType 问题类型(可选)
|
* @param feedbackType 问题类型(可选)
|
||||||
* @param status 状态(可选)
|
* @param status 状态(可选)
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("分页查询反馈列表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public Result<IPage<Feedback>> getPageList(
|
public Result<IPage<Feedback>> getPageList(
|
||||||
@RequestParam(defaultValue = "1") Long current,
|
@RequestParam(defaultValue = "1") Long current,
|
||||||
@@ -131,6 +138,7 @@ public class AppFeedbackController {
|
|||||||
/**
|
/**
|
||||||
* 更新反馈状态
|
* 更新反馈状态
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("更新反馈状态")
|
||||||
@PutMapping("/{id}/status")
|
@PutMapping("/{id}/status")
|
||||||
public Result<String> updateStatus(@PathVariable Long id, @RequestParam Integer status) {
|
public Result<String> updateStatus(@PathVariable Long id, @RequestParam Integer status) {
|
||||||
try {
|
try {
|
||||||
@@ -147,6 +155,7 @@ public class AppFeedbackController {
|
|||||||
/**
|
/**
|
||||||
* 删除反馈
|
* 删除反馈
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("删除反馈")
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public Result<String> delete(@PathVariable Long id) {
|
public Result<String> delete(@PathVariable Long id) {
|
||||||
try {
|
try {
|
||||||
@@ -163,6 +172,7 @@ public class AppFeedbackController {
|
|||||||
/**
|
/**
|
||||||
* 测试钉钉推送
|
* 测试钉钉推送
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("测试钉钉推送")
|
||||||
@GetMapping("/test-dingtalk")
|
@GetMapping("/test-dingtalk")
|
||||||
public Result<String> testDingTalk() {
|
public Result<String> testDingTalk() {
|
||||||
try {
|
try {
|
||||||
@@ -184,6 +194,7 @@ public class AppFeedbackController {
|
|||||||
/**
|
/**
|
||||||
* 发送反馈信息到钉钉
|
* 发送反馈信息到钉钉
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("发送反馈信息到钉钉")
|
||||||
private void sendFeedbackToDingTalk(Feedback feedback, String submitIp, String submitRegion) {
|
private void sendFeedbackToDingTalk(Feedback feedback, String submitIp, String submitRegion) {
|
||||||
try {
|
try {
|
||||||
String title = I18nUtil.getMessage("dingtalk.feedback.title");
|
String title = I18nUtil.getMessage("dingtalk.feedback.title");
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.corewing.app.modules.app;
|
|||||||
import com.corewing.app.common.Result;
|
import com.corewing.app.common.Result;
|
||||||
import com.corewing.app.entity.FeedbackLog;
|
import com.corewing.app.entity.FeedbackLog;
|
||||||
import com.corewing.app.service.FeedbackLogService;
|
import com.corewing.app.service.FeedbackLogService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -13,6 +15,7 @@ import javax.annotation.Resource;
|
|||||||
/**
|
/**
|
||||||
* 上传日志接口控制器
|
* 上传日志接口控制器
|
||||||
*/
|
*/
|
||||||
|
@Api(tags = "反馈日志接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/feedback_log")
|
@RequestMapping("/feedback_log")
|
||||||
public class AppFeedbackLogController {
|
public class AppFeedbackLogController {
|
||||||
@@ -25,6 +28,7 @@ public class AppFeedbackLogController {
|
|||||||
* @param feedbackLog
|
* @param feedbackLog
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("上传日志")
|
||||||
@PostMapping("/uploadFeedbackLog")
|
@PostMapping("/uploadFeedbackLog")
|
||||||
public Result<String> uploadFeedbackLog(MultipartFile file, FeedbackLog feedbackLog) {
|
public Result<String> uploadFeedbackLog(MultipartFile file, FeedbackLog feedbackLog) {
|
||||||
return Result.isBool(feedbackLogService.uploadFeedbackLog(file, feedbackLog));
|
return Result.isBool(feedbackLogService.uploadFeedbackLog(file, feedbackLog));
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ import com.corewing.app.common.Result;
|
|||||||
import com.corewing.app.entity.Firmware;
|
import com.corewing.app.entity.Firmware;
|
||||||
import com.corewing.app.service.FirmwareService;
|
import com.corewing.app.service.FirmwareService;
|
||||||
import com.corewing.app.util.I18nUtil;
|
import com.corewing.app.util.I18nUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 固件 Controller
|
* 固件 Controller
|
||||||
*/
|
*/
|
||||||
|
@Api(tags = "固件接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/firmware")
|
@RequestMapping("/firmware")
|
||||||
public class AppFirmwareController {
|
public class AppFirmwareController {
|
||||||
@@ -26,6 +29,7 @@ public class AppFirmwareController {
|
|||||||
/**
|
/**
|
||||||
* 根据ID查询固件
|
* 根据ID查询固件
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据id查询固件")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public Result<Firmware> getById(@PathVariable Long id) {
|
public Result<Firmware> getById(@PathVariable Long id) {
|
||||||
Firmware firmware = firmwareService.getById(id);
|
Firmware firmware = firmwareService.getById(id);
|
||||||
@@ -43,6 +47,7 @@ public class AppFirmwareController {
|
|||||||
* @param firmwareName 固件名称(可选)
|
* @param firmwareName 固件名称(可选)
|
||||||
* @param firmwareType 固件类型(可选)
|
* @param firmwareType 固件类型(可选)
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("分页查询固件列表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public Result<IPage<Firmware>> page(
|
public Result<IPage<Firmware>> page(
|
||||||
@RequestParam(defaultValue = "1") Long current,
|
@RequestParam(defaultValue = "1") Long current,
|
||||||
@@ -73,6 +78,7 @@ public class AppFirmwareController {
|
|||||||
/**
|
/**
|
||||||
* 查询所有固件
|
* 查询所有固件
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("查询所有固件集合")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<java.util.List<Firmware>> list() {
|
public Result<java.util.List<Firmware>> list() {
|
||||||
java.util.List<Firmware> list = firmwareService.list();
|
java.util.List<Firmware> list = firmwareService.list();
|
||||||
@@ -84,6 +90,7 @@ public class AppFirmwareController {
|
|||||||
*
|
*
|
||||||
* @param firmwareType 固件类型
|
* @param firmwareType 固件类型
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据类型查询固件版本")
|
||||||
@GetMapping("/type/{firmwareType}")
|
@GetMapping("/type/{firmwareType}")
|
||||||
public Result<java.util.List<Firmware>> listByType(@PathVariable Integer firmwareType) {
|
public Result<java.util.List<Firmware>> listByType(@PathVariable Integer firmwareType) {
|
||||||
if (firmwareType == null) {
|
if (firmwareType == null) {
|
||||||
|
|||||||
@@ -1,27 +1,222 @@
|
|||||||
package com.corewing.app.modules.app;
|
package com.corewing.app.modules.app;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.corewing.app.common.Result;
|
import com.corewing.app.common.Result;
|
||||||
import com.corewing.app.dto.ModelPageRequest;
|
import com.corewing.app.dto.AppModel.*;
|
||||||
import com.corewing.app.entity.AppModel;
|
import com.corewing.app.entity.AppModel;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import com.corewing.app.entity.AppModelCategory;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import com.corewing.app.service.AppModelCategoryService;
|
||||||
|
import com.corewing.app.service.AppModelService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模型
|
* 模型
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/model")
|
@RequestMapping("/model")
|
||||||
|
@Validated
|
||||||
|
@Api(tags = "模型接口")
|
||||||
public class AppModelController {
|
public class AppModelController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AppModelService appModelService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AppModelCategoryService appModelCategoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取模型集合
|
* 获取模型分页
|
||||||
* @param modelPageRequest
|
* @param modelPageRequest
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("模型数据分页")
|
||||||
|
@GetMapping("/page")
|
||||||
public Result<Page<AppModel>> page(ModelPageRequest modelPageRequest) {
|
public Result<Page<AppModel>> page(ModelPageRequest modelPageRequest) {
|
||||||
return Result.success();
|
return Result.success(appModelService.page(modelPageRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取模型集合
|
||||||
|
* @param modelListRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("模型数据集合")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<AppModel>> list(ModelListRequest modelListRequest) {
|
||||||
|
return Result.success(appModelService.list(modelListRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取模型分类分页
|
||||||
|
* @param modelCategoryPageRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("模型分类数据分页")
|
||||||
|
@GetMapping("/category/page")
|
||||||
|
public Result<Page<AppModelCategory>> categoryPage(ModelCategoryPageRequest modelCategoryPageRequest) {
|
||||||
|
return Result.success(appModelCategoryService.page(modelCategoryPageRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取模型分类集合
|
||||||
|
* @param modelCategoryListRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("模型分类数据集合")
|
||||||
|
@GetMapping("/category/list")
|
||||||
|
public Result<List<AppModelCategory>> categoryList(ModelCategoryListRequest modelCategoryListRequest) {
|
||||||
|
return Result.success(appModelCategoryService.list(modelCategoryListRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取模型分类树形集合
|
||||||
|
* @param modelCategoryListRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("模型分类树形集合")
|
||||||
|
@GetMapping("/category/tree")
|
||||||
|
public Result<List<Tree<String>>> categoryTree(ModelCategoryListRequest modelCategoryListRequest) {
|
||||||
|
return Result.success(appModelCategoryService.tree(modelCategoryListRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型收藏
|
||||||
|
* @param modelFavoriteRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("收藏模型")
|
||||||
|
@PostMapping("/favorite")
|
||||||
|
public Result<String> favorite(@RequestBody @Valid ModelFavoriteRequest modelFavoriteRequest) {
|
||||||
|
return Result.isBool(appModelService.favorite(modelFavoriteRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加模型下载记录
|
||||||
|
* @param modelDownloadRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("增加模型下载记录")
|
||||||
|
@PostMapping("/download")
|
||||||
|
public Result<String> download(@RequestBody @Valid ModelDownloadRequest modelDownloadRequest) {
|
||||||
|
return Result.isBool(appModelService.download(modelDownloadRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞模型
|
||||||
|
* @param modelLikeRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("点赞模型")
|
||||||
|
@PostMapping("/like")
|
||||||
|
public Result<String> like(@RequestBody @Valid ModelLikeRequest modelLikeRequest) {
|
||||||
|
return Result.isBool(appModelService.like(modelLikeRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型详情
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("模型详情")
|
||||||
|
@GetMapping("/detail/{modelId}")
|
||||||
|
public Result<AppModel> detail(@PathVariable String modelId) {
|
||||||
|
return Result.success(appModelService.detail(modelId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建模型
|
||||||
|
* @param modelCreateRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("创建模型")
|
||||||
|
@PostMapping("/create")
|
||||||
|
public Result<String> create(@Valid ModelCreateRequest modelCreateRequest) {
|
||||||
|
return Result.isBool(appModelService.create(modelCreateRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交模型审核
|
||||||
|
* @param modelIdRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("提交模型审核")
|
||||||
|
@PostMapping("/audit")
|
||||||
|
public Result<String> audit(@RequestBody @Valid ModelIdRequest modelIdRequest) {
|
||||||
|
return Result.isBool(appModelService.audit(modelIdRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取收藏列表
|
||||||
|
* @param modelFavoriteListRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("收藏模型列表")
|
||||||
|
@GetMapping("/favorite/list")
|
||||||
|
public Result<List<AppModel>> favoriteList(ModelFavoriteListRequest modelFavoriteListRequest) {
|
||||||
|
return Result.success(appModelService.favoriteList(modelFavoriteListRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取收藏分页列表
|
||||||
|
* @param modelFavoritePageRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("收藏模型分页列表")
|
||||||
|
@GetMapping("/favorite/page")
|
||||||
|
public Result<Page<AppModel>> favoritePage(ModelFavoritePageRequest modelFavoritePageRequest) {
|
||||||
|
return Result.success(appModelService.favoritePage(modelFavoritePageRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型下架
|
||||||
|
* @param modelIdRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("模型下架")
|
||||||
|
@PostMapping("/delisted")
|
||||||
|
public Result<String> delisted(@RequestBody @Valid ModelIdRequest modelIdRequest) {
|
||||||
|
return Result.isBool(appModelService.delisted(modelIdRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型下载记录列表
|
||||||
|
* @param modelDownloadLogListRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("模型下载记录列表")
|
||||||
|
@GetMapping("/download_log/list")
|
||||||
|
public Result<List<AppModel>> downloadLogList(ModelDownloadLogListRequest modelDownloadLogListRequest) {
|
||||||
|
return Result.success(appModelService.downloadLogList(modelDownloadLogListRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型下载记录分页列表
|
||||||
|
* @param modelDownloadLogPageRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("模型下载记录分页列表")
|
||||||
|
@GetMapping("/download_log/page")
|
||||||
|
public Result<Page<AppModel>> downloadLogPage(ModelDownloadLogPageRequest modelDownloadLogPageRequest) {
|
||||||
|
return Result.success(appModelService.downloadLogPage(modelDownloadLogPageRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除模型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除模型")
|
||||||
|
@DeleteMapping("/delete/{id}")
|
||||||
|
public Result<String> delete(@PathVariable String id) {
|
||||||
|
return Result.isBool(appModelService.delete(id));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import com.corewing.app.entity.ParamsCenter;
|
|||||||
import com.corewing.app.service.ParamsCenterService;
|
import com.corewing.app.service.ParamsCenterService;
|
||||||
import com.corewing.app.util.I18nUtil;
|
import com.corewing.app.util.I18nUtil;
|
||||||
import com.corewing.app.vo.ParamsCenterVO;
|
import com.corewing.app.vo.ParamsCenterVO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
@@ -18,6 +20,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 参数配置中心 Controller
|
* 参数配置中心 Controller
|
||||||
*/
|
*/
|
||||||
|
@Api(tags = "参数配置中心接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/params")
|
@RequestMapping("/params")
|
||||||
public class AppParamsCenterController {
|
public class AppParamsCenterController {
|
||||||
@@ -31,6 +34,7 @@ public class AppParamsCenterController {
|
|||||||
/**
|
/**
|
||||||
* 创建参数配置
|
* 创建参数配置
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("创建参数配置接口")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result<String> create(@Valid @RequestBody CreateParamRequest request) {
|
public Result<String> create(@Valid @RequestBody CreateParamRequest request) {
|
||||||
try {
|
try {
|
||||||
@@ -44,6 +48,8 @@ public class AppParamsCenterController {
|
|||||||
params.setFcModel(request.getFcModel());
|
params.setFcModel(request.getFcModel());
|
||||||
params.setFcType(request.getFcType());
|
params.setFcType(request.getFcType());
|
||||||
params.setParamVersion(request.getParamVersion());
|
params.setParamVersion(request.getParamVersion());
|
||||||
|
params.setStatus("1");
|
||||||
|
params.setAuditStatus("0");
|
||||||
params.setParamDetail(request.getParamDetail());
|
params.setParamDetail(request.getParamDetail());
|
||||||
params.setDownloadCount(0); // 初始化下载次数为0
|
params.setDownloadCount(0); // 初始化下载次数为0
|
||||||
|
|
||||||
@@ -60,6 +66,7 @@ public class AppParamsCenterController {
|
|||||||
/**
|
/**
|
||||||
* 更新参数配置
|
* 更新参数配置
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("更新参数配置接口")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public Result<String> update(@Valid @RequestBody UpdateParamRequest request) {
|
public Result<String> update(@Valid @RequestBody UpdateParamRequest request) {
|
||||||
try {
|
try {
|
||||||
@@ -97,6 +104,7 @@ public class AppParamsCenterController {
|
|||||||
/**
|
/**
|
||||||
* 删除参数配置
|
* 删除参数配置
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据id删除参数配置")
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public Result<String> delete(@PathVariable Long id) {
|
public Result<String> delete(@PathVariable Long id) {
|
||||||
try {
|
try {
|
||||||
@@ -124,6 +132,7 @@ public class AppParamsCenterController {
|
|||||||
/**
|
/**
|
||||||
* 根据ID查询参数配置
|
* 根据ID查询参数配置
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据id查询参数配置")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public Result<ParamsCenterVO> getById(@PathVariable Long id) {
|
public Result<ParamsCenterVO> getById(@PathVariable Long id) {
|
||||||
try {
|
try {
|
||||||
@@ -146,6 +155,7 @@ public class AppParamsCenterController {
|
|||||||
/**
|
/**
|
||||||
* 查询所有公共参数列表(公开接口,支持飞控型号过滤)
|
* 查询所有公共参数列表(公开接口,支持飞控型号过滤)
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取所有公共参数集合")
|
||||||
@GetMapping("/all/list")
|
@GetMapping("/all/list")
|
||||||
public Result<List<ParamsCenterVO>> listAll(@RequestParam(required = false) String fcModel) {
|
public Result<List<ParamsCenterVO>> listAll(@RequestParam(required = false) String fcModel) {
|
||||||
try {
|
try {
|
||||||
@@ -159,6 +169,7 @@ public class AppParamsCenterController {
|
|||||||
/**
|
/**
|
||||||
* 查询当前用户的参数列表(支持飞控型号过滤)
|
* 查询当前用户的参数列表(支持飞控型号过滤)
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取当前用户的参数列表")
|
||||||
@GetMapping("/my/list")
|
@GetMapping("/my/list")
|
||||||
public Result<List<ParamsCenterVO>> listMy(@RequestParam(required = false) String fcModel) {
|
public Result<List<ParamsCenterVO>> listMy(@RequestParam(required = false) String fcModel) {
|
||||||
try {
|
try {
|
||||||
@@ -173,6 +184,7 @@ public class AppParamsCenterController {
|
|||||||
/**
|
/**
|
||||||
* 分页查询所有参数列表(公开接口,支持飞控型号过滤)
|
* 分页查询所有参数列表(公开接口,支持飞控型号过滤)
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("分页查询所有公共参数集合")
|
||||||
@GetMapping("/all/page")
|
@GetMapping("/all/page")
|
||||||
public Result<IPage<ParamsCenterVO>> pageAll(
|
public Result<IPage<ParamsCenterVO>> pageAll(
|
||||||
@RequestParam(defaultValue = "1") Long current,
|
@RequestParam(defaultValue = "1") Long current,
|
||||||
@@ -190,6 +202,7 @@ public class AppParamsCenterController {
|
|||||||
/**
|
/**
|
||||||
* 分页查询当前用户的参数列表(支持飞控型号过滤)
|
* 分页查询当前用户的参数列表(支持飞控型号过滤)
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("分页查询当前用户参数列表")
|
||||||
@GetMapping("/my/page")
|
@GetMapping("/my/page")
|
||||||
public Result<IPage<ParamsCenterVO>> pageMy(
|
public Result<IPage<ParamsCenterVO>> pageMy(
|
||||||
@RequestParam(defaultValue = "1") Long current,
|
@RequestParam(defaultValue = "1") Long current,
|
||||||
@@ -208,6 +221,7 @@ public class AppParamsCenterController {
|
|||||||
/**
|
/**
|
||||||
* 增加下载次数
|
* 增加下载次数
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("增加参数中心下载次数")
|
||||||
@PostMapping("/{id}/download")
|
@PostMapping("/{id}/download")
|
||||||
public Result<String> incrementDownloadCount(@PathVariable Long id) {
|
public Result<String> incrementDownloadCount(@PathVariable Long id) {
|
||||||
try {
|
try {
|
||||||
@@ -236,6 +250,7 @@ public class AppParamsCenterController {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("发布公共参数提交审核")
|
||||||
@GetMapping("/review/{id}")
|
@GetMapping("/review/{id}")
|
||||||
public Result<String> review(@PathVariable Long id) {
|
public Result<String> review(@PathVariable Long id) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.corewing.app.common.Result;
|
import com.corewing.app.common.Result;
|
||||||
import com.corewing.app.entity.PrivacyPolicy;
|
import com.corewing.app.entity.PrivacyPolicy;
|
||||||
import com.corewing.app.service.PrivacyPolicyService;
|
import com.corewing.app.service.PrivacyPolicyService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -17,6 +19,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 隐私政策与协议
|
* 隐私政策与协议
|
||||||
*/
|
*/
|
||||||
|
@Api(tags = "隐私政策与协议")
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/privacy_policy")
|
@RequestMapping("/privacy_policy")
|
||||||
public class AppPrivacyPolicyController {
|
public class AppPrivacyPolicyController {
|
||||||
@@ -28,6 +31,7 @@ public class AppPrivacyPolicyController {
|
|||||||
* 隐私政策列表
|
* 隐私政策列表
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("隐私政策列表")
|
||||||
@GetMapping("/view_list/{lang}")
|
@GetMapping("/view_list/{lang}")
|
||||||
public String viewList(@PathVariable String lang, ModelMap modelMap) {
|
public String viewList(@PathVariable String lang, ModelMap modelMap) {
|
||||||
List<PrivacyPolicy> list = privacyPolicyService.list();
|
List<PrivacyPolicy> list = privacyPolicyService.list();
|
||||||
@@ -42,6 +46,7 @@ public class AppPrivacyPolicyController {
|
|||||||
* @param category
|
* @param category
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据类型获取集合数据")
|
||||||
@GetMapping("/getListByCategory/{category}")
|
@GetMapping("/getListByCategory/{category}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Result<PrivacyPolicy> getListByCategory(@PathVariable Integer category) {
|
public Result<PrivacyPolicy> getListByCategory(@PathVariable Integer category) {
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ import com.corewing.app.common.Result;
|
|||||||
import com.corewing.app.dto.uploadReplaySessionRequest;
|
import com.corewing.app.dto.uploadReplaySessionRequest;
|
||||||
import com.corewing.app.entity.ReplaySession;
|
import com.corewing.app.entity.ReplaySession;
|
||||||
import com.corewing.app.service.ReplaySessionService;
|
import com.corewing.app.service.ReplaySessionService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Api(tags = "飞行记录接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/replay-session")
|
@RequestMapping("/replay-session")
|
||||||
public class AppReplaySessionController {
|
public class AppReplaySessionController {
|
||||||
@@ -21,6 +24,7 @@ public class AppReplaySessionController {
|
|||||||
* 获取飞行记录
|
* 获取飞行记录
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取当前用户飞行记录")
|
||||||
@GetMapping("/getReplayList")
|
@GetMapping("/getReplayList")
|
||||||
public Result<List<ReplaySession>> getReplayList() {
|
public Result<List<ReplaySession>> getReplayList() {
|
||||||
return Result.success(replaySessionService.getReplayList(StpUtil.getLoginId()));
|
return Result.success(replaySessionService.getReplayList(StpUtil.getLoginId()));
|
||||||
@@ -31,6 +35,7 @@ public class AppReplaySessionController {
|
|||||||
* @param uploadReplaySessionRequests
|
* @param uploadReplaySessionRequests
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("上传飞行记录")
|
||||||
@PostMapping("/uploadReplaySession")
|
@PostMapping("/uploadReplaySession")
|
||||||
public Result<Boolean> uploadReplaySession(@RequestBody List<uploadReplaySessionRequest> uploadReplaySessionRequests) {
|
public Result<Boolean> uploadReplaySession(@RequestBody List<uploadReplaySessionRequest> uploadReplaySessionRequests) {
|
||||||
return Result.isBool(replaySessionService.uploadReplaySession(uploadReplaySessionRequests));
|
return Result.isBool(replaySessionService.uploadReplaySession(uploadReplaySessionRequests));
|
||||||
@@ -41,6 +46,7 @@ public class AppReplaySessionController {
|
|||||||
* @param syncId
|
* @param syncId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据同步id删除飞行记录")
|
||||||
@DeleteMapping("/deleteReplaySession/{syncId}")
|
@DeleteMapping("/deleteReplaySession/{syncId}")
|
||||||
public Result<Boolean> deleteReplaySession(@PathVariable String syncId) {
|
public Result<Boolean> deleteReplaySession(@PathVariable String syncId) {
|
||||||
return Result.isBool(replaySessionService.deleteReplaySession(syncId));
|
return Result.isBool(replaySessionService.deleteReplaySession(syncId));
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import com.corewing.app.entity.TutorialCategory;
|
|||||||
import com.corewing.app.service.TutorialCategoryService;
|
import com.corewing.app.service.TutorialCategoryService;
|
||||||
import com.corewing.app.service.TutorialService;
|
import com.corewing.app.service.TutorialService;
|
||||||
import com.corewing.app.util.I18nUtil;
|
import com.corewing.app.util.I18nUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
@@ -19,6 +21,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* 教程接口
|
* 教程接口
|
||||||
*/
|
*/
|
||||||
|
@Api(tags = "教程接口")
|
||||||
@RequestMapping("/tutorial")
|
@RequestMapping("/tutorial")
|
||||||
@Controller
|
@Controller
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -38,6 +41,7 @@ public class AppTutorialController {
|
|||||||
* @param model 数据模型
|
* @param model 数据模型
|
||||||
* @return 详情页
|
* @return 详情页
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("跳转到界面查看教程详情")
|
||||||
@GetMapping("/viewDetail/{tutorialId}")
|
@GetMapping("/viewDetail/{tutorialId}")
|
||||||
public String viewDetail(@PathVariable Long tutorialId, ModelMap model) {
|
public String viewDetail(@PathVariable Long tutorialId, ModelMap model) {
|
||||||
Tutorial tutorial = tutorialService.getById(tutorialId);
|
Tutorial tutorial = tutorialService.getById(tutorialId);
|
||||||
@@ -51,6 +55,7 @@ public class AppTutorialController {
|
|||||||
* @param tutorialId 教程id
|
* @param tutorialId 教程id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("添加查看次数")
|
||||||
@GetMapping("/addViewCount")
|
@GetMapping("/addViewCount")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Result<String> addViewCount(@RequestParam Long tutorialId) {
|
public Result<String> addViewCount(@RequestParam Long tutorialId) {
|
||||||
@@ -69,6 +74,7 @@ public class AppTutorialController {
|
|||||||
* @param firstStatus 置首状态(选填)
|
* @param firstStatus 置首状态(选填)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("分类查询集合")
|
||||||
@GetMapping("/category")
|
@GetMapping("/category")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Result<List<TutorialCategory>> category(
|
public Result<List<TutorialCategory>> category(
|
||||||
@@ -91,6 +97,7 @@ public class AppTutorialController {
|
|||||||
* @param tutorialTitle 教程标题(选填)
|
* @param tutorialTitle 教程标题(选填)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("分页查询教程列表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Result<IPage<Tutorial>> getPageList(
|
public Result<IPage<Tutorial>> getPageList(
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import com.corewing.app.service.UserService;
|
|||||||
import com.corewing.app.service.VerifyCodeService;
|
import com.corewing.app.service.VerifyCodeService;
|
||||||
import com.corewing.app.util.I18nUtil;
|
import com.corewing.app.util.I18nUtil;
|
||||||
import com.corewing.app.util.IpUtil;
|
import com.corewing.app.util.IpUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -18,6 +20,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* 应用用户 Controller
|
* 应用用户 Controller
|
||||||
*/
|
*/
|
||||||
|
@Api(tags = "用户接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user")
|
@RequestMapping("/user")
|
||||||
public class AppUserController {
|
public class AppUserController {
|
||||||
@@ -33,6 +36,7 @@ public class AppUserController {
|
|||||||
/**
|
/**
|
||||||
* 发送验证码
|
* 发送验证码
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("发送验证码接口")
|
||||||
@PostMapping("/sendCode")
|
@PostMapping("/sendCode")
|
||||||
public Result<String> sendCode(@RequestBody SendCodeRequest request) {
|
public Result<String> sendCode(@RequestBody SendCodeRequest request) {
|
||||||
try {
|
try {
|
||||||
@@ -49,6 +53,7 @@ public class AppUserController {
|
|||||||
/**
|
/**
|
||||||
* 用户登录(支持用户名/邮箱/手机号)
|
* 用户登录(支持用户名/邮箱/手机号)
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("用户登录接口")
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public Result<Map<String, Object>> login(@RequestBody LoginRequest request, HttpServletRequest httpRequest) {
|
public Result<Map<String, Object>> login(@RequestBody LoginRequest request, HttpServletRequest httpRequest) {
|
||||||
try {
|
try {
|
||||||
@@ -73,6 +78,7 @@ public class AppUserController {
|
|||||||
/**
|
/**
|
||||||
* 用户注册(需要验证码)
|
* 用户注册(需要验证码)
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("用户注册接口")
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
public Result<String> register(@RequestBody RegisterRequest request, HttpServletRequest httpRequest) {
|
public Result<String> register(@RequestBody RegisterRequest request, HttpServletRequest httpRequest) {
|
||||||
try {
|
try {
|
||||||
@@ -95,6 +101,7 @@ public class AppUserController {
|
|||||||
/**
|
/**
|
||||||
* 用户登出
|
* 用户登出
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("用户登出接口")
|
||||||
@PostMapping("/logout")
|
@PostMapping("/logout")
|
||||||
public Result<String> logout() {
|
public Result<String> logout() {
|
||||||
StpUtil.logout();
|
StpUtil.logout();
|
||||||
@@ -104,6 +111,7 @@ public class AppUserController {
|
|||||||
/**
|
/**
|
||||||
* 获取当前登录用户信息
|
* 获取当前登录用户信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("获取当前登录用户信息")
|
||||||
@GetMapping("/info")
|
@GetMapping("/info")
|
||||||
public Result<User> getUserInfo() {
|
public Result<User> getUserInfo() {
|
||||||
Long userId = StpUtil.getLoginIdAsLong();
|
Long userId = StpUtil.getLoginIdAsLong();
|
||||||
@@ -116,6 +124,7 @@ public class AppUserController {
|
|||||||
/**
|
/**
|
||||||
* 根据ID查询用户
|
* 根据ID查询用户
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("根据id查询用户")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public Result<User> getById(@PathVariable Long id) {
|
public Result<User> getById(@PathVariable Long id) {
|
||||||
User user = userService.getById(id);
|
User user = userService.getById(id);
|
||||||
@@ -130,6 +139,7 @@ public class AppUserController {
|
|||||||
/**
|
/**
|
||||||
* 更新用户信息
|
* 更新用户信息
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("更新用户信息")
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
public Result<String> update(@RequestBody User user) {
|
public Result<String> update(@RequestBody User user) {
|
||||||
Long userId = StpUtil.getLoginIdAsLong();
|
Long userId = StpUtil.getLoginIdAsLong();
|
||||||
@@ -146,6 +156,7 @@ public class AppUserController {
|
|||||||
/**
|
/**
|
||||||
* 修改密码
|
* 修改密码
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("用户修改密码")
|
||||||
@PutMapping("/password")
|
@PutMapping("/password")
|
||||||
public Result<String> updatePassword(@RequestBody UpdatePasswordRequest request) {
|
public Result<String> updatePassword(@RequestBody UpdatePasswordRequest request) {
|
||||||
try {
|
try {
|
||||||
@@ -178,6 +189,7 @@ public class AppUserController {
|
|||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("忘记密码")
|
||||||
@PutMapping("/forgetPassword")
|
@PutMapping("/forgetPassword")
|
||||||
public Result<String> forgetPassword(@RequestBody ForgetPasswordRequest request) {
|
public Result<String> forgetPassword(@RequestBody ForgetPasswordRequest request) {
|
||||||
return Result.isBool(userService.forgetPassword(request));
|
return Result.isBool(userService.forgetPassword(request));
|
||||||
@@ -187,6 +199,7 @@ public class AppUserController {
|
|||||||
* 验证码登录
|
* 验证码登录
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("验证码登录")
|
||||||
@PostMapping("/codeLogin")
|
@PostMapping("/codeLogin")
|
||||||
public Result<Map<String, Object>> codeLogin(@RequestBody CodeLoginRequest codeLoginRequest, HttpServletRequest request) {
|
public Result<Map<String, Object>> codeLogin(@RequestBody CodeLoginRequest codeLoginRequest, HttpServletRequest request) {
|
||||||
|
|
||||||
@@ -208,6 +221,7 @@ public class AppUserController {
|
|||||||
* @param logoffRequest
|
* @param logoffRequest
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("注销用户")
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
public Result<String> logoff(@RequestBody @Valid LogoffRequest logoffRequest) {
|
public Result<String> logoff(@RequestBody @Valid LogoffRequest logoffRequest) {
|
||||||
return Result.isBool(userService.logoff(logoffRequest));
|
return Result.isBool(userService.logoff(logoffRequest));
|
||||||
@@ -217,6 +231,7 @@ public class AppUserController {
|
|||||||
* 注销发送验证码
|
* 注销发送验证码
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("发送注销验证码")
|
||||||
@PostMapping("/delete/sendCode")
|
@PostMapping("/delete/sendCode")
|
||||||
public Result<Map<String, String>> deleteSendCode() {
|
public Result<Map<String, String>> deleteSendCode() {
|
||||||
return userService.deleteSendCode();
|
return userService.deleteSendCode();
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.corewing.app.common.Result;
|
|||||||
import com.corewing.app.dto.CheckVersionRequest;
|
import com.corewing.app.dto.CheckVersionRequest;
|
||||||
import com.corewing.app.entity.AppVersion;
|
import com.corewing.app.entity.AppVersion;
|
||||||
import com.corewing.app.service.AppVersionService;
|
import com.corewing.app.service.AppVersionService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -13,6 +15,7 @@ import javax.annotation.Resource;
|
|||||||
/**
|
/**
|
||||||
* app升级校验接口
|
* app升级校验接口
|
||||||
*/
|
*/
|
||||||
|
@Api(tags = "APP版本接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app_version")
|
@RequestMapping("/app_version")
|
||||||
public class AppVersionController {
|
public class AppVersionController {
|
||||||
@@ -25,6 +28,7 @@ public class AppVersionController {
|
|||||||
* @param checkVersionRequest
|
* @param checkVersionRequest
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ApiOperation("校验是否有新版本")
|
||||||
@GetMapping("/checkUpdate")
|
@GetMapping("/checkUpdate")
|
||||||
public Result<Object> checkUpdate(CheckVersionRequest checkVersionRequest) {
|
public Result<Object> checkUpdate(CheckVersionRequest checkVersionRequest) {
|
||||||
AppVersion version = appVersionService.getNewAppVersion(checkVersionRequest);
|
AppVersion version = appVersionService.getNewAppVersion(checkVersionRequest);
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.corewing.app.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.corewing.app.dto.AppModel.ModelCategoryListRequest;
|
||||||
|
import com.corewing.app.dto.AppModel.ModelCategoryPageRequest;
|
||||||
|
import com.corewing.app.dto.AppModel.ModelDownloadRequest;
|
||||||
|
import com.corewing.app.dto.AppModel.ModelFavoriteRequest;
|
||||||
|
import com.corewing.app.entity.AppModelCategory;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface AppModelCategoryService extends IService<AppModelCategory> {
|
||||||
|
|
||||||
|
Page<AppModelCategory> page(ModelCategoryPageRequest modelCategoryPageRequest);
|
||||||
|
|
||||||
|
List<AppModelCategory> list(ModelCategoryListRequest modelCategoryListRequest);
|
||||||
|
|
||||||
|
List<Tree<String>> tree(ModelCategoryListRequest modelCategoryListRequest);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.corewing.app.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.corewing.app.entity.AppModelDownloadLog;
|
||||||
|
|
||||||
|
public interface AppModelDownloadLogService extends IService<AppModelDownloadLog> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.corewing.app.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.corewing.app.entity.AppModelFavorite;
|
||||||
|
|
||||||
|
public interface AppModelFavoriteService extends IService<AppModelFavorite> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.corewing.app.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.corewing.app.entity.AppModelFile;
|
||||||
|
|
||||||
|
public interface AppModelFileService extends IService<AppModelFile> {
|
||||||
|
}
|
||||||
39
src/main/java/com/corewing/app/service/AppModelService.java
Normal file
39
src/main/java/com/corewing/app/service/AppModelService.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package com.corewing.app.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.corewing.app.dto.AppModel.*;
|
||||||
|
import com.corewing.app.entity.AppModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface AppModelService extends IService<AppModel> {
|
||||||
|
|
||||||
|
Page<AppModel> page(ModelPageRequest modelPageRequest);
|
||||||
|
|
||||||
|
List<AppModel> list(ModelListRequest modelListRequest);
|
||||||
|
|
||||||
|
boolean like(ModelLikeRequest modelLikeRequest);
|
||||||
|
|
||||||
|
boolean favorite(ModelFavoriteRequest modelFavoriteRequest);
|
||||||
|
|
||||||
|
boolean download(ModelDownloadRequest modelDownloadRequest);
|
||||||
|
|
||||||
|
AppModel detail(String modelId);
|
||||||
|
|
||||||
|
boolean create(ModelCreateRequest modelCreateRequest);
|
||||||
|
|
||||||
|
boolean audit(ModelIdRequest modelIdRequest);
|
||||||
|
|
||||||
|
List<AppModel> favoriteList(ModelFavoriteListRequest modelFavoriteListRequest);
|
||||||
|
|
||||||
|
Page<AppModel> favoritePage(ModelFavoritePageRequest modelFavoritePageRequest);
|
||||||
|
|
||||||
|
boolean delisted(ModelIdRequest modelIdRequest);
|
||||||
|
|
||||||
|
List<AppModel> downloadLogList(ModelDownloadLogListRequest modelDownloadLogListRequest);
|
||||||
|
|
||||||
|
Page<AppModel> downloadLogPage(ModelDownloadLogPageRequest modelDownloadLogPageRequest);
|
||||||
|
|
||||||
|
boolean delete(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package com.corewing.app.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
|
import cn.hutool.core.lang.tree.TreeNode;
|
||||||
|
import cn.hutool.core.lang.tree.TreeUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.corewing.app.common.page.PageContext;
|
||||||
|
import com.corewing.app.dto.AppModel.ModelCategoryListRequest;
|
||||||
|
import com.corewing.app.dto.AppModel.ModelCategoryPageRequest;
|
||||||
|
import com.corewing.app.dto.AppModel.ModelDownloadRequest;
|
||||||
|
import com.corewing.app.dto.AppModel.ModelFavoriteRequest;
|
||||||
|
import com.corewing.app.entity.AppModel;
|
||||||
|
import com.corewing.app.entity.AppModelCategory;
|
||||||
|
import com.corewing.app.entity.AppModelDownloadLog;
|
||||||
|
import com.corewing.app.entity.AppModelFavorite;
|
||||||
|
import com.corewing.app.handler.GlobalExceptionHandler;
|
||||||
|
import com.corewing.app.mapper.AppModelCategoryMapper;
|
||||||
|
import com.corewing.app.service.AppModelCategoryService;
|
||||||
|
import com.corewing.app.service.AppModelDownloadLogService;
|
||||||
|
import com.corewing.app.service.AppModelFavoriteService;
|
||||||
|
import com.corewing.app.service.AppModelService;
|
||||||
|
import com.corewing.app.util.CommonServletUtil;
|
||||||
|
import com.corewing.app.util.IpUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AppModelCategoryServiceImpl extends ServiceImpl<AppModelCategoryMapper, AppModelCategory> implements AppModelCategoryService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AppModelCategoryMapper appModelCategoryMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<AppModelCategory> page(ModelCategoryPageRequest modelCategoryPageRequest) {
|
||||||
|
Page<AppModelCategory> page = PageContext.getPage(AppModelCategory.class);
|
||||||
|
return appModelCategoryMapper.page(page, modelCategoryPageRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AppModelCategory> list(ModelCategoryListRequest modelCategoryListRequest) {
|
||||||
|
return appModelCategoryMapper.list(modelCategoryListRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Tree<String>> tree(ModelCategoryListRequest modelCategoryListRequest) {
|
||||||
|
List<AppModelCategory> resourceList = appModelCategoryMapper.list(modelCategoryListRequest);
|
||||||
|
|
||||||
|
// 填充上层的父级菜单
|
||||||
|
this.fillParentCategoryInfo(resourceList);
|
||||||
|
|
||||||
|
List<TreeNode<String>> treeNodeList = resourceList.stream().map(modelCategory ->
|
||||||
|
new TreeNode<>(modelCategory.getId(), modelCategory.getParentId(),
|
||||||
|
modelCategory.getName(), modelCategory.getSortCode()).setExtra(JSONUtil.parseObj(modelCategory)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return TreeUtil.build(treeNodeList, "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void fillParentCategoryInfo(List<AppModelCategory> categoryList) {
|
||||||
|
if(CollUtil.isNotEmpty(categoryList)){
|
||||||
|
List<AppModelCategory> parentModelCategoryList = categoryList.stream().filter(distinctByKey(AppModelCategory::getParentId)).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<String> parentIds = null;
|
||||||
|
if(CollUtil.isNotEmpty(parentModelCategoryList)){
|
||||||
|
parentIds = CollUtil.newArrayList();
|
||||||
|
for(AppModelCategory parentCategory : categoryList){
|
||||||
|
if(!StrUtil.equals(parentCategory.getParentId(),"0")){
|
||||||
|
parentIds.add(parentCategory.getParentId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(CollUtil.isNotEmpty(parentIds)){
|
||||||
|
LambdaQueryWrapper<AppModelCategory> parentCategoryLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
parentCategoryLambdaQueryWrapper.in(AppModelCategory::getId,parentIds);
|
||||||
|
List<AppModelCategory> parentCategoryList = this.list(parentCategoryLambdaQueryWrapper);
|
||||||
|
if(CollUtil.isNotEmpty(parentCategoryList)){
|
||||||
|
this.fillParentCategoryInfo(parentCategoryList);
|
||||||
|
categoryList.addAll(parentCategoryList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
||||||
|
Set<Object> seen = ConcurrentHashMap.newKeySet();
|
||||||
|
return t -> seen.add(keyExtractor.apply(t));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.corewing.app.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.corewing.app.entity.AppModelDownloadLog;
|
||||||
|
import com.corewing.app.mapper.AppModelDownloadLogMapper;
|
||||||
|
import com.corewing.app.service.AppModelDownloadLogService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AppModelDownloadLogServiceImpl extends ServiceImpl<AppModelDownloadLogMapper, AppModelDownloadLog> implements AppModelDownloadLogService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.corewing.app.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.corewing.app.entity.AppModelFavorite;
|
||||||
|
import com.corewing.app.mapper.AppModelFavoriteMapper;
|
||||||
|
import com.corewing.app.service.AppModelFavoriteService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AppModelFavoriteServiceImpl extends ServiceImpl<AppModelFavoriteMapper, AppModelFavorite> implements AppModelFavoriteService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.corewing.app.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.corewing.app.entity.AppModelFile;
|
||||||
|
import com.corewing.app.mapper.AppModelFileMapper;
|
||||||
|
import com.corewing.app.service.AppModelFileService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AppModelFileServiceImpl extends ServiceImpl<AppModelFileMapper, AppModelFile> implements AppModelFileService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,238 @@
|
|||||||
|
package com.corewing.app.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.corewing.app.common.base.BaseEntity;
|
||||||
|
import com.corewing.app.common.enums.CommonDeleteFlagEnum;
|
||||||
|
import com.corewing.app.common.page.PageContext;
|
||||||
|
import com.corewing.app.dto.AppModel.*;
|
||||||
|
import com.corewing.app.entity.*;
|
||||||
|
import com.corewing.app.mapper.AppModelMapper;
|
||||||
|
import com.corewing.app.service.AppModelDownloadLogService;
|
||||||
|
import com.corewing.app.service.AppModelFavoriteService;
|
||||||
|
import com.corewing.app.service.AppModelFileService;
|
||||||
|
import com.corewing.app.service.AppModelService;
|
||||||
|
import com.corewing.app.util.CommonServletUtil;
|
||||||
|
import com.corewing.app.util.IpUtil;
|
||||||
|
import com.corewing.app.util.OSSUploadUtil;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AppModelServiceImpl extends ServiceImpl<AppModelMapper, AppModel> implements AppModelService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AppModelMapper appModelMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AppModelFavoriteService modelFavoriteService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AppModelDownloadLogService modelDownloadLogService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AppModelFileService modelFileService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<AppModel> page(ModelPageRequest modelPageRequest) {
|
||||||
|
Page<AppModel> page = PageContext.getPage(AppModel.class);
|
||||||
|
return appModelMapper.page(page, modelPageRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AppModel> list(ModelListRequest modelListRequest) {
|
||||||
|
return appModelMapper.list(modelListRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean like(ModelLikeRequest modelLikeRequest) {
|
||||||
|
AppModel appModel = this.getById(modelLikeRequest.getModelId());
|
||||||
|
if(appModel == null) {
|
||||||
|
throw new RuntimeException("该模型不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaUpdateWrapper<AppModel> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(AppModel::getId, appModel.getId());
|
||||||
|
updateWrapper.set(AppModel::getLikeCount, appModel.getLikeCount() + 1);
|
||||||
|
return this.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean favorite(ModelFavoriteRequest modelFavoriteRequest) {
|
||||||
|
|
||||||
|
// 校验是否已经收藏了
|
||||||
|
LambdaQueryWrapper<AppModelFavorite> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AppModelFavorite::getModelId, modelFavoriteRequest.getModelId());
|
||||||
|
if(modelFavoriteService.count(queryWrapper) > 0) {
|
||||||
|
throw new RuntimeException("已经收藏了");
|
||||||
|
}
|
||||||
|
|
||||||
|
AppModel appModel = this.getById(modelFavoriteRequest.getModelId());
|
||||||
|
if(appModel == null) {
|
||||||
|
throw new RuntimeException("该模型不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaUpdateWrapper<AppModel> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(AppModel::getId, appModel.getId());
|
||||||
|
updateWrapper.set(AppModel::getFavoriteCount, appModel.getFavoriteCount() + 1);
|
||||||
|
this.update(updateWrapper);
|
||||||
|
|
||||||
|
AppModelFavorite modelFavorite = new AppModelFavorite();
|
||||||
|
modelFavorite.setModelId(appModel.getId());
|
||||||
|
modelFavorite.setUserId(Long.valueOf(StpUtil.getLoginId().toString()));
|
||||||
|
|
||||||
|
return modelFavoriteService.save(modelFavorite);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public boolean download(ModelDownloadRequest modelDownloadRequest) {
|
||||||
|
AppModel appModel = this.getById(modelDownloadRequest.getModelId());
|
||||||
|
if(appModel == null) {
|
||||||
|
throw new RuntimeException("该模型不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaUpdateWrapper<AppModel> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(AppModel::getId, appModel.getId());
|
||||||
|
updateWrapper.set(AppModel::getDownloadCount, appModel.getDownloadCount() + 1);
|
||||||
|
this.update(updateWrapper);
|
||||||
|
|
||||||
|
AppModelDownloadLog log = new AppModelDownloadLog();
|
||||||
|
log.setModelId(appModel.getId());
|
||||||
|
log.setUserId(Long.valueOf(StpUtil.getLoginId().toString()));
|
||||||
|
log.setIpAddress(IpUtil.getClientIp(CommonServletUtil.getRequest()));
|
||||||
|
|
||||||
|
return modelDownloadLogService.save(log);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppModel detail(String modelId) {
|
||||||
|
AppModel appModel = appModelMapper.getModelById(modelId);
|
||||||
|
if(appModel == null) {
|
||||||
|
throw new RuntimeException("该模型不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<AppModelFile> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AppModelFile::getModelId, modelId);
|
||||||
|
List<AppModelFile> list = modelFileService.list(queryWrapper);
|
||||||
|
if(list != null) {
|
||||||
|
appModel.setModelFile(list);
|
||||||
|
}
|
||||||
|
return appModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public boolean create(ModelCreateRequest modelCreateRequest) {
|
||||||
|
|
||||||
|
// 模型标题校验
|
||||||
|
LambdaQueryWrapper<AppModel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AppModel::getTitle, modelCreateRequest.getTitle());
|
||||||
|
if(count(queryWrapper) > 0) {
|
||||||
|
throw new RuntimeException("模型标题已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
AppModel appModel = BeanUtil.toBean(modelCreateRequest, AppModel.class);
|
||||||
|
appModel.setIsPublic("0");
|
||||||
|
appModel.setStatus("1");
|
||||||
|
appModel.setUserId(Long.valueOf(StpUtil.getLoginId().toString()));
|
||||||
|
this.save(appModel);
|
||||||
|
|
||||||
|
// 上传文件
|
||||||
|
modelCreateRequest.getFiles().forEach(item -> {
|
||||||
|
try {
|
||||||
|
String downloadUrl = OSSUploadUtil.uploadFile(item.getInputStream(), "customModel/" + item.getOriginalFilename());
|
||||||
|
AppModelFile modelFile = new AppModelFile();
|
||||||
|
modelFile.setFileName(item.getOriginalFilename());
|
||||||
|
modelFile.setFileUrl(downloadUrl);
|
||||||
|
modelFile.setFileSize(item.getSize());
|
||||||
|
modelFile.setFileType(item.getContentType());
|
||||||
|
modelFile.setModelId(appModel.getId());
|
||||||
|
modelFileService.save(modelFile);
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("创建模型失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public boolean audit(ModelIdRequest modelIdRequest) {
|
||||||
|
LambdaQueryWrapper<AppModel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AppModel::getId, modelIdRequest.getModelId());
|
||||||
|
queryWrapper.eq(AppModel::getUserId, StpUtil.getLoginId().toString());
|
||||||
|
AppModel appModel = this.getOne(queryWrapper);
|
||||||
|
if(appModel == null) {
|
||||||
|
throw new RuntimeException("该模型不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaUpdateWrapper<AppModel> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(AppModel::getId, appModel.getId());
|
||||||
|
updateWrapper.set(AppModel::getStatus, "2");
|
||||||
|
return this.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AppModel> favoriteList(ModelFavoriteListRequest modelFavoriteListRequest) {
|
||||||
|
return appModelMapper.favoriteList(Long.valueOf(StpUtil.getLoginId().toString()), modelFavoriteListRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<AppModel> favoritePage(ModelFavoritePageRequest modelFavoritePageRequest) {
|
||||||
|
Page<AppModel> page = PageContext.getPage(AppModel.class);
|
||||||
|
return appModelMapper.favoritePage(page, Long.valueOf(StpUtil.getLoginId().toString()), modelFavoritePageRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean delisted(ModelIdRequest modelIdRequest) {
|
||||||
|
LambdaQueryWrapper<AppModel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AppModel::getId, modelIdRequest.getModelId());
|
||||||
|
queryWrapper.eq(AppModel::getUserId, StpUtil.getLoginId().toString());
|
||||||
|
AppModel appModel = this.getOne(queryWrapper);
|
||||||
|
if(appModel == null) {
|
||||||
|
throw new RuntimeException("该模型不存在");
|
||||||
|
}
|
||||||
|
// 下架模型后,强制将公开状态转私有,模型状态转为下架
|
||||||
|
LambdaUpdateWrapper<AppModel> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(AppModel::getId, appModel.getId());
|
||||||
|
updateWrapper.set(AppModel::getStatus, "0");
|
||||||
|
updateWrapper.set(AppModel::getIsPublic, "0");
|
||||||
|
return this.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AppModel> downloadLogList(ModelDownloadLogListRequest modelDownloadLogListRequest) {
|
||||||
|
return appModelMapper.downloadLogList(Long.valueOf(StpUtil.getLoginId().toString()), modelDownloadLogListRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<AppModel> downloadLogPage(ModelDownloadLogPageRequest modelDownloadLogPageRequest) {
|
||||||
|
Page<AppModel> page = PageContext.getPage(AppModel.class);
|
||||||
|
return appModelMapper.downloadLogPage(page, Long.valueOf(StpUtil.getLoginId().toString()), modelDownloadLogPageRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean delete(String id) {
|
||||||
|
LambdaQueryWrapper<AppModel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AppModel::getId, id);
|
||||||
|
queryWrapper.eq(AppModel::getUserId, StpUtil.getLoginId().toString());
|
||||||
|
AppModel appModel = this.getOne(queryWrapper);
|
||||||
|
if(appModel == null) {
|
||||||
|
throw new RuntimeException("该模型不存在");
|
||||||
|
}
|
||||||
|
return this.removeById(appModel.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
83
src/main/java/com/corewing/app/util/CommonServletUtil.java
Normal file
83
src/main/java/com/corewing/app/util/CommonServletUtil.java
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
package com.corewing.app.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HttpServlet工具类,获取当前request和response
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class CommonServletUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从请求中中获取参数
|
||||||
|
*
|
||||||
|
* @author xuyuxiang
|
||||||
|
* @date 2021/10/14 10:44
|
||||||
|
**/
|
||||||
|
public static String getParamFromRequest(String paramName) {
|
||||||
|
HttpServletRequest request = getRequest();
|
||||||
|
|
||||||
|
// 1. 尝试从请求体里面读取
|
||||||
|
String paramValue = request.getParameter(paramName);
|
||||||
|
|
||||||
|
// 2. 尝试从header里读取
|
||||||
|
if (ObjectUtil.isEmpty(paramValue)) {
|
||||||
|
paramValue = request.getHeader(paramName);
|
||||||
|
}
|
||||||
|
// 3. 尝试从cookie里读取
|
||||||
|
if (ObjectUtil.isEmpty(paramValue)) {
|
||||||
|
Cookie[] cookies = request.getCookies();
|
||||||
|
if(ObjectUtil.isNotEmpty(cookies)) {
|
||||||
|
for (Cookie cookie : cookies) {
|
||||||
|
String cookieName = cookie.getName();
|
||||||
|
if (cookieName.equals(paramName)) {
|
||||||
|
return cookie.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 4. 返回
|
||||||
|
return paramValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HttpServletRequest getRequest() {
|
||||||
|
ServletRequestAttributes servletRequestAttributes;
|
||||||
|
try {
|
||||||
|
servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(">>> 非Web上下文无法获取Request:", e);
|
||||||
|
throw new RuntimeException("非Web上下文无法获取Request");
|
||||||
|
}
|
||||||
|
if (servletRequestAttributes == null) {
|
||||||
|
throw new RuntimeException("非Web上下文无法获取Request");
|
||||||
|
} else {
|
||||||
|
return servletRequestAttributes.getRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HttpServletResponse getResponse() {
|
||||||
|
ServletRequestAttributes servletRequestAttributes;
|
||||||
|
try {
|
||||||
|
servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(">>> 非Web上下文无法获取Response:", e);
|
||||||
|
throw new RuntimeException("非Web上下文无法获取Response");
|
||||||
|
}
|
||||||
|
if (servletRequestAttributes == null) {
|
||||||
|
throw new RuntimeException("非Web上下文无法获取Response");
|
||||||
|
} else {
|
||||||
|
return servletRequestAttributes.getResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isWeb() {
|
||||||
|
return RequestContextHolder.getRequestAttributes() != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ public class OSSUploadUtil {
|
|||||||
* AccessKey ID LTAI5tKUhXrGxZ5Gj3exWpkG
|
* AccessKey ID LTAI5tKUhXrGxZ5Gj3exWpkG
|
||||||
* AccessKey Secret PaBTMp3BhcOUgLQhJWmOkhfJhTlzhV
|
* AccessKey Secret PaBTMp3BhcOUgLQhJWmOkhfJhTlzhV
|
||||||
*/
|
*/
|
||||||
|
private static final String OSS_COREWING = "oss.corewing.com";
|
||||||
private static final String ENDPOINT = "oss-cn-shenzhen.aliyuncs.com"; // 地域节点
|
private static final String ENDPOINT = "oss-cn-shenzhen.aliyuncs.com"; // 地域节点
|
||||||
private static final String ACCESS_KEY_ID = "LTAI5tKUhXrGxZ5Gj3exWpkG"; // 替换为你的 AccessKey ID
|
private static final String ACCESS_KEY_ID = "LTAI5tKUhXrGxZ5Gj3exWpkG"; // 替换为你的 AccessKey ID
|
||||||
private static final String ACCESS_KEY_SECRET = "PaBTMp3BhcOUgLQhJWmOkhfJhTlzhV"; // 替换为你的 AccessKey Secret
|
private static final String ACCESS_KEY_SECRET = "PaBTMp3BhcOUgLQhJWmOkhfJhTlzhV"; // 替换为你的 AccessKey Secret
|
||||||
@@ -53,7 +54,7 @@ public class OSSUploadUtil {
|
|||||||
CannedAccessControlList.PublicRead // 公共可读权限
|
CannedAccessControlList.PublicRead // 公共可读权限
|
||||||
);
|
);
|
||||||
// 生成文件访问 URL(公网访问需 Bucket 设为公共读)
|
// 生成文件访问 URL(公网访问需 Bucket 设为公共读)
|
||||||
return String.format("https://%s.%s/%s", BUCKET_NAME, ENDPOINT, objectName);
|
return String.format("https://%s/%s", OSS_COREWING, objectName);
|
||||||
} finally {
|
} finally {
|
||||||
// 关闭 OSS 客户端,释放资源
|
// 关闭 OSS 客户端,释放资源
|
||||||
if (ossClient != null) {
|
if (ossClient != null) {
|
||||||
@@ -78,7 +79,7 @@ public class OSSUploadUtil {
|
|||||||
objectName, // 刚上传的文件路径
|
objectName, // 刚上传的文件路径
|
||||||
CannedAccessControlList.PublicRead // 公共可读权限
|
CannedAccessControlList.PublicRead // 公共可读权限
|
||||||
);
|
);
|
||||||
return String.format("https://%s.%s/%s", BUCKET_NAME, ENDPOINT, objectName);
|
return String.format("https://%s/%s", OSS_COREWING, objectName);
|
||||||
} finally {
|
} finally {
|
||||||
if (ossClient != null) {
|
if (ossClient != null) {
|
||||||
ossClient.shutdown();
|
ossClient.shutdown();
|
||||||
|
|||||||
@@ -36,8 +36,15 @@ mybatis-plus.mapper-locations=classpath*:/mapper/**/*.xml
|
|||||||
mybatis-plus.type-aliases-package=com.corewing.app.entity
|
mybatis-plus.type-aliases-package=com.corewing.app.entity
|
||||||
mybatis-plus.configuration.map-underscore-to-camel-case=true
|
mybatis-plus.configuration.map-underscore-to-camel-case=true
|
||||||
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
mybatis-plus.global-config.db-config.id-type=AUTO
|
mybatis-plus.global-config.db-config.id-type=ASSIGN_ID
|
||||||
mybatis-plus.global-config.db-config.table-prefix=
|
mybatis-plus.global-config.db-config.table-prefix=
|
||||||
|
# ========== 逻辑删除核心配置 ==========
|
||||||
|
# 1. 自定义逻辑删除字段名(替换为你的字段,如 is_delete、del_flag 等)
|
||||||
|
mybatis-plus.global-config.db-config.logic-delete-field=del_flag
|
||||||
|
# 2. 逻辑未删除值(替换为你的业务未删除值,如 0、false、N 等)
|
||||||
|
mybatis-plus.global-config.db-config.logic-not-delete-value=NOT_DELETE
|
||||||
|
# 3. 逻辑已删除值(替换为你的业务已删除值,如 1、true、Y 等)
|
||||||
|
mybatis-plus.global-config.db-config.logic-delete-value=DELETE
|
||||||
|
|
||||||
# Redis 配置
|
# Redis 配置
|
||||||
spring.redis.host=localhost
|
spring.redis.host=localhost
|
||||||
@@ -95,3 +102,41 @@ spring.mail.properties.mail.smtp.socketFactory.fallback=false
|
|||||||
dingtalk.webhook=https://oapi.dingtalk.com/robot/send?access_token=7eed4b3483303c9ec71ef37a08c347bb597fd4c64211a96a8f55f72405ff6444
|
dingtalk.webhook=https://oapi.dingtalk.com/robot/send?access_token=7eed4b3483303c9ec71ef37a08c347bb597fd4c64211a96a8f55f72405ff6444
|
||||||
# 如果使用加签安全设置,请填写密钥(secret)
|
# 如果使用加签安全设置,请填写密钥(secret)
|
||||||
dingtalk.secret=SEC0f2b835f28139905e3c0b5be979b215df1735f1154f36514aafbae8708014148
|
dingtalk.secret=SEC0f2b835f28139905e3c0b5be979b215df1735f1154f36514aafbae8708014148
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ===================== Knife4j 核心增强配置 =====================
|
||||||
|
# 启用Knife4j增强模式
|
||||||
|
knife4j.enable=true
|
||||||
|
knife4j.setting.language=zh_cn
|
||||||
|
knife4j.basic.enable=true
|
||||||
|
knife4j.basic.username=corewing
|
||||||
|
knife4j.basic.password=Aaa123..
|
||||||
|
# ===================== Knife4j OpenAPI 全局文档配置 =====================
|
||||||
|
# 文档标题
|
||||||
|
knife4j.openapi.title=CoreWing APP API
|
||||||
|
# 文档描述(支持Markdown,换行用\n,特殊符号保留)
|
||||||
|
|
||||||
|
knife4j.openapi.description=
|
||||||
|
# 作者邮箱
|
||||||
|
knife4j.openapi.email=
|
||||||
|
# 联系人
|
||||||
|
knife4j.openapi.concat=
|
||||||
|
# 文档官网地址
|
||||||
|
knife4j.openapi.url=
|
||||||
|
# 文档版本
|
||||||
|
knife4j.openapi.version=v1.0
|
||||||
|
# 许可证
|
||||||
|
knife4j.openapi.license=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ===================== Knife4j 分组配置 =====================
|
||||||
|
# 分组名称
|
||||||
|
knife4j.openapi.group.test1.group-name=APP接口
|
||||||
|
# 接口扫描规则:package(按包扫描)、path(按路径匹配)、api(按注解匹配)
|
||||||
|
knife4j.openapi.group.test1.api-rule=package
|
||||||
|
# 按包扫描的资源(数组,用[索引]标识多个包)
|
||||||
|
knife4j.openapi.group.test1.api-rule-resources[0]=com.corewing.app.modules.app
|
||||||
|
# 若有多个包,继续添加索引
|
||||||
|
# knife4j.openapi.group.test1.api-rule-resources[1]=com.knife4j.demo.new4
|
||||||
|
|||||||
31
src/main/resources/mapper/AppModelCategoryMapper.xml
Normal file
31
src/main/resources/mapper/AppModelCategoryMapper.xml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?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.corewing.app.mapper.AppModelCategoryMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 基础查询SQL片段 -->
|
||||||
|
<sql id="selectVOSql">
|
||||||
|
select mc.*
|
||||||
|
from app_model_category mc
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="page" resultType="com.corewing.app.entity.AppModelCategory">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
<where>
|
||||||
|
<if test="modelCategoryPageRequest.searchKey != null and modelCategoryPageRequest.searchKey != ''">
|
||||||
|
AND mc.name like CONCAT('%', #{modelCategoryPageRequest.searchKey}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="list" resultType="com.corewing.app.entity.AppModelCategory">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
<where>
|
||||||
|
<if test="modelCategoryListRequest.searchKey != null and modelCategoryListRequest.searchKey != ''">
|
||||||
|
AND mc.name like CONCAT('%', #{modelCategoryListRequest.searchKey}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
107
src/main/resources/mapper/AppModelMapper.xml
Normal file
107
src/main/resources/mapper/AppModelMapper.xml
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<?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.corewing.app.mapper.AppModelMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 基础查询SQL片段 -->
|
||||||
|
<sql id="selectVOSql">
|
||||||
|
select m.*,mc.name as categoryTitle
|
||||||
|
from app_model m
|
||||||
|
left join app_model_category mc on m.category_id = mc.id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="page" resultType="com.corewing.app.entity.AppModel">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
<where>
|
||||||
|
<if test="modelPageRequest.userId != null and modelPageRequest.userId != ''">
|
||||||
|
AND m.user_id = #{modelPageRequest.userId}
|
||||||
|
</if>
|
||||||
|
<if test="modelPageRequest.status != null and modelPageRequest.status != ''">
|
||||||
|
AND m.status = #{modelPageRequest.status}
|
||||||
|
</if>
|
||||||
|
<if test="modelPageRequest.isPublic != null and modelPageRequest.isPublic != ''">
|
||||||
|
AND m.is_public = #{modelPageRequest.isPublic}
|
||||||
|
</if>
|
||||||
|
<if test="modelPageRequest.searchKey != null and modelPageRequest.searchKey != ''">
|
||||||
|
AND m.title like CONCAT('%', #{modelPageRequest.searchKey}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="modelPageRequest.categoryId != null and modelPageRequest.categoryId != ''">
|
||||||
|
AND m.category_id = #{modelPageRequest.categoryId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="list" resultType="com.corewing.app.entity.AppModel">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
<where>
|
||||||
|
<if test="modelListRequest.userId != null and modelListRequest.userId != ''">
|
||||||
|
AND m.user_id = #{modelListRequest.userId}
|
||||||
|
</if>
|
||||||
|
<if test="modelListRequest.status != null and modelListRequest.status != ''">
|
||||||
|
AND m.status = #{modelListRequest.status}
|
||||||
|
</if>
|
||||||
|
<if test="modelListRequest.isPublic != null and modelListRequest.isPublic != ''">
|
||||||
|
AND m.is_public = #{modelListRequest.isPublic}
|
||||||
|
</if>
|
||||||
|
<if test="modelListRequest.searchKey != null and modelListRequest.searchKey != ''">
|
||||||
|
AND m.title like CONCAT('%', #{modelListRequest.searchKey}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="modelListRequest.categoryId != null and modelListRequest.categoryId != ''">
|
||||||
|
AND m.category_id = #{modelListRequest.categoryId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getModelById" resultType="com.corewing.app.entity.AppModel">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
<where>
|
||||||
|
and m.id = #{modelId}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="favoriteList" resultType="com.corewing.app.entity.AppModel">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
left join app_model_favorite mf on mf.model_id = m.id
|
||||||
|
<where>
|
||||||
|
AND mf.user_id = #{userId}
|
||||||
|
<if test="modelFavoriteListRequest.searchKey != null and modelFavoriteListRequest.searchKey != ''">
|
||||||
|
AND m.title like CONCAT('%', #{modelFavoriteListRequest.searchKey}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="favoritePage" resultType="com.corewing.app.entity.AppModel">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
left join app_model_favorite mf on mf.model_id = m.id
|
||||||
|
<where>
|
||||||
|
AND mf.user_id = #{userId}
|
||||||
|
<if test="modelFavoritePageRequest.searchKey != null and modelFavoritePageRequest.searchKey != ''">
|
||||||
|
AND m.title like CONCAT('%', #{modelFavoritePageRequest.searchKey}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="downloadLogList" resultType="com.corewing.app.entity.AppModel">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
left join app_model_download_log mol on mol.model_id = m.id
|
||||||
|
<where>
|
||||||
|
AND mf.user_id = #{userId}
|
||||||
|
<if test="modelDownloadLogListRequest.searchKey != null and modelDownloadLogListRequest.searchKey != ''">
|
||||||
|
AND m.title like CONCAT('%', #{modelDownloadLogListRequest.searchKey}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="downloadLogPage" resultType="com.corewing.app.entity.AppModel">
|
||||||
|
<include refid="selectVOSql"/>
|
||||||
|
left join app_model_download_log mol on mol.model_id = m.id
|
||||||
|
<where>
|
||||||
|
AND mf.user_id = #{userId}
|
||||||
|
<if test="modelDownloadLogPageRequest.searchKey != null and modelDownloadLogPageRequest.searchKey != ''">
|
||||||
|
AND m.title like CONCAT('%', #{modelDownloadLogPageRequest.searchKey}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
BIN
src/main/resources/static/favicon.ico
Executable file
BIN
src/main/resources/static/favicon.ico
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
Reference in New Issue
Block a user