diff --git a/adi-chat/src/main/java/com/moyz/adi/chat/controller/ConversationController.java b/adi-chat/src/main/java/com/moyz/adi/chat/controller/ConversationController.java index 617ac1f..8d0fbff 100644 --- a/adi-chat/src/main/java/com/moyz/adi/chat/controller/ConversationController.java +++ b/adi-chat/src/main/java/com/moyz/adi/chat/controller/ConversationController.java @@ -1,5 +1,6 @@ package com.moyz.adi.chat.controller; +import com.moyz.adi.common.dto.ConvAddReq; import com.moyz.adi.common.dto.ConvDto; import com.moyz.adi.common.dto.ConvEditReq; import com.moyz.adi.common.service.ConversationService; @@ -11,6 +12,7 @@ import jakarta.annotation.Resource; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -42,6 +44,11 @@ public class ConversationController { return conversationService.detail(uuid, maxMsgUuid, pageSize); } + @PostMapping("/add") + public ConvDto add(@RequestBody @Validated ConvAddReq convAddReq) { + return conversationService.add(convAddReq.getTitle(), convAddReq.getAiSystemMessage()); + } + @PostMapping("/edit/{uuid}") public boolean edit(@PathVariable String uuid, @RequestBody ConvEditReq convEditReq) { return conversationService.edit(uuid, convEditReq); diff --git a/adi-chat/src/main/java/com/moyz/adi/chat/controller/KnowledgeBaseController.java b/adi-chat/src/main/java/com/moyz/adi/chat/controller/KnowledgeBaseController.java index 6e0dfcf..9fbdac1 100644 --- a/adi-chat/src/main/java/com/moyz/adi/chat/controller/KnowledgeBaseController.java +++ b/adi-chat/src/main/java/com/moyz/adi/chat/controller/KnowledgeBaseController.java @@ -1,12 +1,15 @@ package com.moyz.adi.chat.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.moyz.adi.common.base.ThreadContext; import com.moyz.adi.common.dto.KbEditReq; +import com.moyz.adi.common.dto.KbInfoResp; import com.moyz.adi.common.entity.AdiFile; import com.moyz.adi.common.entity.KnowledgeBase; import com.moyz.adi.common.service.KnowledgeBaseService; import jakarta.annotation.Resource; import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; @@ -38,12 +41,12 @@ public class KnowledgeBaseController { } @GetMapping("/searchMine") - public Page searchMine(@RequestParam(defaultValue = "") String keyword, @RequestParam(defaultValue = "false") Boolean includeOthersPublic, @NotNull @Min(1) Integer currentPage, @NotNull @Min(10) Integer pageSize) { + public Page searchMine(@RequestParam(defaultValue = "") String keyword, @RequestParam(defaultValue = "false") Boolean includeOthersPublic, @NotNull @Min(1) Integer currentPage, @NotNull @Min(10) Integer pageSize) { return knowledgeBaseService.searchMine(keyword, includeOthersPublic, currentPage, pageSize); } @GetMapping("/searchPublic") - public Page searchPublic(@RequestParam(defaultValue = "") String keyword, @NotNull @Min(1) Integer currentPage, @NotNull @Min(10) Integer pageSize) { + public Page searchPublic(@RequestParam(defaultValue = "") String keyword, @NotNull @Min(1) Integer currentPage, @NotNull @Min(10) Integer pageSize) { return knowledgeBaseService.searchPublic(keyword, currentPage, pageSize); } @@ -70,8 +73,8 @@ public class KnowledgeBaseController { * * @return */ - @PostMapping("/star/{kbUuid}") - public boolean star(@PathVariable String kbUuid) { - return knowledgeBaseService.star(kbUuid); + @PostMapping("/star/toggle") + public boolean star(@RequestParam @NotBlank String kbUuid) { + return knowledgeBaseService.toggleStar(ThreadContext.getCurrentUser(), kbUuid); } } diff --git a/adi-chat/src/main/java/com/moyz/adi/chat/controller/KnowledgeBaseStarController.java b/adi-chat/src/main/java/com/moyz/adi/chat/controller/KnowledgeBaseStarController.java new file mode 100644 index 0000000..2d65a19 --- /dev/null +++ b/adi-chat/src/main/java/com/moyz/adi/chat/controller/KnowledgeBaseStarController.java @@ -0,0 +1,27 @@ +package com.moyz.adi.chat.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.moyz.adi.common.base.ThreadContext; +import com.moyz.adi.common.dto.KbStarInfoResp; +import com.moyz.adi.common.service.KnowledgeBaseStarRecordService; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Tag(name = "知识库点赞controller") +@Validated +@RequestMapping("/knowledge-base/star") +@RestController +public class KnowledgeBaseStarController { + + @Resource + private KnowledgeBaseStarRecordService knowledgeBaseStarRecordService; + + @GetMapping("/mine") + public Page stars(int currentPage, int pageSize) { + return knowledgeBaseStarRecordService.listStarInfo(ThreadContext.getCurrentUser(), currentPage, pageSize); + } +} diff --git a/adi-chat/src/main/java/com/moyz/adi/chat/controller/UserController.java b/adi-chat/src/main/java/com/moyz/adi/chat/controller/UserController.java index 0a10106..50a9b70 100644 --- a/adi-chat/src/main/java/com/moyz/adi/chat/controller/UserController.java +++ b/adi-chat/src/main/java/com/moyz/adi/chat/controller/UserController.java @@ -61,9 +61,9 @@ public class UserController { userService.logout(); } - @Operation(summary = "头像") - @GetMapping(value = "/avatar", produces = MediaType.IMAGE_JPEG_VALUE) - public void avatar(HttpServletResponse response) { + @Operation(summary = "当前用户头像") + @GetMapping(value = "/myAvatar", produces = MediaType.IMAGE_JPEG_VALUE) + public void myAvatar(HttpServletResponse response) { User user = ThreadContext.getCurrentUser(); Avatar avatar = CatAvatar.newAvatarBuilder().build(); BufferedImage bufferedImage = avatar.create(user.getId()); @@ -74,4 +74,22 @@ public class UserController { throw new RuntimeException(e); } } + + @Operation(summary = "用户头像") + @GetMapping(value = "/avatar/{uuid}", produces = MediaType.IMAGE_JPEG_VALUE) + public void avatar(@Validated @PathVariable String uuid, HttpServletResponse response){ + User user = userService.getByUuid(uuid); + long userId = 0; + if(null != user){ + userId = user.getId(); + } + Avatar avatar = CatAvatar.newAvatarBuilder().build(); + BufferedImage bufferedImage = avatar.create(userId); + //把图片写给浏览器 + try { + ImageIO.write(bufferedImage, "png", response.getOutputStream()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } } diff --git a/adi-common/src/main/java/com/moyz/adi/common/dto/ConvAddReq.java b/adi-common/src/main/java/com/moyz/adi/common/dto/ConvAddReq.java new file mode 100644 index 0000000..0ddd100 --- /dev/null +++ b/adi-common/src/main/java/com/moyz/adi/common/dto/ConvAddReq.java @@ -0,0 +1,14 @@ +package com.moyz.adi.common.dto; + +import jakarta.validation.constraints.NotBlank; +import lombok.Data; +import org.springframework.validation.annotation.Validated; + +@Data +@Validated +public class ConvAddReq { + + @NotBlank + private String title; + private String aiSystemMessage; +} diff --git a/adi-common/src/main/java/com/moyz/adi/common/dto/KbInfoResp.java b/adi-common/src/main/java/com/moyz/adi/common/dto/KbInfoResp.java new file mode 100644 index 0000000..ed3774e --- /dev/null +++ b/adi-common/src/main/java/com/moyz/adi/common/dto/KbInfoResp.java @@ -0,0 +1,14 @@ +package com.moyz.adi.common.dto; + +import lombok.Data; + +@Data +public class KbInfoResp { + private String uuid; + private String title; + private String remark; + private Boolean isPublic; + private Integer starCount; + private String ownerUuid; + private String ownerName; +} diff --git a/adi-common/src/main/java/com/moyz/adi/common/dto/KbStarInfoResp.java b/adi-common/src/main/java/com/moyz/adi/common/dto/KbStarInfoResp.java new file mode 100644 index 0000000..3c00441 --- /dev/null +++ b/adi-common/src/main/java/com/moyz/adi/common/dto/KbStarInfoResp.java @@ -0,0 +1,9 @@ +package com.moyz.adi.common.dto; + +import lombok.Data; + +@Data +public class KbStarInfoResp { + private String kbUuid; + private String kbTitle; +} diff --git a/adi-common/src/main/java/com/moyz/adi/common/entity/ConversationMessage.java b/adi-common/src/main/java/com/moyz/adi/common/entity/ConversationMessage.java index 6a460cb..5cca22b 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/entity/ConversationMessage.java +++ b/adi-common/src/main/java/com/moyz/adi/common/entity/ConversationMessage.java @@ -57,4 +57,8 @@ public class ConversationMessage extends BaseEntity { @Schema(name = "上下文理解中携带的消息对数量(提示词及回复)") @TableField("understand_context_msg_pair_num") private Integer understandContextMsgPairNum; + + @Schema(name = "LLM name") + @TableField("language_model_name") + private String languageModelName; } diff --git a/adi-common/src/main/java/com/moyz/adi/common/entity/KnowledgeBase.java b/adi-common/src/main/java/com/moyz/adi/common/entity/KnowledgeBase.java index 1e70424..5d85942 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/entity/KnowledgeBase.java +++ b/adi-common/src/main/java/com/moyz/adi/common/entity/KnowledgeBase.java @@ -28,7 +28,11 @@ public class KnowledgeBase extends BaseEntity { @Schema(title = "点赞数") @TableField("star_count") - private Long starCount; + private Integer starCount; + + @Schema(title = "所属人uuid") + @TableField("owner_uuid") + private String ownerUuid; @Schema(title = "所属人id") @TableField("owner_id") diff --git a/adi-common/src/main/java/com/moyz/adi/common/entity/KnowledgeBaseStarRecord.java b/adi-common/src/main/java/com/moyz/adi/common/entity/KnowledgeBaseStarRecord.java new file mode 100644 index 0000000..8151e35 --- /dev/null +++ b/adi-common/src/main/java/com/moyz/adi/common/entity/KnowledgeBaseStarRecord.java @@ -0,0 +1,29 @@ +package com.moyz.adi.common.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@TableName("adi_knowledge_base_star_record") +@Schema(title = "知识库点赞记录实体", description = "知识库点赞记录表") +public class KnowledgeBaseStarRecord extends BaseEntity { + + @Schema(title = "Knowledge base id") + @TableField("kb_id") + private Long kbId; + + @Schema(title = "Knowledge base uuid") + @TableField("kb_uuid") + private String kbUuid; + + @Schema(title = "User id") + @TableField("user_id") + private Long userId; + + @Schema(title = "User uuid") + @TableField("user_uuid") + private String userUuid; + +} diff --git a/adi-common/src/main/java/com/moyz/adi/common/enums/ErrorEnum.java b/adi-common/src/main/java/com/moyz/adi/common/enums/ErrorEnum.java index 061a9bc..26e5525 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/enums/ErrorEnum.java +++ b/adi-common/src/main/java/com/moyz/adi/common/enums/ErrorEnum.java @@ -22,6 +22,7 @@ public enum ErrorEnum { A_UPLOAD_FAIL("A0018", "上传失败"), A_QA_ASK_LIMIT("A0019", "请求次数太多"), A_QA_ITEM_LIMIT("A0020", "知识点生成已超额度"), + A_CONVERSATION_EXIST("A0021", "对话已存在"), B_UNCAUGHT_ERROR("B0001", "未捕捉异常"), B_COMMON_ERROR("B0002", "业务出错"), B_GLOBAL_ERROR("B0003", "全局异常"), diff --git a/adi-common/src/main/java/com/moyz/adi/common/mapper/KnowledgeBaseStarRecordMapper.java b/adi-common/src/main/java/com/moyz/adi/common/mapper/KnowledgeBaseStarRecordMapper.java new file mode 100644 index 0000000..9475d10 --- /dev/null +++ b/adi-common/src/main/java/com/moyz/adi/common/mapper/KnowledgeBaseStarRecordMapper.java @@ -0,0 +1,9 @@ +package com.moyz.adi.common.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.moyz.adi.common.entity.KnowledgeBaseStarRecord; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface KnowledgeBaseStarRecordMapper extends BaseMapper { +} diff --git a/adi-common/src/main/java/com/moyz/adi/common/searchengine/GoogleSearchEngine.java b/adi-common/src/main/java/com/moyz/adi/common/searchengine/GoogleSearchEngine.java index ddfbd21..335e185 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/searchengine/GoogleSearchEngine.java +++ b/adi-common/src/main/java/com/moyz/adi/common/searchengine/GoogleSearchEngine.java @@ -43,7 +43,7 @@ public class GoogleSearchEngine extends AbstractSearchEngine { result.setErrorMessage(googleSearchResp.getError().getMessage()); } else { log.info("google response:{}", resp); - items = MPPageUtil.convertTo(googleSearchResp.getItems(), SearchResultItem.class); + items = MPPageUtil.convertToList(googleSearchResp.getItems(), SearchResultItem.class); } } } catch (Exception e) { diff --git a/adi-common/src/main/java/com/moyz/adi/common/service/AiSearchRecordService.java b/adi-common/src/main/java/com/moyz/adi/common/service/AiSearchRecordService.java index a83caf3..fe49420 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/service/AiSearchRecordService.java +++ b/adi-common/src/main/java/com/moyz/adi/common/service/AiSearchRecordService.java @@ -14,7 +14,6 @@ import com.moyz.adi.common.util.BizPager; import com.moyz.adi.common.util.MPPageUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.util.ArrayList; @@ -45,7 +44,7 @@ public class AiSearchRecordService extends ServiceImpl { - List list = MPPageUtil.convertTo(recordList, AiSearchRecordResp.class); + List list = MPPageUtil.convertToList(recordList, AiSearchRecordResp.class); list.forEach(item -> { if(null == item.getSearchEngineResp()){ SearchEngineResp searchEngineResp = new SearchEngineResp(); diff --git a/adi-common/src/main/java/com/moyz/adi/common/service/ConversationMessageService.java b/adi-common/src/main/java/com/moyz/adi/common/service/ConversationMessageService.java index aa3797d..278777a 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/service/ConversationMessageService.java +++ b/adi-common/src/main/java/com/moyz/adi/common/service/ConversationMessageService.java @@ -228,6 +228,7 @@ public class ConversationMessageService extends ServiceImpl userMessages = MPPageUtil.convertTo(questions, ConvMsgResp.class); + List userMessages = MPPageUtil.convertToList(questions, ConvMsgResp.class); ConvMsgListResp result = new ConvMsgListResp(minUuid, userMessages); //Wrap answer content @@ -94,7 +95,7 @@ public class ConversationService extends ServiceImpl { - List children = MPPageUtil.convertTo(idToMessages.get(item.getId()), ConvMsgResp.class); + List children = MPPageUtil.convertToList(idToMessages.get(item.getId()), ConvMsgResp.class); if (children.size() > 1) { children = children.stream().sorted(Comparator.comparing(ConvMsgResp::getCreateTime).reversed()).collect(Collectors.toList()); } @@ -122,6 +123,27 @@ public class ConversationService extends ServiceImpl listByItemUuid(String kbItemUuid, int currentPage, int pageSize) { Page sourcePage = baseMapper.selectByItemUuid(new Page<>(currentPage, pageSize), kbItemUuid); Page result = new Page<>(); - MPPageUtil.convertTo(sourcePage, result, KbItemEmbeddingDto.class, (source, target) -> { + MPPageUtil.convertToPage(sourcePage, result, KbItemEmbeddingDto.class, (source, target) -> { target.setEmbedding(source.getEmbedding().toArray()); return target; }); diff --git a/adi-common/src/main/java/com/moyz/adi/common/service/KnowledgeBaseService.java b/adi-common/src/main/java/com/moyz/adi/common/service/KnowledgeBaseService.java index 832a9ab..e137c57 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/service/KnowledgeBaseService.java +++ b/adi-common/src/main/java/com/moyz/adi/common/service/KnowledgeBaseService.java @@ -9,6 +9,7 @@ import com.moyz.adi.common.base.ThreadContext; import com.moyz.adi.common.cosntant.AdiConstant; import com.moyz.adi.common.cosntant.RedisKeyConstant; import com.moyz.adi.common.dto.KbEditReq; +import com.moyz.adi.common.dto.KbInfoResp; import com.moyz.adi.common.dto.QAReq; import com.moyz.adi.common.entity.*; import com.moyz.adi.common.exception.BaseException; @@ -16,6 +17,7 @@ import com.moyz.adi.common.helper.SSEEmitterHelper; import com.moyz.adi.common.mapper.KnowledgeBaseMapper; import com.moyz.adi.common.util.BizPager; import com.moyz.adi.common.util.LocalDateTimeUtil; +import com.moyz.adi.common.util.MPPageUtil; import com.moyz.adi.common.vo.SseAskParams; import dev.langchain4j.data.document.Document; import dev.langchain4j.data.document.parser.TextDocumentParser; @@ -33,6 +35,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; @@ -65,6 +68,9 @@ public class KnowledgeBaseService extends ServiceImpl searchMine(String keyword, Boolean includeOthersPublic, Integer currentPage, Integer pageSize) { + public Page searchMine(String keyword, Boolean includeOthersPublic, Integer currentPage, Integer pageSize) { + Page result = new Page<>(); User user = ThreadContext.getCurrentUser(); + Page knowledgeBasePage; if (user.getIsAdmin()) { - return baseMapper.searchByAdmin(new Page<>(currentPage, pageSize), keyword); + knowledgeBasePage = baseMapper.searchByAdmin(new Page<>(currentPage, pageSize), keyword); } else { - return baseMapper.searchByUser(new Page<>(currentPage, pageSize), user.getId(), keyword, includeOthersPublic); + knowledgeBasePage = baseMapper.searchByUser(new Page<>(currentPage, pageSize), user.getId(), keyword, includeOthersPublic); } + return MPPageUtil.convertToPage(knowledgeBasePage, result, KbInfoResp.class, null); } - public Page searchPublic(String keyword, Integer currentPage, Integer pageSize) { + public Page searchPublic(String keyword, Integer currentPage, Integer pageSize) { + Page result = new Page<>(); LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); wrapper.eq(KnowledgeBase::getIsPublic, true); wrapper.eq(KnowledgeBase::getIsDeleted, false); @@ -211,7 +221,8 @@ public class KnowledgeBaseService extends ServiceImpl(currentPage, pageSize), wrapper); + Page knowledgeBasePage = baseMapper.selectPage(new Page<>(currentPage, pageSize), wrapper); + return MPPageUtil.convertToPage(knowledgeBasePage, result, KbInfoResp.class, null); } public boolean softDelete(String uuid) { @@ -247,12 +258,42 @@ public class KnowledgeBaseService extends ServiceImpl { + + public boolean isStarred(Long userId, String kbUuid) { + return ChainWrappers.lambdaQueryChain(baseMapper) + .eq(KnowledgeBaseStarRecord::getUserId, userId) + .eq(KnowledgeBaseStarRecord::getKbUuid, kbUuid) + .eq(KnowledgeBaseStarRecord::getIsDeleted, false) + .exists(); + } + + public KnowledgeBaseStarRecord getRecord(long userId, String kbUuid){ + return ChainWrappers.lambdaQueryChain(baseMapper) + .eq(KnowledgeBaseStarRecord::getUserId, userId) + .eq(KnowledgeBaseStarRecord::getKbUuid, kbUuid) + .oneOpt() + .orElse(null); + } + + public Page listStarInfo(User user, int currentPage, int pageSize) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); + wrapper.eq(KnowledgeBaseStarRecord::getIsDeleted, false); + wrapper.eq(KnowledgeBaseStarRecord::getUserId, user.getId()); + wrapper.orderByDesc(KnowledgeBaseStarRecord::getId); + Page list = baseMapper.selectPage(new Page<>(currentPage, pageSize), wrapper); + + Page result = new Page<>(); + return MPPageUtil.convertToPage(list, result, KbStarInfoResp.class); + } + +} diff --git a/adi-common/src/main/java/com/moyz/adi/common/service/PromptService.java b/adi-common/src/main/java/com/moyz/adi/common/service/PromptService.java index b5371e6..6cadf8b 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/service/PromptService.java +++ b/adi-common/src/main/java/com/moyz/adi/common/service/PromptService.java @@ -26,7 +26,7 @@ public class PromptService extends ServiceImpl { public List getAll(long userId) { List prompts = this.lambdaQuery().eq(Prompt::getUserId, userId).eq(Prompt::getIsDeleted, false).list(); - return MPPageUtil.convertTo(prompts, PromptDto.class); + return MPPageUtil.convertToList(prompts, PromptDto.class); } public Page search(String keyword, int currentPage, int pageSize) { @@ -43,7 +43,7 @@ public class PromptService extends ServiceImpl { .eq(Prompt::getIsDeleted, false) .page(new Page<>(currentPage, pageSize)); } - return MPPageUtil.convertTo(promptPage, new Page<>(), PromptDto.class); + return MPPageUtil.convertToPage(promptPage, new Page<>(), PromptDto.class); } public List autocomplete(String keyword) { @@ -62,7 +62,7 @@ public class PromptService extends ServiceImpl { .last("limit 10") .list(); } - return MPPageUtil.convertTo(promptPage, PromptDto.class); + return MPPageUtil.convertToList(promptPage, PromptDto.class); } public PromptListResp listByMinUpdateTime(LocalDateTime minUpdateTime) { @@ -88,7 +88,7 @@ public class PromptService extends ServiceImpl { } return b; }).get().getUpdateTime(); - List promptDtos = MPPageUtil.convertTo(list, PromptDto.class); + List promptDtos = MPPageUtil.convertToList(list, PromptDto.class); resp.setMaxUpdateTime(LocalDateTimeUtil.format(maxUpdateTime)); resp.setPrompts(promptDtos); return resp; @@ -170,6 +170,6 @@ public class PromptService extends ServiceImpl { .like(Prompt::getAct, keyword) .last("limit 10") .list(); - return MPPageUtil.convertTo(prompts, PromptDto.class); + return MPPageUtil.convertToList(prompts, PromptDto.class); } } diff --git a/adi-common/src/main/java/com/moyz/adi/common/service/UserService.java b/adi-common/src/main/java/com/moyz/adi/common/service/UserService.java index f16a061..05db49d 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/service/UserService.java +++ b/adi-common/src/main/java/com/moyz/adi/common/service/UserService.java @@ -314,4 +314,10 @@ public class UserService extends ServiceImpl { adiMailSender.send("欢迎注册AIDeepIn", "激活链接(" + AdiConstant.AUTH_ACTIVE_CODE_EXPIRE + "小时内有效):" + backendUrl + "/auth/active?code=" + activeCode, email); } + public User getByUuid(String uuid){ + return ChainWrappers.lambdaQueryChain(baseMapper) + .eq(User::getUuid, uuid) + .one(); + } + } diff --git a/adi-common/src/main/java/com/moyz/adi/common/util/MPPageUtil.java b/adi-common/src/main/java/com/moyz/adi/common/util/MPPageUtil.java index a19f47b..1206411 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/util/MPPageUtil.java +++ b/adi-common/src/main/java/com/moyz/adi/common/util/MPPageUtil.java @@ -14,11 +14,11 @@ import java.util.function.BiFunction; @Slf4j public class MPPageUtil { - public static Page convertTo(Page source, Page target, Class targetRecordClass) { - return MPPageUtil.convertTo(source, target, targetRecordClass, null); + public static Page convertToPage(Page source, Page target, Class targetRecordClass) { + return MPPageUtil.convertToPage(source, target, targetRecordClass, null); } - public static Page convertTo(Page source, Page target, Class targetRecordClass, BiFunction biFunction) { + public static Page convertToPage(Page source, Page target, Class targetRecordClass, BiFunction biFunction) { BeanUtils.copyProperties(source, target); List records = new ArrayList<>(); target.setRecords(records); @@ -40,7 +40,7 @@ public class MPPageUtil { return target; } - public static List convertTo(List source, Class targetRecordClass) { + public static List convertToList(List source, Class targetRecordClass) { if (CollectionUtils.isEmpty(source)) { return Collections.emptyList(); }