重构 resource 模块,支持自定义tag标签

重构 transform 模块
修复以及优化各验证码生成器,
This commit is contained in:
天爱有情
2023-02-13 14:29:11 +08:00
parent ebc39efb02
commit 37d88b5ec2
25 changed files with 518 additions and 346 deletions
@@ -1,9 +1,8 @@
package cloud.tianai.captcha.resource;
import cloud.tianai.captcha.resource.common.model.dto.Resource;
import cloud.tianai.captcha.resource.common.model.dto.Resource;
import cloud.tianai.captcha.resource.common.model.dto.ResourceMap;
import java.util.List;
import java.util.Map;
/**
@@ -21,55 +20,6 @@ public interface ResourceStore {
*/
void addResource(String type, Resource resource);
/**
* 清除某个类型下的所有资源
*
* @param type type
*/
void clearResources(String type);
/**
* 清除所有资源
*/
void clearAllResources();
/**
* 获取所有资源对象
*
* @return List<Resource>
*/
Map<String, List<Resource>> listAllResources();
/**
* 获取某个type下的所有资源对象
*
* @param type type
* @return List<Resource>
*/
List<Resource> listResourcesByType(String type);
/**
* 随机获取某个资源
*
* @param type type
* @return Resource
*/
Resource randomGetResource(String type);
/**
* 获取资源总数
*
* @return int
*/
int getAllResourceCount();
/**
* 获取某个type下的资源总数
*
* @param type type
* @return int
*/
int getResourceCount(String type);
/**
* 添加模板
@@ -77,34 +27,15 @@ public interface ResourceStore {
* @param type 验证码类型
* @param template 模板
*/
void addTemplate(String type, Map<String, Resource> template);
void addTemplate(String type, ResourceMap template);
/**
* 清除所有模板
*/
void clearAllTemplates();
/**
* 清除某个type下的所有模板
* 随机获取某个资源
*
* @param type type
* @return Resource
*/
void clearTemplates(String type);
/**
* 获取所有模板通过type
*
* @param type 验证码类型
* @return List<Map < String, Resource>>
*/
List<Map<String, Resource>> listTemplatesByType(String type);
/**
* 获取所有模板
*
* @return Map<String, List < Map < String, Resource>>>
*/
Map<String, List<Map<String, Resource>>> listAllTemplates();
Resource randomGetResourceByTypeAndTag(String type, String tag);
/**
* 随机获取某个模板通过type
@@ -112,6 +43,6 @@ public interface ResourceStore {
* @param type type
* @return Map<String, Resource>
*/
Map<String, Resource> randomGetTemplateByType(String type);
ResourceMap randomGetTemplateByTypeAndTag(String type, String tag);
}