内置常用方法及接口方法说明
拓展接口
IWjjhookTaskService
注入持久化定时任务操作(default方法不需要重写,直接使用即可,说明中以*****星号标注。)
返回值更多操作返回值、方法和参数 | 说明 |
---|---|
list() | 查询全量的任务列表 |
getTaskByIdentifier(String identifier) | *查询标识符对应的任务 |
updateTaskByIdentifier(String identifier, String cronEl) | 修改定时任务表达式 |
enableTaskByIdentifier(String identifier) | 开启定时任务 |
disableTaskByIdentifier(String identifier) | 禁用定时任务 |
void removeTask(String identifier) | 删除定时任务 |
WjjhookTaskModule parseTask(T entity) | *对象转WangjjTaskModule(任务对象) |
List<WjjhookTaskModule> parseTaskList(List<T> entices) | *对象转WangjjTaskModule(任务对象)批量 |
IPlugInMethodService
插件式工具方法集合,统一将不必须要注入的方法集合在该类中。
返回值更多操作返回值、方法和参数 | 说明 |
---|---|
monitorCustomRun(JSONObject data); | 自定义预警执行方法(当开启监控并且通知类型为MonitorWarnType.CUSTOM时该方法可用) |
getUserId() | 获取用户id(返回String) |
工具接口
IMailService
邮件发送相关方法,使用可直接@Autowired注入
返回值更多操作返回值、方法和参数 | 说明 |
---|---|
sendSimpleMail(List<String> tos, String subject, String content); | 发送简单文本邮件 |
sendHtmlMail(List<String> tos, String subject, String content); | 发送HTML邮件 |
sendAttachmentsMail(List<String> tos, String subject, String content, String... filePath); | 发送带附件的邮件 |
sendAttachmentsMail(List<String> tos, String subject, String content, File... files); | 发送带附件的邮件 |
sendAttachmentsMail(List<String> tos, String subject, String content, Map<String, File> files); | 发送带附件的邮件 |
工具类
BizAssertUtil
提供一些业务断言操作
返回值更多操作返回值、方法和参数 | 说明 |
---|---|
verifyAllNotNull(Object... params) | 验证参数不能为null |
verifyEntitiesAllNotNull(Object... entities) | 验证实体数据不能为null |
CommonUseUtil
常用获取类工具
返回值更多操作返回值、方法和参数 | 说明 |
---|---|
String getIpAddr() | 获取访问者网络ip |
String getUlid() | 获取随机ulid(需引入依赖:ulid) |
String getMonotonicUlid() | 获取递增有序ulid(需引入依赖:ulid) |
Long getSnowflakeNextId(long workerId,long datacenterId) | 获取Long类型的雪花算法id |
Boolean isForEverFlag(LocalDateTime localDateTime) | 是否永久 |
boolean isLinux() | 判断当前设备是否是Linux主机 |
boolean isWindows() | 判断当前设备是否是windows主机 |
List<T> constructTree(List<T>) | 构建树结构(since 0.1.6) |
List<T> constructTree(Predicate<AbstractTree>,List<T>) | 构建树结构(since 0.1.6)(手动填入父类条件) |
DefaultServletUtil
重要:提供web相关常用方法。也是系统中的入口方法集合。
返回值更多操作返回值、方法和参数 | 说明 |
---|---|
HookConfigure configure | wjjhook系统配置,静态变量可直接使用 |
ServletRequestAttributes getServletRequestAttributes() | 全局获取ServletRequestAttributes |
HttpServletRequest getRequest() | 全局获取HttpServletRequest |
HttpServletResponse getResponse() | 全局获取HttpServletResponse |
String getTokenStr() | 获取token参数 |
String getDeviceStr() | 获取设备标识参数 |
IPage<T> page() | 获取分页对象IPage(MybatisPlus内置分页) |
T getUser() | 获取用户信息(需配置wjjhook.project.baseUserReference ) |
T getUser(Class<T>) | 获取用户信息(since 0.1.6) |
void rollback() | 回滚事务 |
void debugParams() | debug:打印请求信息。 |
MybatisPlusCodeAutoGeneratorHelper
代码生成工具类 使用方式见最佳实践
返回值更多操作返回值、方法和参数 | 说明 |
---|---|
void run(String... tableNames) | 生成代码(默认读取Mybatis-Plus.properties 配置) |
void run(List<String> tableNames) | 生成代码(默认读取Mybatis-Plus.properties 配置) |
void run(CodeAutoGeneratorVO codeAutoGeneratorVO,String... tableNames) | 生成代码(需配置CodeAutoGeneratorVO 类注入) |
void run(CodeAutoGeneratorVO codeAutoGeneratorVO,List<String> tableNames) | 生成代码(需配置CodeAutoGeneratorVO 类注入) |