diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml
index 1d0a883..a51612f 100644
--- a/.idea/sqldialects.xml
+++ b/.idea/sqldialects.xml
@@ -3,7 +3,7 @@
-
+
\ No newline at end of file
diff --git a/src/main/java/com/imyeyu/api/bean/CorePermissionCode.java b/src/main/java/com/imyeyu/api/bean/CorePermissionCode.java
index fba6068..652cdb4 100644
--- a/src/main/java/com/imyeyu/api/bean/CorePermissionCode.java
+++ b/src/main/java/com/imyeyu/api/bean/CorePermissionCode.java
@@ -39,6 +39,12 @@ public enum CorePermissionCode implements BuiltinPermissionCode {
MULTILINGUAL_UPDATE("MULTILINGUAL:UPDATE", "多语言修改", false, true),
MULTILINGUAL_DELETE("MULTILINGUAL:DELETE", "多语言删除", false, true),
+ TAG_CREATE("TAG:CREATE", "标签创建", false, true),
+ TAG_READ("TAG:READ", "标签读取", false, true),
+ TAG_APPLY("TAG:APPLY", "标签应用", false, true),
+ TAG_UPDATE("TAG:UPDATE", "标签修改", false, true),
+ TAG_DELETE("TAG:DELETE", "标签删除", false, true),
+
USER_CREATE("USER:CREATE", "用户创建", false, true),
USER_READ("USER:READ", "用户读取", false, true),
USER_UPDATE("USER:UPDATE", "用户修改", false, true),
diff --git a/src/main/java/com/imyeyu/api/modules/common/controller/TagController.java b/src/main/java/com/imyeyu/api/modules/common/controller/TagController.java
new file mode 100644
index 0000000..604b4d4
--- /dev/null
+++ b/src/main/java/com/imyeyu/api/modules/common/controller/TagController.java
@@ -0,0 +1,111 @@
+package com.imyeyu.api.modules.common.controller;
+
+import com.fasterxml.jackson.annotation.JsonView;
+import com.imyeyu.api.modules.common.entity.Tag;
+import com.imyeyu.api.modules.common.entity.TagApply;
+import com.imyeyu.api.modules.common.service.TagService;
+import com.imyeyu.spring.annotation.AOPLog;
+import com.imyeyu.spring.annotation.RequestRateLimit;
+import com.imyeyu.spring.bean.Page;
+import com.imyeyu.spring.bean.PageResult;
+import com.imyeyu.spring.util.ResponseView;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/// 标签接口
+///
+/// @author 夜雨
+/// @since 2026-08-12 15:09
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/tag")
+public class TagController {
+
+ private final TagService service;
+
+ /// 查询标签列表
+ ///
+ /// @param page 分页参数
+ /// @return 标签分页
+ @RequestRateLimit
+ @JsonView(ResponseView.Public.class)
+ @PostMapping("/list")
+ public PageResult list(@RequestBody Page page) {
+ return service.page(page);
+ }
+
+ /// 查询标签详情
+ ///
+ /// @param id 标签 ID
+ /// @return 标签详情
+ @RequestRateLimit
+ @JsonView(ResponseView.Public.class)
+ @PostMapping("/detail")
+ public Tag detail(@RequestParam String id) {
+ return service.get(id);
+ }
+
+ /// 创建标签
+ ///
+ /// @param tag 标签
+ /// @return 标签
+ @AOPLog
+ @RequestRateLimit
+ @JsonView(ResponseView.Public.class)
+ @PostMapping("/create")
+ public Tag create(@RequestBody Tag tag) {
+ service.create(tag);
+ return tag;
+ }
+
+ /// 更新标签
+ ///
+ /// @param tag 标签
+ @AOPLog
+ @RequestRateLimit
+ @PostMapping("/update")
+ public void update(@RequestBody Tag tag) {
+ service.update(tag);
+ }
+
+ /// 删除标签
+ ///
+ /// @param id 标签 ID
+ @AOPLog
+ @RequestRateLimit
+ @PostMapping("/delete")
+ public void delete(@RequestParam String id) {
+ service.delete(id);
+ }
+
+ /// 按业务查询标签
+ ///
+ /// @param bizType 业务类型
+ /// @param bizId 业务 ID
+ /// @return 标签列表
+ @RequestRateLimit
+ @JsonView(ResponseView.Public.class)
+ @GetMapping("/list/biz/id")
+ public List listByBizType(@RequestParam TagApply.BizType bizType, @RequestParam String bizId) {
+ return service.listByBizType(bizType, bizId);
+ }
+
+ /// 差分保存业务标签
+ ///
+ /// @param apply 标签请求
+ @AOPLog
+ @RequestRateLimit
+ @PostMapping("/apply")
+ public void apply(@RequestBody TagApply apply) {
+ service.apply(apply.getBizType(), apply.getBizId(), apply.getTagIdList());
+ }
+}
diff --git a/src/main/java/com/imyeyu/api/modules/common/entity/Tag.java b/src/main/java/com/imyeyu/api/modules/common/entity/Tag.java
index eb2bb7e..32b3af3 100644
--- a/src/main/java/com/imyeyu/api/modules/common/entity/Tag.java
+++ b/src/main/java/com/imyeyu/api/modules/common/entity/Tag.java
@@ -1,23 +1,28 @@
package com.imyeyu.api.modules.common.entity;
+import com.imyeyu.api.annotation.MultilingualField;
import com.imyeyu.spring.annotation.table.Transient;
import com.imyeyu.spring.entity.UUIDEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
-/**
- * @author 夜雨
- * @since 2024-08-28 14:26
- */
+/// 标签
+///
+/// @author 夜雨
+/// @since 2024-08-28 14:26
@Data
@EqualsAndHashCode(callSuper = true)
public class Tag extends UUIDEntity {
- protected String langKey;
+ /// 名称多语言 ID
+ protected String nameLangId;
+ /// 当前语言名称
@Transient
- protected String value;
+ @MultilingualField("nameLangId")
+ protected String name;
+ /// 中文名称
@Transient
protected String zhCN;
}
diff --git a/src/main/java/com/imyeyu/api/modules/common/entity/TagApply.java b/src/main/java/com/imyeyu/api/modules/common/entity/TagApply.java
index b2d9059..8c934c9 100644
--- a/src/main/java/com/imyeyu/api/modules/common/entity/TagApply.java
+++ b/src/main/java/com/imyeyu/api/modules/common/entity/TagApply.java
@@ -1,9 +1,12 @@
package com.imyeyu.api.modules.common.entity;
+import com.imyeyu.spring.annotation.table.Transient;
import com.imyeyu.spring.entity.UUIDEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import java.util.List;
+
/**
* 标签应用
*
@@ -14,12 +17,25 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
public class TagApply extends UUIDEntity {
+ ///
+ ///
+ /// @author 夜雨
+ /// @since 2026-08-12 14:27
+ public enum BizType {
+
+ GAO_CUSTOMER
+ }
+
/** 业务类型 */
- protected String bizType;
+ protected BizType bizType;
/** 业务 ID */
protected String bizId;
/** 标签 ID */
protected String tagId;
+
+ /// 标签 ID 列表
+ @Transient
+ private List tagIdList;
}
diff --git a/src/main/java/com/imyeyu/api/modules/common/mapper/TagApplyMapper.java b/src/main/java/com/imyeyu/api/modules/common/mapper/TagApplyMapper.java
new file mode 100644
index 0000000..5920367
--- /dev/null
+++ b/src/main/java/com/imyeyu/api/modules/common/mapper/TagApplyMapper.java
@@ -0,0 +1,11 @@
+package com.imyeyu.api.modules.common.mapper;
+
+import com.imyeyu.api.modules.common.entity.TagApply;
+import com.imyeyu.spring.mapper.BaseMapper;
+
+/// 标签应用 Mapper
+///
+/// @author 夜雨
+/// @since 2026-08-12 15:05
+public interface TagApplyMapper extends BaseMapper {
+}
diff --git a/src/main/java/com/imyeyu/api/modules/common/mapper/TagMapper.java b/src/main/java/com/imyeyu/api/modules/common/mapper/TagMapper.java
index fcca350..f8e79b5 100644
--- a/src/main/java/com/imyeyu/api/modules/common/mapper/TagMapper.java
+++ b/src/main/java/com/imyeyu/api/modules/common/mapper/TagMapper.java
@@ -3,9 +3,14 @@ package com.imyeyu.api.modules.common.mapper;
import com.imyeyu.api.modules.common.entity.Tag;
import com.imyeyu.spring.mapper.BaseMapper;
+import java.util.Collection;
+import java.util.List;
+
/**
* @author 夜雨
* @since 2025-05-30 22:48
*/
public interface TagMapper extends BaseMapper {
+
+ List selectByIdList(Collection idList);
}
diff --git a/src/main/java/com/imyeyu/api/modules/common/service/TagService.java b/src/main/java/com/imyeyu/api/modules/common/service/TagService.java
index 3514d3c..e76f170 100644
--- a/src/main/java/com/imyeyu/api/modules/common/service/TagService.java
+++ b/src/main/java/com/imyeyu/api/modules/common/service/TagService.java
@@ -1,11 +1,31 @@
package com.imyeyu.api.modules.common.service;
import com.imyeyu.api.modules.common.entity.Tag;
+import com.imyeyu.api.modules.common.entity.TagApply;
import com.imyeyu.spring.service.BaseService;
-/**
- * @author 夜雨
- * @since 2025-05-30 22:46
- */
+import java.util.Collection;
+import java.util.List;
+
+/// 标签服务
+///
+/// @author 夜雨
+/// @since 2025-05-30 22:46
public interface TagService extends BaseService {
+
+ List listByIdList(Collection idList);
+
+ /// 按业务查询标签列表
+ ///
+ /// @param bizType 业务类型
+ /// @param bizId 业务 ID
+ /// @return 标签列表
+ List listByBizType(TagApply.BizType bizType, String bizId);
+
+ /// 差分保存业务标签
+ ///
+ /// @param bizType 业务类型
+ /// @param bizId 业务 ID
+ /// @param tagIdList 标签 ID 列表
+ void apply(TagApply.BizType bizType, String bizId, List tagIdList);
}
diff --git a/src/main/java/com/imyeyu/api/modules/common/service/implement/TagServiceImplement.java b/src/main/java/com/imyeyu/api/modules/common/service/implement/TagServiceImplement.java
index afcc742..304d1b7 100644
--- a/src/main/java/com/imyeyu/api/modules/common/service/implement/TagServiceImplement.java
+++ b/src/main/java/com/imyeyu/api/modules/common/service/implement/TagServiceImplement.java
@@ -1,27 +1,100 @@
package com.imyeyu.api.modules.common.service.implement;
import com.imyeyu.api.modules.common.entity.Tag;
+import com.imyeyu.api.modules.common.entity.TagApply;
+import com.imyeyu.api.modules.common.mapper.TagApplyMapper;
import com.imyeyu.api.modules.common.mapper.TagMapper;
+import com.imyeyu.api.modules.common.service.MultilingualService;
import com.imyeyu.api.modules.common.service.TagService;
+import com.imyeyu.java.bean.timi.TimiException;
import com.imyeyu.spring.mapper.BaseMapper;
import com.imyeyu.spring.service.AbstractEntityService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
-/**
- * @author 夜雨
- * @since 2025-05-30 22:47
- */
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+/// 标签服务实现
+///
+/// @author 夜雨
+/// @since 2025-05-30 22:47
@Slf4j
@Service
@RequiredArgsConstructor
public class TagServiceImplement extends AbstractEntityService implements TagService {
private final TagMapper mapper;
+ private final TagApplyMapper applyMapper;
+ private final MultilingualService multilingualService;
@Override
protected BaseMapper mapper() {
return mapper;
}
+
+ @Override
+ public void create(Tag tag) {
+ TimiException.required(tag, "not found tag");
+ TimiException.required(tag.getZhCN(), "not found tag.zhCN");
+ tag.setNameLangId(multilingualService.create(tag.getZhCN()));
+ super.create(tag);
+ }
+
+ @Override
+ public void update(Tag tag) {
+ TimiException.required(tag, "not found tag");
+ TimiException.required(tag.getId(), "not found tag.id");
+ if (tag.getZhCN() != null) {
+ if (tag.getNameLangId() == null) {
+ Tag dbTag = get(tag.getId());
+ TimiException.required(dbTag, "not found tag");
+ tag.setNameLangId(dbTag.getNameLangId());
+ }
+ tag.setNameLangId(multilingualService.createIfDifferent(tag.getNameLangId(), tag.getZhCN()));
+ }
+ super.update(tag);
+ }
+
+ @Override
+ public List listByIdList(Collection idList) {
+ return mapper.selectByIdList(new HashSet<>(idList));
+ }
+
+ @Override
+ public List listByBizType(TagApply.BizType bizType, String bizId) {
+ return listByIdList(listApply(bizType, bizId).stream().map(TagApply::getTagId).toList());
+ }
+
+ @Override
+ public void apply(TagApply.BizType bizType, String bizId, List tagIdList) {
+ LinkedHashSet tagIdSet = new LinkedHashSet<>(tagIdList == null ? List.of() : tagIdList);
+ for (TagApply apply : listApply(bizType, bizId)) {
+ if (tagIdSet.remove(apply.getTagId())) {
+ continue;
+ }
+ applyMapper.delete(apply.getId());
+ }
+ List tagList = listByIdList(tagIdSet);
+ for (Tag tag : tagList) {
+ TagApply apply = new TagApply();
+ apply.setBizType(bizType);
+ apply.setBizId(bizId);
+ apply.setTagId(tag.getId());
+ applyMapper.insert(apply);
+ }
+ }
+
+ private List listApply(TagApply.BizType bizType, String bizId) {
+ TimiException.required(bizType, "not found bizType");
+ TimiException.required(bizId, "not found bizId");
+
+ TagApply example = new TagApply();
+ example.setBizType(bizType);
+ example.setBizId(bizId);
+ return applyMapper.selectAllByExample(example);
+ }
}
diff --git a/src/main/java/com/imyeyu/api/modules/common/vo/tag/TagRequest.java b/src/main/java/com/imyeyu/api/modules/common/vo/tag/TagRequest.java
deleted file mode 100644
index 151f163..0000000
--- a/src/main/java/com/imyeyu/api/modules/common/vo/tag/TagRequest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.imyeyu.api.modules.common.vo.tag;
-
-import lombok.Data;
-
-/**
- * @author 夜雨
- * @since 2025-05-30 22:58
- */
-@Data
-public class TagRequest {
-
- private String bizId;
-
- private String zhCN;
-}
\ No newline at end of file
diff --git a/src/main/java/com/imyeyu/api/modules/gao/mapper/GaoStoreBusinessDayMapper.java b/src/main/java/com/imyeyu/api/modules/gao/mapper/GaoStoreBusinessDayMapper.java
index 0ea3a57..9c3442e 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/mapper/GaoStoreBusinessDayMapper.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/mapper/GaoStoreBusinessDayMapper.java
@@ -4,6 +4,7 @@ import com.imyeyu.api.modules.gao.entity.GaoStoreBusinessDay;
import com.imyeyu.spring.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
import java.util.List;
@@ -27,7 +28,7 @@ public interface GaoStoreBusinessDayMapper extends BaseMapper= #{beginDateValue} AND `open_status` = 'OPEN' AND `deleted_at` IS NULL ORDER BY `date_value` ASC")
+ @Select("SELECT * FROM `gao_store_business_day` WHERE `store_id` = #{storeId} AND `date_value` >= #{beginDateValue} AND `status` = 'OPEN' AND `deleted_at` IS NULL ORDER BY `date_value` ASC")
List selectOpenListFromDate(@Param("storeId") String storeId, @Param("beginDateValue") Integer beginDateValue);
+ /// 清空指定日期及之后的营业日序号
+ ///
+ /// @param storeId 门店 ID
+ /// @param beginDateValue 开始日期值,格式为 yyyyMMdd
+ @Update("UPDATE `gao_store_business_day` SET `business_day_no` = NULL, `updated_at` = ROUND(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000) WHERE `store_id` = #{storeId} AND `date_value` >= #{beginDateValue} AND `status` = 'OPEN' AND `deleted_at` IS NULL")
+ void clearBusinessDayNoFromDate(@Param("storeId") String storeId, @Param("beginDateValue") Integer beginDateValue);
+
/// 查询日期范围内的营业日
///
/// @param storeId 门店 ID
diff --git a/src/main/java/com/imyeyu/api/modules/gao/service/implement/GaoStoreBusinessDayServiceImplement.java b/src/main/java/com/imyeyu/api/modules/gao/service/implement/GaoStoreBusinessDayServiceImplement.java
index 2fa8fd6..6bc2f4b 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/service/implement/GaoStoreBusinessDayServiceImplement.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/service/implement/GaoStoreBusinessDayServiceImplement.java
@@ -97,12 +97,11 @@ public class GaoStoreBusinessDayServiceImplement extends AbstractEntityService
+
+
+
+
diff --git a/src/main/resources/mapper/timi-server/GaoCustomerMapper.xml b/src/main/resources/mapper/timi-server/gao/GaoCustomerMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/GaoCustomerMapper.xml
rename to src/main/resources/mapper/timi-server/gao/GaoCustomerMapper.xml
diff --git a/src/main/resources/mapper/timi-server/GaoEventMapper.xml b/src/main/resources/mapper/timi-server/gao/GaoEventMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/GaoEventMapper.xml
rename to src/main/resources/mapper/timi-server/gao/GaoEventMapper.xml
diff --git a/src/main/resources/mapper/timi-server/GaoEventRecordMapper.xml b/src/main/resources/mapper/timi-server/gao/GaoEventRecordMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/GaoEventRecordMapper.xml
rename to src/main/resources/mapper/timi-server/gao/GaoEventRecordMapper.xml
diff --git a/src/main/resources/mapper/timi-server/GaoEventRoleRelationMapper.xml b/src/main/resources/mapper/timi-server/gao/GaoEventRoleRelationMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/GaoEventRoleRelationMapper.xml
rename to src/main/resources/mapper/timi-server/gao/GaoEventRoleRelationMapper.xml
diff --git a/src/main/resources/mapper/timi-server/GaoPointAccountMapper.xml b/src/main/resources/mapper/timi-server/gao/GaoPointAccountMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/GaoPointAccountMapper.xml
rename to src/main/resources/mapper/timi-server/gao/GaoPointAccountMapper.xml
diff --git a/src/main/resources/mapper/timi-server/GaoPointLedgerMapper.xml b/src/main/resources/mapper/timi-server/gao/GaoPointLedgerMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/GaoPointLedgerMapper.xml
rename to src/main/resources/mapper/timi-server/gao/GaoPointLedgerMapper.xml
diff --git a/src/main/resources/mapper/timi-server/GaoPointRuleMapper.xml b/src/main/resources/mapper/timi-server/gao/GaoPointRuleMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/GaoPointRuleMapper.xml
rename to src/main/resources/mapper/timi-server/gao/GaoPointRuleMapper.xml
diff --git a/src/main/resources/mapper/timi-server/GaoStoreMapper.xml b/src/main/resources/mapper/timi-server/gao/GaoStoreMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/GaoStoreMapper.xml
rename to src/main/resources/mapper/timi-server/gao/GaoStoreMapper.xml
diff --git a/src/main/resources/mapper/timi-server/PermissionMapper.xml b/src/main/resources/mapper/timi-server/user/PermissionMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/PermissionMapper.xml
rename to src/main/resources/mapper/timi-server/user/PermissionMapper.xml
diff --git a/src/main/resources/mapper/timi-server/RoleMapper.xml b/src/main/resources/mapper/timi-server/user/RoleMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/RoleMapper.xml
rename to src/main/resources/mapper/timi-server/user/RoleMapper.xml
diff --git a/src/main/resources/mapper/timi-server/RolePermissionDelegationMapper.xml b/src/main/resources/mapper/timi-server/user/RolePermissionDelegationMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/RolePermissionDelegationMapper.xml
rename to src/main/resources/mapper/timi-server/user/RolePermissionDelegationMapper.xml
diff --git a/src/main/resources/mapper/timi-server/RolePermissionInheritMapper.xml b/src/main/resources/mapper/timi-server/user/RolePermissionInheritMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/RolePermissionInheritMapper.xml
rename to src/main/resources/mapper/timi-server/user/RolePermissionInheritMapper.xml
diff --git a/src/main/resources/mapper/timi-server/RolePermissionMapper.xml b/src/main/resources/mapper/timi-server/user/RolePermissionMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/RolePermissionMapper.xml
rename to src/main/resources/mapper/timi-server/user/RolePermissionMapper.xml
diff --git a/src/main/resources/mapper/timi-server/UserMapper.xml b/src/main/resources/mapper/timi-server/user/UserMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/UserMapper.xml
rename to src/main/resources/mapper/timi-server/user/UserMapper.xml
diff --git a/src/main/resources/mapper/timi-server/UserRoleMapper.xml b/src/main/resources/mapper/timi-server/user/UserRoleMapper.xml
similarity index 100%
rename from src/main/resources/mapper/timi-server/UserRoleMapper.xml
rename to src/main/resources/mapper/timi-server/user/UserRoleMapper.xml