Merge remote-tracking branch 'origin/dev_shb' into dev-xp
# Conflicts: # src/main/java/com/ai/da/python/PythonService.java # src/main/java/com/ai/da/service/impl/DesignServiceImpl.java
This commit is contained in:
@@ -5,6 +5,7 @@ import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.DesignCollectionVO;
|
||||
import com.ai.da.model.vo.DesignLikeVO;
|
||||
import com.ai.da.service.DesignService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
@@ -26,7 +27,7 @@ public class DesignController {
|
||||
|
||||
@ApiOperation(value = "设计 Conllection")
|
||||
@PostMapping("/designCollection")
|
||||
public Response<DesignCollectionVO> designCollection(@Valid @RequestBody DesignCollectionDTO designDTO) {
|
||||
public Response<JSONObject> designCollection(@Valid @RequestBody DesignCollectionDTO designDTO) {
|
||||
return Response.success(designService.designCollection(designDTO));
|
||||
}
|
||||
|
||||
|
||||
@@ -37,4 +37,5 @@ public class ThirdPartyController {
|
||||
public Response<Boolean> editUser( @RequestBody AccountEditDTO accountEditDTO) {
|
||||
return Response.success(accountService.editUser(accountEditDTO));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
111
src/main/java/com/ai/da/controller/WorkspaceController.java
Normal file
111
src/main/java/com/ai/da/controller/WorkspaceController.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.mapper.entity.Account;
|
||||
import com.ai.da.mapper.entity.UserLikeGroup;
|
||||
import com.ai.da.mapper.entity.Workspace;
|
||||
import com.ai.da.model.dto.QueryHistoryPageDTO;
|
||||
import com.ai.da.model.dto.WorkspaceDTO;
|
||||
import com.ai.da.model.enums.BizJson;
|
||||
import com.ai.da.model.vo.AuthPrincipalVo;
|
||||
import com.ai.da.model.vo.UserLikeGroupVO;
|
||||
import com.ai.da.model.vo.UserLikeVO;
|
||||
import com.ai.da.model.vo.WorkspaceVO;
|
||||
import com.ai.da.service.WorkspaceService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.Query;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.base.Function;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-08-01
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/api/workspace")
|
||||
@Api(value = "", tags = "接口")
|
||||
public class WorkspaceController {
|
||||
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@ApiOperation(value = "详情", notes = "传入workspace")
|
||||
public Response<Workspace> detail(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) {
|
||||
Workspace detail = workspaceService.getById(id);
|
||||
return Response.success(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@ApiOperation(value = "分页", notes = "传入workspace")
|
||||
public Response<PageBaseResponse<Workspace>> list(@Valid @RequestBody WorkspaceDTO query) {
|
||||
IPage<Workspace> convert = workspaceService.getPage(query);
|
||||
return Response.success(PageBaseResponse.success(convert));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或编辑
|
||||
*/
|
||||
@PostMapping("/saveOrUpdate")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@ApiOperation(value = "新增或编辑", notes = "传入workspace")
|
||||
public Response saveOrUpdate(@Valid @RequestBody Workspace workspace) {
|
||||
return Response.success(workspaceService.saveOrUpdate(workspace));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@ApiOperation(value = "删除", notes = "传入id")
|
||||
public Response remove(@ApiParam(value = "主键集合", required = true) @RequestParam Long id) {
|
||||
return Response.success(workspaceService.removeById(id));
|
||||
}
|
||||
|
||||
@GetMapping("/enumValues")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@ApiOperation(value = "获取枚举类值")
|
||||
public Response<List<BizJson>> enumValues(@RequestParam("enumName") String enumName) {
|
||||
List<BizJson> bizJsonList = workspaceService.getEnumValues(enumName);
|
||||
return Response.success(bizJsonList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ai.da.mapper;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfitDetail;
|
||||
import com.ai.da.model.vo.TDesignPythonOutfitDetailVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* design item详情表 Mapper 接口
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-09-04
|
||||
*/
|
||||
public interface TDesignPythonOutfitDetailMapper extends CommonMapper<TDesignPythonOutfitDetail> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page
|
||||
* @param tDesignPythonOutfitDetail
|
||||
* @return
|
||||
*/
|
||||
List<TDesignPythonOutfitDetailVO> selectTDesignPythonOutfitDetailPage(IPage page, TDesignPythonOutfitDetailVO tDesignPythonOutfitDetail);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ai.da.mapper;
|
||||
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfit;
|
||||
import com.ai.da.model.vo.TDesignPythonOutfitVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* design item表 存对应design的8张图片 Mapper 接口
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-09-04
|
||||
*/
|
||||
public interface TDesignPythonOutfitMapper extends CommonMapper<TDesignPythonOutfit> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page
|
||||
* @param tDesignPythonOutfit
|
||||
* @return
|
||||
*/
|
||||
List<TDesignPythonOutfitVO> selectTDesignPythonOutfitPage(IPage page, TDesignPythonOutfitVO tDesignPythonOutfit);
|
||||
|
||||
}
|
||||
27
src/main/java/com/ai/da/mapper/WorkspaceMapper.java
Normal file
27
src/main/java/com/ai/da/mapper/WorkspaceMapper.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.ai.da.mapper;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
import com.ai.da.mapper.entity.Workspace;
|
||||
import com.ai.da.model.vo.WorkspaceVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-08-01
|
||||
*/
|
||||
public interface WorkspaceMapper extends CommonMapper<Workspace> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page
|
||||
* @param workspace
|
||||
* @return
|
||||
*/
|
||||
List<WorkspaceVO> selectWorkspacePage(IPage page, WorkspaceVO workspace);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
|
||||
package com.ai.da.mapper.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* design item表 存对应design的8张图片实体类
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-08-30
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "TDesignPythonOutfit对象", description = "design item表 存对应design的8张图片")
|
||||
public class TDesignPythonOutfit implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 关联的design ID
|
||||
*/
|
||||
@ApiModelProperty(value = "关联的design ID")
|
||||
private Long designId;
|
||||
/**
|
||||
* 关联的collection ID
|
||||
*/
|
||||
@ApiModelProperty(value = "关联的collection ID")
|
||||
private Long collectionId;
|
||||
/**
|
||||
* design后的用户文件地址(python 返回)
|
||||
*/
|
||||
@ApiModelProperty(value = "design后的用户文件地址(python 返回)")
|
||||
private String designUrl;
|
||||
/**
|
||||
* 保存用户ID
|
||||
*/
|
||||
@ApiModelProperty(value = "保存用户ID")
|
||||
private Long userId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createDate;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateDate;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private String isDeleted;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
|
||||
package com.ai.da.mapper.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* design item详情表实体类
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-08-31
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "TDesignPythonOutfitDetail对象", description = "design item详情表")
|
||||
public class TDesignPythonOutfitDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 关联的design ID
|
||||
*/
|
||||
@ApiModelProperty(value = "关联的design ID")
|
||||
private Long designId;
|
||||
/**
|
||||
* 关联的design_item ID
|
||||
*/
|
||||
@ApiModelProperty(value = "关联的design_item ID")
|
||||
private Long designPythonOutfitId;
|
||||
/**
|
||||
* 关联的elementId 没有为null
|
||||
*/
|
||||
@ApiModelProperty(value = "关联的elementId 没有为null")
|
||||
private Long collectionElementId;
|
||||
/**
|
||||
* 图层
|
||||
*/
|
||||
@ApiModelProperty(value = "图层")
|
||||
private String imageCategory;
|
||||
/**
|
||||
* 对应的图片的绝对路径
|
||||
*/
|
||||
@ApiModelProperty(value = "对应的图片的绝对路径")
|
||||
private String imageUrl;
|
||||
/**
|
||||
* mask_url
|
||||
*/
|
||||
@ApiModelProperty(value = "mask_url")
|
||||
private String maskUrl;
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
@ApiModelProperty(value = "位置")
|
||||
private String position;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createDate;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateDate;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
}
|
||||
85
src/main/java/com/ai/da/mapper/entity/Workspace.java
Normal file
85
src/main/java/com/ai/da/mapper/entity/Workspace.java
Normal file
@@ -0,0 +1,85 @@
|
||||
|
||||
package com.ai.da.mapper.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 实体类
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-08-01
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "Workspace对象", description = "Workspace对象")
|
||||
@TableName("workspace")
|
||||
public class Workspace implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 工作空间名称
|
||||
*/
|
||||
@ApiModelProperty(value = "工作空间名称")
|
||||
private String workSpaceName;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String userName;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@ApiModelProperty(value = "性别")
|
||||
private String sex;
|
||||
/**
|
||||
* 服装部位
|
||||
*/
|
||||
@ApiModelProperty(value = "服装部位")
|
||||
private String position;
|
||||
/**
|
||||
* SYSTEM_DESIGNER占比
|
||||
*/
|
||||
@ApiModelProperty(value = "SYSTEM_DESIGNER占比")
|
||||
private Integer systemDesignerPercentage;
|
||||
/**
|
||||
* 人体模型
|
||||
*/
|
||||
@ApiModelProperty(value = "人体模型")
|
||||
private String mannequin;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableLogic
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
}
|
||||
20
src/main/java/com/ai/da/model/dto/WorkspaceDTO.java
Normal file
20
src/main/java/com/ai/da/model/dto/WorkspaceDTO.java
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import com.ai.da.mapper.entity.Workspace;
|
||||
import com.ai.da.model.vo.PageQueryBaseVo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 数据传输对象实体类
|
||||
*
|
||||
* @author Arcana
|
||||
* @since 2023-08-01
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WorkspaceDTO extends PageQueryBaseVo {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
41
src/main/java/com/ai/da/model/enums/BizJson.java
Normal file
41
src/main/java/com/ai/da/model/enums/BizJson.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BizJson implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public BizJson() {}
|
||||
|
||||
public BizJson(String name, String key, String value) {
|
||||
this.name = name;
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public BizJson(String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 参数主键
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 参数默认值
|
||||
*/
|
||||
private String value;
|
||||
}
|
||||
10
src/main/java/com/ai/da/model/enums/IEnumDisplay.java
Normal file
10
src/main/java/com/ai/da/model/enums/IEnumDisplay.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
public interface IEnumDisplay {
|
||||
|
||||
|
||||
String getValue();
|
||||
|
||||
String name();
|
||||
|
||||
}
|
||||
28
src/main/java/com/ai/da/model/enums/Mannequin.java
Normal file
28
src/main/java/com/ai/da/model/enums/Mannequin.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* @Author: SHAHAIBO
|
||||
* @Date: 2023/08/01 17:21
|
||||
* @Description: 服装性别分类
|
||||
*/
|
||||
public enum Mannequin implements IEnumDisplay {
|
||||
|
||||
A("A"),
|
||||
B("B"),
|
||||
C("C")
|
||||
;
|
||||
|
||||
private String value;
|
||||
|
||||
Mannequin(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
27
src/main/java/com/ai/da/model/enums/Position.java
Normal file
27
src/main/java/com/ai/da/model/enums/Position.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* @Author: SHAHAIBO
|
||||
* @Date: 2023/08/01 17:21
|
||||
* @Description: 服装性别分类
|
||||
*/
|
||||
public enum Position implements IEnumDisplay {
|
||||
|
||||
OVERALL("整体"),
|
||||
SINGLE("部位")
|
||||
;
|
||||
|
||||
private String value;
|
||||
|
||||
Position(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
28
src/main/java/com/ai/da/model/enums/Sex.java
Normal file
28
src/main/java/com/ai/da/model/enums/Sex.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* @Author: SHAHAIBO
|
||||
* @Date: 2023/08/01 17:21
|
||||
* @Description: 服装性别分类
|
||||
*/
|
||||
public enum Sex implements IEnumDisplay {
|
||||
|
||||
MALE("男装"),
|
||||
FEMALE("女装"),
|
||||
CHILD("童装")
|
||||
;
|
||||
|
||||
private String value;
|
||||
|
||||
Sex(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfitDetail;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
/**
|
||||
* design item详情表视图实体类
|
||||
*
|
||||
* @author Arcana
|
||||
* @since 2023-09-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "TDesignPythonOutfitDetailVO对象", description = "design item详情表")
|
||||
public class TDesignPythonOutfitDetailVO extends TDesignPythonOutfitDetail {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
22
src/main/java/com/ai/da/model/vo/TDesignPythonOutfitVO.java
Normal file
22
src/main/java/com/ai/da/model/vo/TDesignPythonOutfitVO.java
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfit;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
/**
|
||||
* design item表 存对应design的8张图片视图实体类
|
||||
*
|
||||
* @author Arcana
|
||||
* @since 2023-09-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "TDesignPythonOutfitVO对象", description = "design item表 存对应design的8张图片")
|
||||
public class TDesignPythonOutfitVO extends TDesignPythonOutfit {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
21
src/main/java/com/ai/da/model/vo/WorkspaceVO.java
Normal file
21
src/main/java/com/ai/da/model/vo/WorkspaceVO.java
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import com.ai.da.mapper.entity.Workspace;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
/**
|
||||
* 视图实体类
|
||||
*
|
||||
* @author Arcana
|
||||
* @since 2023-08-01
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "WorkspaceVO对象", description = "WorkspaceVO对象")
|
||||
public class WorkspaceVO extends Workspace {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -5,6 +5,7 @@ import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.DesignCollectionVO;
|
||||
import com.ai.da.model.vo.DesignItemDetailVO;
|
||||
import com.ai.da.model.vo.DesignLikeVO;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -21,7 +22,7 @@ public interface DesignService extends IService<Design> {
|
||||
* @param designDTO
|
||||
* @return
|
||||
*/
|
||||
DesignCollectionVO designCollection(DesignCollectionDTO designDTO);
|
||||
JSONObject designCollection(DesignCollectionDTO designDTO);
|
||||
|
||||
/**
|
||||
* redesign
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfitDetail;
|
||||
import com.ai.da.model.vo.TDesignPythonOutfitDetailVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* design item详情表 服务类
|
||||
*
|
||||
* @author Arcana
|
||||
* @since 2023-09-04
|
||||
*/
|
||||
public interface ITDesignPythonOutfitDetailService extends IService<TDesignPythonOutfitDetail> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page
|
||||
* @param tDesignPythonOutfitDetail
|
||||
* @return
|
||||
*/
|
||||
IPage<TDesignPythonOutfitDetailVO> selectTDesignPythonOutfitDetailPage(IPage<TDesignPythonOutfitDetailVO> page, TDesignPythonOutfitDetailVO tDesignPythonOutfitDetail);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfit;
|
||||
import com.ai.da.model.vo.TDesignPythonOutfitVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
/**
|
||||
* design item表 存对应design的8张图片 服务类
|
||||
*
|
||||
* @author Arcana
|
||||
* @since 2023-09-04
|
||||
*/
|
||||
public interface ITDesignPythonOutfitService extends IService<TDesignPythonOutfit> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page
|
||||
* @param tDesignPythonOutfit
|
||||
* @return
|
||||
*/
|
||||
IPage<TDesignPythonOutfitVO> selectTDesignPythonOutfitPage(IPage<TDesignPythonOutfitVO> page, TDesignPythonOutfitVO tDesignPythonOutfit);
|
||||
|
||||
}
|
||||
36
src/main/java/com/ai/da/service/WorkspaceService.java
Normal file
36
src/main/java/com/ai/da/service/WorkspaceService.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
|
||||
import com.ai.da.mapper.entity.Workspace;
|
||||
import com.ai.da.model.dto.WorkspaceDTO;
|
||||
import com.ai.da.model.enums.BizJson;
|
||||
import com.ai.da.model.vo.WorkspaceVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务类
|
||||
*
|
||||
* @author Arcana
|
||||
* @since 2023-08-01
|
||||
*/
|
||||
public interface WorkspaceService extends IService<Workspace> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page
|
||||
* @param workspace
|
||||
* @return
|
||||
*/
|
||||
IPage<WorkspaceVO> selectWorkspacePage(IPage<WorkspaceVO> page, WorkspaceVO workspace);
|
||||
|
||||
boolean saveOrUpdate(Workspace workspace);
|
||||
|
||||
IPage<Workspace> getPage(WorkspaceDTO query);
|
||||
|
||||
List<BizJson> getEnumValues(String enumName);
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import com.ai.da.common.utils.DateUtil;
|
||||
import com.ai.da.common.utils.FileUtil;
|
||||
import com.ai.da.common.utils.LocalCacheUtils;
|
||||
import com.ai.da.mapper.DesignMapper;
|
||||
import com.ai.da.mapper.TDesignPythonOutfitDetailMapper;
|
||||
import com.ai.da.mapper.TDesignPythonOutfitMapper;
|
||||
import com.ai.da.mapper.entity.*;
|
||||
import com.ai.da.mapper.entity.Collection;
|
||||
import com.ai.da.model.dto.*;
|
||||
@@ -22,6 +24,8 @@ import com.ai.da.python.vo.DesignPythonItemPrint;
|
||||
import com.ai.da.python.vo.DesignPythonObjects;
|
||||
import com.ai.da.service.*;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -76,16 +80,20 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
@Resource
|
||||
private TCollectionElementRelationService tCollectionElementRelationService;
|
||||
@Resource
|
||||
private ITDesignPythonOutfitService designPythonOutfitService;
|
||||
@Resource
|
||||
private ITDesignPythonOutfitDetailService designPythonOutfitDetailService;
|
||||
@Resource
|
||||
private PanToneService panToneService;
|
||||
|
||||
// @Transactional
|
||||
@Override
|
||||
public DesignCollectionVO designCollection(DesignCollectionDTO designDTO) {
|
||||
public JSONObject designCollection(DesignCollectionDTO designDTO) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
//校验collection element
|
||||
ValidateElementVO elementVO =collectionElementService.validateElement(designDTO);
|
||||
//design
|
||||
return designOrRedesignOperate(designDTO,userInfo,null,elementVO);
|
||||
return designOrRedesignOperateNew(designDTO,userInfo,null,elementVO);
|
||||
}
|
||||
private void calculateLibraryAndSysFile(DesignCollectionDTO designDTO,ValidateElementVO elementVO,AuthPrincipalVo userInfo){
|
||||
//查询用户 sketch library
|
||||
@@ -183,16 +191,61 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
//缓存保存的文件 方便后面处理进度问题
|
||||
setDesignProcess(userInfo.getId(),pythonObjects);
|
||||
//design
|
||||
pythonService.design(pythonObjects);
|
||||
JSONObject responseJSONObject= pythonService.designNew(pythonObjects);
|
||||
//生成library
|
||||
generateLibrary(elementVO,designDTO.getTimeZone());
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
List<CollectionElement> reLationelements =collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
List<Long> reLationelementIds = reLationelements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
handleCollectionElementRelation(collectionId,(null == collectionIdParam) ? false :true,reLationelementIds);
|
||||
//保存python返回信息
|
||||
// return savePythonDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone(),responseJSONObject);
|
||||
//保存designItem 和detail
|
||||
return saveDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone());
|
||||
}
|
||||
|
||||
private JSONObject designOrRedesignOperateNew(DesignCollectionDTO designDTO,AuthPrincipalVo userInfo,
|
||||
Long collectionIdParam,ValidateElementVO elementVO){
|
||||
if(CollectionUtil.isNotEmpty(designDTO.getSketchBoards())){
|
||||
//编辑sketchBoard
|
||||
collectionElementService.editSketchBoardsElement(elementVO,designDTO.getSketchBoards());
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(designDTO.getPrintBoards())){
|
||||
//编辑printBoard
|
||||
collectionElementService.editPrintBoardsElement(elementVO,designDTO.getPrintBoards());
|
||||
}
|
||||
//保存collection
|
||||
Long collectionId = (null == collectionIdParam) ?
|
||||
collectionService.saveCollection(userInfo.getId(),designDTO.getTimeZone(),designDTO.getMoodTemplateId()) : collectionIdParam;
|
||||
List<Long> elementIds =getElementId(elementVO);
|
||||
//批量关联element 到 collection
|
||||
collectionElementService.relationCollection(elementIds,collectionId);
|
||||
//library转化为collection(生成)
|
||||
saveCollectionElemntsByLibrarys(elementVO,collectionId);
|
||||
//保存颜色版
|
||||
List<CollectionElementVO> colorElementList = collectionElementService.saveColorBoard(designDTO.getColorBoards(),collectionId,designDTO.getTimeZone());
|
||||
//保存design
|
||||
Long designId = saveOne(designDTO,collectionId,userInfo.getId());
|
||||
//计算library
|
||||
calculateLibraryAndSysFile(designDTO,elementVO,userInfo);
|
||||
//组装design入参
|
||||
DesignPythonObjects pythonObjects =pythonService.covertDesignParam(designDTO.getSystemScale(),
|
||||
designDTO.getSingleOverall(),designDTO.getSwitchCategory(),elementVO);
|
||||
//缓存保存的文件 方便后面处理进度问题
|
||||
setDesignProcess(userInfo.getId(),pythonObjects);
|
||||
//design
|
||||
JSONObject responseJSONObject= pythonService.designNew(pythonObjects);
|
||||
//生成library
|
||||
generateLibrary(elementVO,designDTO.getTimeZone());
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
List<CollectionElement> reLationelements =collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
List<Long> reLationelementIds = reLationelements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
handleCollectionElementRelation(collectionId,(null == collectionIdParam) ? false :true,reLationelementIds);
|
||||
//保存python返回信息
|
||||
return savePythonDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone(),responseJSONObject);
|
||||
//保存designItem 和detail
|
||||
// return saveDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone());
|
||||
}
|
||||
private void handleCollectionElementRelation(Long collectionId ,Boolean isEdit,List<Long> elementIds ){
|
||||
if (CollectionUtils.isEmpty(elementIds) || collectionId == null){
|
||||
return;
|
||||
@@ -263,6 +316,79 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
return object.getBasic().getSave_name();}).collect(Collectors.toList());
|
||||
LocalCacheUtils.setDesignProcessCache(userId,saveNames);
|
||||
}
|
||||
private JSONObject savePythonDesignItemAndDetail(DesignPythonObjects pythonObjects
|
||||
,Long designId,Long collectionId,AuthPrincipalVo userInfo,String timeZone, JSONObject responseJSONObject){
|
||||
DesignCollectionVO response = new DesignCollectionVO();
|
||||
response.setDesignId(designId);
|
||||
response.setCollectionId(collectionId);
|
||||
List<DesignCollectionItemVO> designCollectionItems = Lists.newArrayList();
|
||||
response.setDesignCollectionItems(designCollectionItems);
|
||||
|
||||
pythonObjects.getObjects().forEach(item ->{
|
||||
DesignItem designItem = new DesignItem();
|
||||
designItem.setAccountId(userInfo.getId());
|
||||
designItem.setCollectionId(collectionId);
|
||||
designItem.setDesignId(designId);
|
||||
designItem.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
//生成的八张图片
|
||||
designItem.setDesignUrl(item.getBasic().getSave_name());
|
||||
designItem.setHasLike((byte)0);
|
||||
//生成designItem
|
||||
Long designItemId = designItemService.saveOne(designItem);
|
||||
//response
|
||||
designCollectionItems.add(new DesignCollectionItemVO(designItemId,designItem.getDesignUrl()));
|
||||
|
||||
List<DesignItemDetail> designItemDetails = Lists.newArrayList();
|
||||
item.getItems().forEach(detail ->{
|
||||
if(null == detail){
|
||||
return;
|
||||
}
|
||||
DesignItemDetail designItemDetail = CopyUtil.copyObject(detail,DesignItemDetail.class);
|
||||
designItemDetail.setAccountId(userInfo.getId());
|
||||
designItemDetail.setDesignId(designId);
|
||||
designItemDetail.setDesignItemId(designItemId);
|
||||
designItemDetail.setCollectionElementId(detail.getElementId());
|
||||
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
if(SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())){
|
||||
designItemDetail.setPath(detail.getBody_path());
|
||||
//BODY不关联businessId
|
||||
designItemDetail.setBusinessId(0L);
|
||||
}
|
||||
designItemDetail.setIconPath(detail.getIcon());
|
||||
DesignPythonItemPrint printObject = detail.getPrint();
|
||||
designItemDetail.setPrintPath(Objects.isNull(printObject)? "" :printObject.getPath());
|
||||
designItemDetails.add(designItemDetail);
|
||||
});
|
||||
designItemDetailService.saveBatch(designItemDetails);
|
||||
});
|
||||
JSONObject data = responseJSONObject.getJSONObject("data");
|
||||
for (int i = 0; i < 8; i++) {
|
||||
JSONObject outfit = data.getJSONObject(i + "");
|
||||
TDesignPythonOutfit designPythonOutfit = new TDesignPythonOutfit();
|
||||
designPythonOutfit.setUserId(userInfo.getId());
|
||||
designPythonOutfit.setDesignId(designId);
|
||||
designPythonOutfit.setCollectionId(collectionId);
|
||||
designPythonOutfit.setDesignUrl(outfit.getString("synthesis_url"));
|
||||
designPythonOutfitService.save(designPythonOutfit);
|
||||
JSONArray layers = outfit.getJSONArray("layers");
|
||||
List<TDesignPythonOutfitDetail> list = new ArrayList<>();
|
||||
for (int i1 = 0; i1 < layers.size(); i1++) {
|
||||
JSONObject jsonObject = layers.getJSONObject(i1);
|
||||
TDesignPythonOutfitDetail designPythonOutfitDetail = new TDesignPythonOutfitDetail();
|
||||
designPythonOutfitDetail.setDesignId(designId);
|
||||
designPythonOutfitDetail.setDesignPythonOutfitId(designPythonOutfit.getId());
|
||||
designPythonOutfitDetail.setPosition(jsonObject.getString("position"));
|
||||
designPythonOutfitDetail.setImageUrl(jsonObject.getString("image_url"));
|
||||
designPythonOutfitDetail.setImageCategory(jsonObject.getString("image_category"));
|
||||
designPythonOutfitDetail.setMaskUrl(jsonObject.getString("mask_url"));
|
||||
designPythonOutfitDetail.setUserId(userInfo.getId());
|
||||
list.add(designPythonOutfitDetail);
|
||||
}
|
||||
designPythonOutfitDetailService.saveBatch(list);
|
||||
}
|
||||
return responseJSONObject;
|
||||
}
|
||||
|
||||
private DesignCollectionVO saveDesignItemAndDetail(DesignPythonObjects pythonObjects
|
||||
,Long designId,Long collectionId,AuthPrincipalVo userInfo,String timeZone){
|
||||
DesignCollectionVO response = new DesignCollectionVO();
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.mapper.TDesignPythonOutfitDetailMapper;
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfitDetail;
|
||||
import com.ai.da.model.vo.TDesignPythonOutfitDetailVO;
|
||||
import com.ai.da.service.ITDesignPythonOutfitDetailService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
/**
|
||||
* design item详情表 服务实现类
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-09-04
|
||||
*/
|
||||
@Service
|
||||
public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPythonOutfitDetailMapper, TDesignPythonOutfitDetail> implements ITDesignPythonOutfitDetailService {
|
||||
|
||||
@Override
|
||||
public IPage<TDesignPythonOutfitDetailVO> selectTDesignPythonOutfitDetailPage(IPage<TDesignPythonOutfitDetailVO> page, TDesignPythonOutfitDetailVO tDesignPythonOutfitDetail) {
|
||||
return page.setRecords(baseMapper.selectTDesignPythonOutfitDetailPage(page, tDesignPythonOutfitDetail));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.mapper.TDesignPythonOutfitMapper;
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfit;
|
||||
import com.ai.da.model.vo.TDesignPythonOutfitVO;
|
||||
import com.ai.da.service.ITDesignPythonOutfitService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
/**
|
||||
* design item表 存对应design的8张图片 服务实现类
|
||||
*
|
||||
* @author SHAHAIBO
|
||||
* @since 2023-09-04
|
||||
*/
|
||||
@Service
|
||||
public class TDesignPythonOutfitServiceImpl extends ServiceImpl<TDesignPythonOutfitMapper, TDesignPythonOutfit> implements ITDesignPythonOutfitService {
|
||||
|
||||
@Override
|
||||
public IPage<TDesignPythonOutfitVO> selectTDesignPythonOutfitPage(IPage<TDesignPythonOutfitVO> page, TDesignPythonOutfitVO tDesignPythonOutfit) {
|
||||
return page.setRecords(baseMapper.selectTDesignPythonOutfitPage(page, tDesignPythonOutfit));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.mapper.WorkspaceMapper;
|
||||
import com.ai.da.mapper.entity.Account;
|
||||
import com.ai.da.mapper.entity.Workspace;
|
||||
import com.ai.da.model.dto.WorkspaceDTO;
|
||||
import com.ai.da.model.enums.BizJson;
|
||||
import com.ai.da.model.enums.IEnumDisplay;
|
||||
import com.ai.da.model.vo.AuthPrincipalVo;
|
||||
import com.ai.da.model.vo.WorkspaceVO;
|
||||
import com.ai.da.service.WorkspaceService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
*
|
||||
* @author Arcana
|
||||
* @since 2023-08-01
|
||||
*/
|
||||
@Service
|
||||
public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace> implements WorkspaceService {
|
||||
|
||||
@Resource
|
||||
private WorkspaceMapper workspaceMapper;
|
||||
|
||||
@Override
|
||||
public IPage<WorkspaceVO> selectWorkspacePage(IPage<WorkspaceVO> page, WorkspaceVO workspace) {
|
||||
return page.setRecords(baseMapper.selectWorkspacePage(page, workspace));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveOrUpdate(Workspace workspace) {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
workspace.setUserName(userInfo.getUsername());
|
||||
if (null == workspace.getId()) {
|
||||
return workspaceMapper.insert(workspace) == 1;
|
||||
}else {
|
||||
return workspaceMapper.updateById(workspace) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<Workspace> getPage(WorkspaceDTO query) {
|
||||
String userName = UserContext.getUserHolder().getUsername();
|
||||
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Workspace::getUserName, userName);
|
||||
IPage<Workspace> page = workspaceMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BizJson> getEnumValues(String className) {
|
||||
Class clazz;
|
||||
try {
|
||||
clazz = Class.forName(IEnumDisplay.class.getPackage().getName() + "." + className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(className + "-枚举类型未找到");
|
||||
}
|
||||
return getEnumValues(clazz);
|
||||
}
|
||||
|
||||
private List<BizJson> getEnumValues(Class clazz) {
|
||||
List<BizJson> kvs = new ArrayList<BizJson>();
|
||||
IEnumDisplay[] items = (IEnumDisplay[]) clazz.getEnumConstants();
|
||||
for (IEnumDisplay item : items) {
|
||||
kvs.add(new BizJson(item.getValue(), item.name(), null));
|
||||
}
|
||||
return kvs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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.ai.da.mapper.TDesignPythonOutfitDetailMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="tDesignPythonOutfitDetailResultMap" type="com.ai.da.mapper.entity.TDesignPythonOutfitDetail">
|
||||
<id column="id" property="id"/>
|
||||
<result column="design_id" property="designId"/>
|
||||
<result column="design_python_outfit_id" property="designPythonOutfitId"/>
|
||||
<result column="collection_element_id" property="collectionElementId"/>
|
||||
<result column="image_category" property="imageCategory"/>
|
||||
<result column="image_url" property="imageUrl"/>
|
||||
<result column="mask_url" property="maskUrl"/>
|
||||
<result column="position" property="position"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="create_date" property="createDate"/>
|
||||
<result column="update_date" property="updateDate"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectTDesignPythonOutfitDetailPage" resultMap="tDesignPythonOutfitDetailResultMap">
|
||||
select * from t_design_python_outfit_detail where is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
22
src/main/resources/mapper/TDesignPythonOutfitMapper.xml
Normal file
22
src/main/resources/mapper/TDesignPythonOutfitMapper.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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.ai.da.mapper.TDesignPythonOutfitMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="tDesignPythonOutfitResultMap" type="com.ai.da.mapper.entity.TDesignPythonOutfit">
|
||||
<id column="id" property="id"/>
|
||||
<result column="design_id" property="designId"/>
|
||||
<result column="collection_id" property="collectionId"/>
|
||||
<result column="design_url" property="designUrl"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="create_date" property="createDate"/>
|
||||
<result column="update_date" property="updateDate"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectTDesignPythonOutfitPage" resultMap="tDesignPythonOutfitResultMap">
|
||||
select * from t_design_python_outfit where is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
24
src/main/resources/mapper/WorkspaceMapper.xml
Normal file
24
src/main/resources/mapper/WorkspaceMapper.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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.ai.da.mapper.WorkspaceMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.ai.da.mapper.entity.Workspace">
|
||||
<id column="id" property="id"/>
|
||||
<result column="work_space_name" property="workSpaceName"/>
|
||||
<result column="user_name" property="userName"/>
|
||||
<result column="sex" property="sex"/>
|
||||
<result column="position" property="position"/>
|
||||
<result column="system_designer_percentage" property="systemDesignerPercentage"/>
|
||||
<result column="mannequin" property="mannequin"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectWorkspacePage" resultMap="BaseResultMap">
|
||||
select * from workspace where is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user