mirror of
https://github.com/LiuYuYang01/ThriveX-Server.git
synced 2026-05-06 22:25:55 +08:00
refactor: 更新AssistantController和AssistantService以增强一致性和可读性
- 修改AssistantController中的方法签名,使用更具描述性的命名,如addAssistantData、delAssistantData等,提升代码清晰度。 - 在AssistantService中新增相应的方法以处理助手的添加、删除、编辑和获取逻辑,简化控制器中的业务逻辑。 - 更新获取助手列表的逻辑,支持过滤和分页,提升接口的灵活性和可用性。
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
package liuyuyang.net.web.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import liuyuyang.net.core.utils.Paging;
|
||||
import liuyuyang.net.core.utils.Result;
|
||||
import liuyuyang.net.model.Assistant;
|
||||
import liuyuyang.net.dto.assistant.AssistantFilterDTO;
|
||||
import liuyuyang.net.dto.assistant.AssistantFormDTO;
|
||||
import liuyuyang.net.vo.assistant.AssistantVO;
|
||||
import liuyuyang.net.web.service.AssistantService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Api(tags = "助手管理")
|
||||
@RestController
|
||||
@@ -23,77 +28,59 @@ public class AssistantController {
|
||||
@PostMapping
|
||||
@ApiOperation("新增助手")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 1)
|
||||
public Result<String> add(@RequestBody Assistant assistant) {
|
||||
// 将之前的都设置为 0 表示未选中
|
||||
assistantService.lambdaUpdate()
|
||||
.set(Assistant::getIsDefault, 0)
|
||||
.update();
|
||||
|
||||
// 将当前的设置为选中状态
|
||||
assistant.setIsDefault(1);
|
||||
assistantService.save(assistant);
|
||||
public Result<String> addAssistantData(@RequestBody AssistantFormDTO assistantFormDTO) {
|
||||
assistantService.addAssistantData(assistantFormDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation("删除助手")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 2)
|
||||
public Result<String> del(@PathVariable Integer id) {
|
||||
Assistant data = assistantService.getById(id);
|
||||
if (data == null) return Result.error("该助手不存在");
|
||||
if (data.getIsDefault() == 1) return Result.error("无法删除默认助手,请更换后重试");
|
||||
|
||||
assistantService.removeById(id);
|
||||
public Result<String> delAssistantData(@PathVariable Integer id) {
|
||||
assistantService.delAssistantData(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("/batch")
|
||||
@ApiOperation("批量删除助手")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 3)
|
||||
public Result<String> batchDel(@RequestBody List<Integer> ids) {
|
||||
assistantService.removeByIds(ids);
|
||||
public Result<String> batchDelAssistantData(@RequestBody List<Integer> ids) {
|
||||
assistantService.batchDelAssistantData(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PatchMapping
|
||||
@ApiOperation("编辑助手")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 4)
|
||||
public Result<String> edit(@RequestBody Assistant assistant) {
|
||||
assistantService.updateById(assistant);
|
||||
public Result<String> editAssistantData(@RequestBody AssistantFormDTO assistantFormDTO) {
|
||||
assistantService.editAssistantData(assistantFormDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation("获取助手")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 5)
|
||||
public Result<Assistant> get(@PathVariable Integer id) {
|
||||
Assistant data = assistantService.getById(id);
|
||||
public Result<AssistantVO> getAssistantData(@PathVariable Integer id) {
|
||||
AssistantVO data = assistantService.getAssistantData(id);
|
||||
return Result.success(data);
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@GetMapping
|
||||
@ApiOperation("获取助手列表")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 6)
|
||||
public Result<List<Assistant>> list() {
|
||||
List<Assistant> data = assistantService.list();
|
||||
return Result.success(data);
|
||||
public Result<Map<String, Object>> getAssistantList(AssistantFilterDTO assistantFilterDTO) {
|
||||
Page<AssistantVO> list = assistantService.getAssistantList(assistantFilterDTO);
|
||||
Map<String, Object> result = Paging.filter(list);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
@PatchMapping("/default/{id}")
|
||||
@ApiOperation("设置默认助手")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 7)
|
||||
public Result<String> selectDefault(@PathVariable Integer id) {
|
||||
Assistant assistant = assistantService.getById(id);
|
||||
if (assistant == null) return Result.error("暂无该助手");
|
||||
|
||||
public Result<String> selectDefaultAssistant(@PathVariable Integer id) {
|
||||
// 将之前的都设置为 0 表示未选中
|
||||
assistantService.lambdaUpdate()
|
||||
.set(Assistant::getIsDefault, 0)
|
||||
.update();
|
||||
|
||||
assistantService.selectDefaultAssistant(id);
|
||||
// 将当前的设置为 1 选中状态
|
||||
assistant.setIsDefault(1);
|
||||
assistantService.updateById(assistant);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import liuyuyang.net.web.service.EnvConfigService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -32,7 +33,8 @@ public class EnvConfigController {
|
||||
@ApiOperation("根据ID获取环境配置")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 2)
|
||||
@GetMapping("/{id}")
|
||||
public Result<EnvConfig> getById(@ApiParam(value = "环境配置ID", required = true, example = "1") @PathVariable Integer id) {
|
||||
public Result<EnvConfig> getById(
|
||||
@ApiParam(value = "环境配置ID", required = true, example = "1") @PathVariable Integer id) {
|
||||
EnvConfig envConfig = envConfigService.getById(id);
|
||||
return envConfig != null ? Result.success("获取成功", envConfig) : Result.error("配置不存在");
|
||||
}
|
||||
@@ -40,7 +42,8 @@ public class EnvConfigController {
|
||||
@ApiOperation("根据名称获取环境配置")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 3)
|
||||
@GetMapping("/name/{name}")
|
||||
public Result<EnvConfig> getByName(@ApiParam(value = "配置名称", required = true, example = "database_config") @PathVariable String name) {
|
||||
public Result<EnvConfig> getByName(
|
||||
@ApiParam(value = "配置名称", required = true, example = "database_config") @PathVariable String name) {
|
||||
EnvConfig envConfig = envConfigService.getByName(name);
|
||||
return envConfig != null ? Result.success("获取成功", envConfig) : Result.error("配置不存在");
|
||||
}
|
||||
@@ -48,8 +51,9 @@ public class EnvConfigController {
|
||||
@ApiOperation("根据ID获取配置")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 4)
|
||||
@PatchMapping("/json/{id}")
|
||||
public Result<String> updateJsonValue(@ApiParam(value = "环境配置ID", required = true, example = "1") @PathVariable Integer id,
|
||||
@ApiParam(value = "JSON配置值", required = true) @RequestBody Map<String, Object> jsonValue) {
|
||||
public Result<String> updateJsonValue(
|
||||
@ApiParam(value = "环境配置ID", required = true, example = "1") @PathVariable Integer id,
|
||||
@ApiParam(value = "JSON配置值", required = true) @RequestBody Map<String, Object> jsonValue) {
|
||||
boolean success = envConfigService.updateJsonValue(id, jsonValue);
|
||||
return success ? Result.success("JSON配置更新成功") : Result.error("更新失败");
|
||||
}
|
||||
@@ -57,9 +61,10 @@ public class EnvConfigController {
|
||||
@ApiOperation("根据ID更新配置")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 6)
|
||||
@PatchMapping("/{id}/field/{fieldName}")
|
||||
public Result<String> updateJsonFieldValue(@ApiParam(value = "环境配置ID", required = true, example = "1") @PathVariable Integer id,
|
||||
@ApiParam(value = "字段名称", required = true, example = "host") @PathVariable String fieldName,
|
||||
@ApiParam(value = "字段值", required = true) @RequestBody Object value) {
|
||||
public Result<String> updateJsonFieldValue(
|
||||
@ApiParam(value = "环境配置ID", required = true, example = "1") @PathVariable Integer id,
|
||||
@ApiParam(value = "字段名称", required = true, example = "host") @PathVariable String fieldName,
|
||||
@ApiParam(value = "字段值", required = true) @RequestBody Object value) {
|
||||
boolean success = envConfigService.updateJsonFieldValue(id, fieldName, value);
|
||||
return success ? Result.success() : Result.error();
|
||||
}
|
||||
@@ -80,4 +85,37 @@ public class EnvConfigController {
|
||||
public Result<Map<String, Object>> getPublicConfig() {
|
||||
return Result.success(envConfigService.getPublicConfig());
|
||||
}
|
||||
}
|
||||
|
||||
@NoTokenRequired
|
||||
@ApiOperation("获取系统初始化状态")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 9)
|
||||
@GetMapping("/is_system_init")
|
||||
public Result<Map<String, Object>> getSystemInitStatus() {
|
||||
EnvConfig envConfig = envConfigService.getByName("is_system_init");
|
||||
boolean isSystemInit = false;
|
||||
if (envConfig != null && envConfig.getValue() != null) {
|
||||
Object value = envConfig.getValue().get("value");
|
||||
if (value instanceof Boolean) {
|
||||
isSystemInit = (Boolean) value;
|
||||
} else if (value instanceof String) {
|
||||
isSystemInit = Boolean.parseBoolean((String) value);
|
||||
}
|
||||
}
|
||||
Map<String, Object> data = new HashMap<>(1);
|
||||
data.put("is_system_init", isSystemInit);
|
||||
return Result.success(data);
|
||||
}
|
||||
|
||||
@NoTokenRequired
|
||||
@ApiOperation("更新系统初始化状态")
|
||||
@ApiOperationSupport(author = "刘宇阳 | liuyuyang1024@yeah.net", order = 10)
|
||||
@PostMapping("/is_system_init")
|
||||
public Result<String> updateSystemInitStatus() {
|
||||
EnvConfig envConfig = envConfigService.getByName("is_system_init");
|
||||
if (envConfig == null) {
|
||||
return Result.error("is_system_init配置不存在");
|
||||
}
|
||||
envConfigService.updateJsonFieldValue(envConfig.getId(), "value", true);
|
||||
return Result.success("系统初始化成功");
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,27 @@
|
||||
package liuyuyang.net.web.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import liuyuyang.net.dto.assistant.AssistantFilterDTO;
|
||||
import liuyuyang.net.dto.assistant.AssistantFormDTO;
|
||||
import liuyuyang.net.model.Assistant;
|
||||
import liuyuyang.net.vo.assistant.AssistantVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AssistantService extends IService<Assistant> {
|
||||
void addAssistantData(AssistantFormDTO assistantFormDTO);
|
||||
|
||||
void delAssistantData(Integer id);
|
||||
|
||||
void batchDelAssistantData(List<Integer> ids);
|
||||
|
||||
void editAssistantData(AssistantFormDTO assistantFormDTO);
|
||||
|
||||
AssistantVO getAssistantData(Integer id);
|
||||
|
||||
Page<AssistantVO> getAssistantList(AssistantFilterDTO assistantFilterDTO);
|
||||
|
||||
void selectDefaultAssistant(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,152 @@
|
||||
package liuyuyang.net.web.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import liuyuyang.net.core.execption.CustomException;
|
||||
import liuyuyang.net.core.utils.CommonUtils;
|
||||
import liuyuyang.net.dto.PageDTO;
|
||||
import liuyuyang.net.dto.assistant.AssistantFilterDTO;
|
||||
import liuyuyang.net.dto.assistant.AssistantFormDTO;
|
||||
import liuyuyang.net.enums.assistant.AssistantDefaultEnum;
|
||||
import liuyuyang.net.model.Assistant;
|
||||
import liuyuyang.net.vo.assistant.AssistantVO;
|
||||
import liuyuyang.net.web.mapper.AssistantMapper;
|
||||
import liuyuyang.net.web.service.AssistantService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class AssistantServiceImpl extends ServiceImpl<AssistantMapper, Assistant> implements AssistantService {
|
||||
@Resource
|
||||
private CommonUtils commonUtils;
|
||||
@Resource
|
||||
private AssistantMapper assistantMapper;
|
||||
|
||||
@Override
|
||||
public void addAssistantData(AssistantFormDTO assistantFormDTO) {
|
||||
Assistant assistant = new Assistant();
|
||||
BeanUtils.copyProperties(assistantFormDTO, assistant);
|
||||
assistant.setId(null);
|
||||
assistantMapper.insert(assistant);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delAssistantData(Integer id) {
|
||||
Assistant data = assistantMapper.selectById(id);
|
||||
if (data == null) {
|
||||
throw new CustomException("该助手不存在");
|
||||
}
|
||||
if (data.getIsDefault() != null && data.getIsDefault() == AssistantDefaultEnum.DEFAULT.getValue()) {
|
||||
throw new CustomException("无法删除默认助手,请更换后重试");
|
||||
}
|
||||
|
||||
assistantMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchDelAssistantData(List<Integer> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Assistant> list = assistantMapper.selectBatchIds(ids);
|
||||
if (list.size() != ids.size()) {
|
||||
throw new CustomException("有 " + (ids.size() - list.size()) + " 个助手不存在");
|
||||
}
|
||||
boolean hasDefaultAssistant = list.stream().anyMatch(item ->
|
||||
item.getIsDefault() != null && item.getIsDefault() == AssistantDefaultEnum.DEFAULT.getValue()
|
||||
);
|
||||
if (hasDefaultAssistant) {
|
||||
throw new CustomException("无法删除默认助手,请更换后重试");
|
||||
}
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editAssistantData(AssistantFormDTO assistantFormDTO) {
|
||||
Assistant oldAssistant = assistantMapper.selectById(assistantFormDTO.getId());
|
||||
if (oldAssistant == null) {
|
||||
throw new CustomException("该助手不存在");
|
||||
}
|
||||
|
||||
Assistant assistant = new Assistant();
|
||||
BeanUtils.copyProperties(assistantFormDTO, assistant);
|
||||
if (assistant.getIsDefault() != null && assistant.getIsDefault() == AssistantDefaultEnum.DEFAULT.getValue()) {
|
||||
setDefaultAssistant(assistant);
|
||||
} else if (oldAssistant.getIsDefault() != null
|
||||
&& oldAssistant.getIsDefault() == AssistantDefaultEnum.DEFAULT.getValue()) {
|
||||
// 默认助手不能被改为非默认,避免出现无默认助手
|
||||
assistant.setIsDefault(AssistantDefaultEnum.DEFAULT.getValue());
|
||||
}
|
||||
updateById(assistant);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssistantVO getAssistantData(Integer id) {
|
||||
Assistant data = assistantMapper.selectById(id);
|
||||
if (data == null) {
|
||||
throw new CustomException("该助手不存在");
|
||||
}
|
||||
|
||||
AssistantVO assistantVO = new AssistantVO();
|
||||
BeanUtils.copyProperties(data, assistantVO);
|
||||
return assistantVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AssistantVO> getAssistantList(AssistantFilterDTO assistantFilterDTO) {
|
||||
QueryWrapper<Assistant> queryWrapper = new QueryWrapper<>();
|
||||
if (assistantFilterDTO.getName() != null && !assistantFilterDTO.getName().trim().isEmpty()) {
|
||||
queryWrapper.like("name", assistantFilterDTO.getName().trim());
|
||||
}
|
||||
queryWrapper.orderByDesc("is_default");
|
||||
queryWrapper.orderByDesc("id");
|
||||
|
||||
List<AssistantVO> list = assistantMapper.selectList(queryWrapper).stream().map(item -> {
|
||||
AssistantVO assistantVO = new AssistantVO();
|
||||
BeanUtils.copyProperties(item, assistantVO);
|
||||
return assistantVO;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 不传 page/size 则返回全部
|
||||
if (assistantFilterDTO.getPageNum() == null || assistantFilterDTO.getPageSize() == null) {
|
||||
Page<AssistantVO> result = new Page<>(1, list.size());
|
||||
result.setRecords(new ArrayList<>(list));
|
||||
result.setTotal(list.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
PageDTO pageDTO = new PageDTO();
|
||||
pageDTO.setPageNum(Math.max(1, assistantFilterDTO.getPageNum()));
|
||||
pageDTO.setPageSize(Math.max(1, assistantFilterDTO.getPageSize()));
|
||||
Page<AssistantVO> result = commonUtils.getPageData(pageDTO, list);
|
||||
result.setTotal(list.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectDefaultAssistant(Integer id) {
|
||||
Assistant assistant = assistantMapper.selectById(id);
|
||||
if (assistant == null) {
|
||||
throw new CustomException("暂无该助手");
|
||||
}
|
||||
setDefaultAssistant(assistant);
|
||||
assistantMapper.updateById(assistant);
|
||||
}
|
||||
|
||||
private void setDefaultAssistant(Assistant assistant) {
|
||||
lambdaUpdate()
|
||||
.set(Assistant::getIsDefault, AssistantDefaultEnum.NOT_DEFAULT.getValue())
|
||||
.update();
|
||||
assistant.setIsDefault(AssistantDefaultEnum.DEFAULT.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,10 +100,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
|
||||
@Override
|
||||
public void editUserPass(EditUserPassDTO data) {
|
||||
if(data.getOldUsername() == null) throw new CustomException("请输入旧用户名");
|
||||
if(data.getNewUsername() == null) throw new CustomException("请输入新用户名");
|
||||
if(data.getOldPassword() == null) throw new CustomException("请输入旧密码");
|
||||
if(data.getNewPassword() == null) throw new CustomException("请输入新密码");
|
||||
if (data.getOldUsername() == null) throw new CustomException("请输入旧用户名");
|
||||
if (data.getNewUsername() == null) throw new CustomException("请输入新用户名");
|
||||
if (data.getOldPassword() == null) throw new CustomException("请输入旧密码");
|
||||
if (data.getNewPassword() == null) throw new CustomException("请输入新密码");
|
||||
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(User::getUsername, data.getOldUsername());
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package liuyuyang.net.dto.assistant;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import liuyuyang.net.dto.PageDTO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AssistantFilterDTO extends PageDTO {
|
||||
@ApiModelProperty(value = "根据助手名称进行筛选")
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package liuyuyang.net.dto.assistant;
|
||||
|
||||
import liuyuyang.net.model.Assistant;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AssistantFormDTO extends Assistant {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package liuyuyang.net.enums.assistant;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Getter;
|
||||
|
||||
public enum AssistantDefaultEnum {
|
||||
NOT_DEFAULT(0, "未选中"),
|
||||
DEFAULT(1, "默认");
|
||||
|
||||
@EnumValue
|
||||
private final int value;
|
||||
|
||||
@Getter
|
||||
private final String desc;
|
||||
|
||||
AssistantDefaultEnum(int value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static AssistantDefaultEnum fromJson(Integer value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
for (AssistantDefaultEnum item : values()) {
|
||||
if (item.value == value) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("未知助手默认状态: " + value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package liuyuyang.net.vo.assistant;
|
||||
|
||||
import liuyuyang.net.model.Assistant;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AssistantVO extends Assistant {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user