1 Star 5 Fork 1

Might/might-framework

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

might-framework

介绍

基于springboot、mybatis-plus封装的JavaWeb快速开发框架

传统三层架构代码是面试过程编程,DDD领域驱动则是面向对象编程。领域驱动的明显特征就是高内聚、低耦合。领域驱动的有点明显同时缺点也明显: 缺乏统一的标准,实施难度大。

这个框架就是为了方便实现易于维护,可重用性好,易拓展的,高内聚低耦合的代码。统一范式的开发, 设计(领域层)与实现分层(应用层),面向指令编程。可根据实体对象一键生成基础代码,根据指令实体自动生成接口文档。

面向指令编程的代码:
/**
 * 创建字典
 *
 * @author system
 * @tags 系统管理/字典
 * @Date: 2023-11-25 15:46
 */
@Data
@EqualsAndHashCode(callSuper = true)
@DomainCommand(path = "/sys/dict/create", desc = "创建字典", needLog = true)
public class DictCreate extends DomainCmd<Boolean>  {

    /**
     * id
     */
    private Long id;

    /**
     * 字典名称
     */
    private String name;

    /**
     * 编码
     */
    private String code;

    /**
     * 描述
     */
    private String remark;

    /**
     * 字典项
     */
    private List<DictItem> items;

}


/**
 * 字典指令处理器
 *
 * @Author: system
 * @Date: 2023-11-25 15:46
 */

@HandlerComponent
public class DictCmdHandler extends BaseCmdHandler<DictPersistService, DictConverter, DictEntity,
        DictCreate, DictUpdate, DictDelete, DictQuery, DictQueryResp> {

}
指令的调用:
  /**
 * 操作日志处理
 *
 * @author might
 */
@Component
@RequiredArgsConstructor
public class SysOperateLogHandler implements OperateLogHandler {

    private final Ip2regionSearcher regionSearcher;


    @Override
    public void saveLog(OperateLogModel operateLogModel) {
        String clientIP = HttpContextHolder.getClientIP();
        // 保存日志
        OptLogCreate optLogCreate = new OptLogCreate();
        optLogCreate.setTitle(operateLogModel.getTitle());
        optLogCreate.setTraceId(operateLogModel.getTraceId());
        optLogCreate.setIpAddr(clientIP);
        optLogCreate.setIpPlace(regionSearcher.getAddress(clientIP));
        optLogCreate.setUrl(HttpContextHolder.getHttpRequestWrapper().getRequestURL().toString());
        optLogCreate.setRemark(operateLogModel.getRemark());
        optLogCreate.setUserId(Long.valueOf(operateLogModel.getUserId()));
        optLogCreate.setUsername(operateLogModel.getUsername());
        optLogCreate.setDataLog(operateLogModel.getChangeData());
        optLogCreate.setCreateTime(new Date(operateLogModel.getOptTime()));
        optLogCreate.execute();
    }
}

以前的话还要注如service,再去调用。现在面向对象,更简单,可读性更高了

optLogCreate.execute() 即完成调用(依赖反转,指令会匹配到应用层中的handler方法,调用指令的处理逻辑)

后台管理系统

演示地址: https://mgiht.if4.ttyt.cc/

项目 描述 gitee 地址
might-module-sys might-admin后端代码 https://gitee.com/mightlin/might-module-sys
might-admin-web might-admin前端代码 https://gitee.com/mightlin/might-admin-web
MIT License Copyright (c) 2023 Might Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

快速开发框架 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/mightlin/might-framework.git
git@gitee.com:mightlin/might-framework.git
mightlin
might-framework
might-framework
master

搜索帮助

A270a887 8829481 3d7a4017 8829481