新增人设标签国际化增删改查并修正标签序列配置
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.yolo.keyboard.controller.admin.tag;
|
package com.yolo.keyboard.controller.admin.tag;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tag.TagI18nDO;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -100,5 +101,55 @@ public class KeyboardTagController {
|
|||||||
ExcelUtils.write(response, "人设标签.xls", "数据", KeyboardTagRespVO.class,
|
ExcelUtils.write(response, "人设标签.xls", "数据", KeyboardTagRespVO.class,
|
||||||
BeanUtils.toBean(list, KeyboardTagRespVO.class));
|
BeanUtils.toBean(list, KeyboardTagRespVO.class));
|
||||||
}
|
}
|
||||||
|
// ==================== 子表(人设标签国际化) ====================
|
||||||
|
|
||||||
|
@GetMapping("/tag-i18n/page")
|
||||||
|
@Operation(summary = "获得人设标签国际化分页")
|
||||||
|
@Parameter(name = "tagId", description = "标签主表ID,对应 keyboard_tag.id")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:query')")
|
||||||
|
public CommonResult<PageResult<TagI18nDO>> getTagI18nPage(PageParam pageReqVO,
|
||||||
|
@RequestParam("tagId") Integer tagId) {
|
||||||
|
return success(tagService.getTagI18nPage(pageReqVO, tagId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/tag-i18n/create")
|
||||||
|
@Operation(summary = "创建人设标签国际化")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:create')")
|
||||||
|
public CommonResult<Long> createTagI18n(@Valid @RequestBody TagI18nDO tagI18n) {
|
||||||
|
return success(tagService.createTagI18n(tagI18n));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/tag-i18n/update")
|
||||||
|
@Operation(summary = "更新人设标签国际化")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:update')")
|
||||||
|
public CommonResult<Boolean> updateTagI18n(@Valid @RequestBody TagI18nDO tagI18n) {
|
||||||
|
tagService.updateTagI18n(tagI18n);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/tag-i18n/delete")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@Operation(summary = "删除人设标签国际化")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTagI18n(@RequestParam("id") Long id) {
|
||||||
|
tagService.deleteTagI18n(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/tag-i18n/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除人设标签国际化")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTagI18nList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
tagService.deleteTagI18nListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/tag-i18n/get")
|
||||||
|
@Operation(summary = "获得人设标签国际化")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:query')")
|
||||||
|
public CommonResult<TagI18nDO> getTagI18n(@RequestParam("id") Long id) {
|
||||||
|
return success(tagService.getTagI18n(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
|||||||
* @author ziin
|
* @author ziin
|
||||||
*/
|
*/
|
||||||
@TableName("keyboard_tag")
|
@TableName("keyboard_tag")
|
||||||
@KeySequence("keyboard_tag_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
@KeySequence("keyboard_tag_id_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
@Data
|
@Data
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
@Builder
|
@Builder
|
||||||
@@ -28,10 +28,6 @@ public class KeyboardTagDO{
|
|||||||
*/
|
*/
|
||||||
@TableId
|
@TableId
|
||||||
private Integer id;
|
private Integer id;
|
||||||
/**
|
|
||||||
* 标签名
|
|
||||||
*/
|
|
||||||
private String tagName;
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.tag;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人设标签国际化 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("keyboard_tag_i18n")
|
||||||
|
@KeySequence("keyboard_tag_i18n_id_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class TagI18nDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键 Id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 标签主表ID,对应 keyboard_tag.id
|
||||||
|
*/
|
||||||
|
private Integer tagId;
|
||||||
|
/**
|
||||||
|
* 语言标识,如 zh-CN、en-US、ja-JP
|
||||||
|
*/
|
||||||
|
private String locale;
|
||||||
|
/**
|
||||||
|
* 标签名称(多语言)
|
||||||
|
*/
|
||||||
|
private String tagName;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,7 +19,6 @@ public interface KeyboardTagMapper extends BaseMapperX<KeyboardTagDO> {
|
|||||||
|
|
||||||
default PageResult<KeyboardTagDO> selectPage(KeyboardTagPageReqVO reqVO) {
|
default PageResult<KeyboardTagDO> selectPage(KeyboardTagPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardTagDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardTagDO>()
|
||||||
.likeIfPresent(KeyboardTagDO::getTagName, reqVO.getTagName())
|
|
||||||
.eqIfPresent(KeyboardTagDO::getCreatedAt, reqVO.getCreatedAt())
|
.eqIfPresent(KeyboardTagDO::getCreatedAt, reqVO.getCreatedAt())
|
||||||
.eqIfPresent(KeyboardTagDO::getUpdatedAt, reqVO.getUpdatedAt())
|
.eqIfPresent(KeyboardTagDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||||
.orderByDesc(KeyboardTagDO::getId));
|
.orderByDesc(KeyboardTagDO::getId));
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.tag;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tag.TagI18nDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人设标签国际化 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TagI18nMapper extends BaseMapperX<TagI18nDO> {
|
||||||
|
|
||||||
|
default PageResult<TagI18nDO> selectPage(PageParam reqVO, Integer tagId) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<TagI18nDO>()
|
||||||
|
.eq(TagI18nDO::getTagId, tagId)
|
||||||
|
.orderByDesc(TagI18nDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default int deleteByTagId(Integer tagId) {
|
||||||
|
return delete(TagI18nDO::getTagId, tagId);
|
||||||
|
}
|
||||||
|
|
||||||
|
default int deleteByTagIds(List<Integer> tagIds) {
|
||||||
|
return deleteBatch(TagI18nDO::getTagId, tagIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.yolo.keyboard.service.tag;
|
package com.yolo.keyboard.service.tag;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tag.TagI18nDO;
|
||||||
import jakarta.validation.*;
|
import jakarta.validation.*;
|
||||||
import com.yolo.keyboard.controller.admin.tag.vo.*;
|
import com.yolo.keyboard.controller.admin.tag.vo.*;
|
||||||
import com.yolo.keyboard.dal.dataobject.tag.KeyboardTagDO;
|
import com.yolo.keyboard.dal.dataobject.tag.KeyboardTagDO;
|
||||||
@@ -58,5 +60,51 @@ public interface KeyboardTagService {
|
|||||||
* @return 人设标签分页
|
* @return 人设标签分页
|
||||||
*/
|
*/
|
||||||
PageResult<KeyboardTagDO> getTagPage(KeyboardTagPageReqVO pageReqVO);
|
PageResult<KeyboardTagDO> getTagPage(KeyboardTagPageReqVO pageReqVO);
|
||||||
|
// ==================== 子表(人设标签国际化) ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得人设标签国际化分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @param tagId 标签主表ID,对应 keyboard_tag.id
|
||||||
|
* @return 人设标签国际化分页
|
||||||
|
*/
|
||||||
|
PageResult<TagI18nDO> getTagI18nPage(PageParam pageReqVO, Integer tagId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人设标签国际化
|
||||||
|
*
|
||||||
|
* @param tagI18n 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createTagI18n(@Valid TagI18nDO tagI18n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人设标签国际化
|
||||||
|
*
|
||||||
|
* @param tagI18n 更新信息
|
||||||
|
*/
|
||||||
|
void updateTagI18n(@Valid TagI18nDO tagI18n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除人设标签国际化
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteTagI18n(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除人设标签国际化
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteTagI18nListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得人设标签国际化
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 人设标签国际化
|
||||||
|
*/
|
||||||
|
TagI18nDO getTagI18n(Long id);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.yolo.keyboard.service.tag;
|
package com.yolo.keyboard.service.tag;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tag.TagI18nDO;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tag.TagI18nMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -18,6 +20,7 @@ import com.yolo.keyboard.dal.mysql.tag.KeyboardTagMapper;
|
|||||||
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.convertList;
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.diffList;
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.diffList;
|
||||||
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.TAG_I18N_NOT_EXISTS;
|
||||||
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.TAG_NOT_EXISTS;
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.TAG_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,6 +35,9 @@ public class KeyboardTagServiceImpl implements KeyboardTagService {
|
|||||||
@Resource
|
@Resource
|
||||||
private KeyboardTagMapper tagMapper;
|
private KeyboardTagMapper tagMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagI18nMapper tagI18nMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer createTag(KeyboardTagSaveReqVO createReqVO) {
|
public Integer createTag(KeyboardTagSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@@ -82,4 +88,55 @@ public class KeyboardTagServiceImpl implements KeyboardTagService {
|
|||||||
return tagMapper.selectPage(pageReqVO);
|
return tagMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==================== 子表(人设标签国际化) ====================
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TagI18nDO> getTagI18nPage(PageParam pageReqVO, Integer tagId) {
|
||||||
|
return tagI18nMapper.selectPage(pageReqVO, tagId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createTagI18n(TagI18nDO tagI18n) {
|
||||||
|
tagI18nMapper.insert(tagI18n);
|
||||||
|
return tagI18n.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTagI18n(TagI18nDO tagI18n) {
|
||||||
|
// 校验存在
|
||||||
|
validateTagI18nExists(tagI18n.getId());
|
||||||
|
// 更新
|
||||||
|
tagI18nMapper.updateById(tagI18n);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTagI18n(Long id) {
|
||||||
|
// 删除
|
||||||
|
tagI18nMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTagI18nListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
tagI18nMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TagI18nDO getTagI18n(Long id) {
|
||||||
|
return tagI18nMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateTagI18nExists(Long id) {
|
||||||
|
if (tagI18nMapper.selectById(id) == null) {
|
||||||
|
throw exception(TAG_I18N_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteTagI18nByTagId(Integer tagId) {
|
||||||
|
tagI18nMapper.deleteByTagId(tagId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteTagI18nByTagIds(List<Integer> tagIds) {
|
||||||
|
tagI18nMapper.deleteByTagIds(tagIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -98,5 +98,6 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode WARNING_MESSAGE_NOT_EXISTS = new ErrorCode(1_001_202_024, "用户注销提示信息不存在");
|
ErrorCode WARNING_MESSAGE_NOT_EXISTS = new ErrorCode(1_001_202_024, "用户注销提示信息不存在");
|
||||||
ErrorCode APP_VERSIONS_NOT_EXISTS = new ErrorCode(1_001_202_025, "App 版本发布与更新检查表信息不存在");
|
ErrorCode APP_VERSIONS_NOT_EXISTS = new ErrorCode(1_001_202_025, "App 版本发布与更新检查表信息不存在");
|
||||||
ErrorCode CHARACTER_I18N_NOT_EXISTS = new ErrorCode(1_001_202_026, "键盘人设国际化内容不存在");
|
ErrorCode CHARACTER_I18N_NOT_EXISTS = new ErrorCode(1_001_202_026, "键盘人设国际化内容不存在");
|
||||||
ErrorCode AI_COMPANION_I18N_NOT_EXISTS = new ErrorCode(1_001_202_027, "键盘人设国际化内容不存在");
|
ErrorCode AI_COMPANION_I18N_NOT_EXISTS = new ErrorCode(1_001_202_027, "AI陪聊人设国际化内容不存在");
|
||||||
|
ErrorCode TAG_I18N_NOT_EXISTS = new ErrorCode(1_001_202_028, "人设标签国际化内容不存在");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user