guoshilong
2023-03-15 f3c70289b1c491540a1173beebce77899b185ad5
模块管理
1 files modified
16 files added
948 ■■■■■ changed files
src/main/java/org/springblade/common/handler/SocketIOService.java 65 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/controller/FunctionController.java 139 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/controller/ModulesController.java 125 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/dto/FunctionDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/dto/ModulesDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/entity/FunctionEntity.java 74 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/entity/ModulesEntity.java 64 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/mapper/FunctionMapper.java 50 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/mapper/FunctionMapper.xml 39 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/mapper/ModulesMapper.java 43 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/mapper/ModulesMapper.xml 28 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/service/IFunctionService.java 49 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/service/IModulesService.java 42 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/service/impl/FunctionServiceImpl.java 50 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/service/impl/ModulesServiceImpl.java 42 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/vo/FunctionVO.java 35 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/modules/vo/ModulesVO.java 35 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/handler/SocketIOService.java
@@ -41,18 +41,17 @@
    private SocketIOServer socketIOServer;
    /**
     * Spring IoC容器创建之后,在加载SocketIOServiceImpl Bean之后启动
     * Spring IoC容器创建之后,在加载SocketIOConfiguration Bean之后启动
     *
     * @throws Exception
     */
    @PostConstruct
    private void autoStartup() throws Exception {
        log.info("启动Socket!!!!!!!!!!");
        start();
    }
    /**
     * Spring IoC容器在销毁SocketIOServiceImpl Bean之前关闭,避免重启项目服务端口占用问题
     * Spring IoC容器在销毁SocketIOConfiguration Bean之前关闭,避免重启项目服务端口占用问题
     *
     * @throws Exception
     */
@@ -62,56 +61,48 @@
    }
    public void start() {
        // 监听客户端连接
        socketIOServer.addConnectListener(client -> {
            String uid = getParamsByClient(client);
            if (uid != null) {
                clientMap.put(uid, client);
                log.info("有新的客户端连接UID:{}", uid);
            }
            // 给客户端发送一条信息 发送ClientReceive事件 需要客户端绑定此事件即可接收到消息
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("name", "goat");
            jsonObject.put("message", "hello client");
            client.sendEvent("ClientReceive", jsonObject);
        });
        // 监听客户端断开连接
        socketIOServer.addDisconnectListener(listener -> {
            String uid = getParamsByClient(listener);
            if (uid != null) {
                clientMap.remove(uid);
                listener.disconnect();
                log.info("一条客户端连接中断");
            }
        });
        socketIOServer.addEventListener("ServerReceive", JSONObject.class, (client, data, ackSender) -> {
            String uid = getParamsByClient(client);
            String ip = getIpByClient(client);
            if (uid != null) {
                log.info("接收到SID:{}发来的消息:{}", uid, data.toJSONString());
                log.debug(ip + " ************ 客户端:" + data);
            }
        });
        socketIOServer.start();
        log.info("socket.io初始化服务完成");
    }
    /**
     * 连接时
     * @param client
     */
    @OnConnect
    public void onConnect(SocketIOClient client){
        log.info(getIpByClient(client));
        HandshakeData handshakeData = client.getHandshakeData();
        Map<String, List<String>> urlParams = handshakeData.getUrlParams();
    }
    /**
     * 监听前端订阅相同事件发送过来的信息
     * @param client
     * @param ackRequest
     * @param data
     */
    @OnEvent(value = "msg")
    public void OnEvent(SocketIOClient client, AckRequest ackRequest, String data){
        log.info("发来消息:" + data);
    }
    /**
     * 监听前端订阅相同事件发送过来的信息
     * @param client
     * @param ackRequest
     * @param data
     */
    @OnEvent(value = "msg2")
    public void OnEventMsg2(SocketIOClient client, AckRequest ackRequest, String data){
        log.info("发来消息:" + data);
        client.sendEvent("ClientReceive","copy"+data);
    }
    /**
     * 断开连接时
     * @param client
     */
    @OnDisconnect()
    public void OnEvent(SocketIOClient client){
        log.info("{}断开连接",client.getSessionId());
src/main/java/org/springblade/modules/modules/controller/FunctionController.java
New file
@@ -0,0 +1,139 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.modules.entity.FunctionEntity;
import org.springblade.modules.modules.service.IFunctionService;
import org.springblade.modules.modules.vo.FunctionVO;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.List;
/**
 * 功能表 控制器
 *
 * @author BladeX
 * @since 2023-03-15
 */
@RestController
@AllArgsConstructor
@RequestMapping("function/function")
@Api(value = "功能表", tags = "功能表接口")
public class FunctionController extends BladeController {
    private final IFunctionService modulesFunctionService;
    /**
     * 功能表 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入modulesFunction")
    public R<FunctionEntity> detail(FunctionEntity modulesFunction) {
        FunctionEntity detail = modulesFunctionService.getOne(Condition.getQueryWrapper(modulesFunction));
        return R.data(detail);
    }
    /**
     * 功能表 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入modulesFunction")
    public R<IPage<FunctionEntity>> list(FunctionEntity modulesFunction, Query query) {
        IPage<FunctionEntity> pages = modulesFunctionService.page(Condition.getPage(query), Condition.getQueryWrapper(modulesFunction));
        return R.data(pages);
    }
    /**
     * 功能表 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入modulesFunction")
    public R<IPage<FunctionVO>> page(FunctionVO modulesFunction, Query query) {
        IPage<FunctionVO> pages = modulesFunctionService.selectFunctionPage(Condition.getPage(query), modulesFunction);
        return R.data(pages);
    }
    /**
     * 功能表 所有功能集合
     */
    @GetMapping("/all")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入modulesFunction")
    public R getAll(FunctionEntity function) {
        List<FunctionEntity> functionEntities = modulesFunctionService.getAll(function);
        return R.data(functionEntities);
    }
    /**
     * 功能表 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入modulesFunction")
    public R save(@Valid @RequestBody FunctionEntity modulesFunction) {
        return R.status(modulesFunctionService.save(modulesFunction));
    }
    /**
     * 功能表 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入modulesFunction")
    public R update(@Valid @RequestBody FunctionEntity modulesFunction) {
        return R.status(modulesFunctionService.updateById(modulesFunction));
    }
    /**
     * 功能表 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入modulesFunction")
    public R submit(@Valid @RequestBody FunctionEntity modulesFunction) {
        return R.status(modulesFunctionService.saveOrUpdate(modulesFunction));
    }
    /**
     * 功能表 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(modulesFunctionService.deleteLogic(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/modules/controller/ModulesController.java
New file
@@ -0,0 +1,125 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.modules.entity.ModulesEntity;
import org.springblade.modules.modules.vo.ModulesVO;
import org.springblade.modules.modules.service.IModulesService;
import org.springblade.core.boot.ctrl.BladeController;
/**
 * 模块表 控制器
 *
 * @author BladeX
 * @since 2023-03-15
 */
@RestController
@AllArgsConstructor
@RequestMapping("modules/modules")
@Api(value = "模块表", tags = "模块表接口")
public class ModulesController extends BladeController {
    private final IModulesService modulesService;
    /**
     * 模块表 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入modules")
    public R<ModulesEntity> detail(ModulesEntity modules) {
        ModulesEntity detail = modulesService.getOne(Condition.getQueryWrapper(modules));
        return R.data(detail);
    }
    /**
     * 模块表 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入modules")
    public R<IPage<ModulesEntity>> list(ModulesEntity modules, Query query) {
        IPage<ModulesEntity> pages = modulesService.page(Condition.getPage(query), Condition.getQueryWrapper(modules));
        return R.data(pages);
    }
    /**
     * 模块表 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入modules")
    public R<IPage<ModulesVO>> page(ModulesVO modules, Query query) {
        IPage<ModulesVO> pages = modulesService.selectModulesPage(Condition.getPage(query), modules);
        return R.data(pages);
    }
    /**
     * 模块表 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入modules")
    public R save(@Valid @RequestBody ModulesEntity modules) {
        return R.status(modulesService.save(modules));
    }
    /**
     * 模块表 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入modules")
    public R update(@Valid @RequestBody ModulesEntity modules) {
        return R.status(modulesService.updateById(modules));
    }
    /**
     * 模块表 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入modules")
    public R submit(@Valid @RequestBody ModulesEntity modules) {
        return R.status(modulesService.saveOrUpdate(modules));
    }
    /**
     * 模块表 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(modulesService.deleteLogic(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/modules/dto/FunctionDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.modules.entity.FunctionEntity;
/**
 * 功能表 数据传输对象实体类
 *
 * @author BladeX
 * @since 2023-03-15
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class FunctionDTO extends FunctionEntity {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/modules/dto/ModulesDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.dto;
import org.springblade.modules.modules.entity.ModulesEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 模块表 数据传输对象实体类
 *
 * @author BladeX
 * @since 2023-03-15
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ModulesDTO extends ModulesEntity {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/modules/entity/FunctionEntity.java
New file
@@ -0,0 +1,74 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
 * 功能表 实体类
 *
 * @author BladeX
 * @since 2023-03-15
 */
@Data
@TableName(value = "sys_modules_function",autoResultMap = true)
@ApiModel(value = "Function对象", description = "功能表")
@EqualsAndHashCode(callSuper = true)
public class FunctionEntity extends TenantEntity {
    /**
     * 模块主键
     */
    @ApiModelProperty(value = "模块主键")
    private String modulesId;
    /**
     * 功能名称
     */
    @ApiModelProperty(value = "功能名称")
    private String name;
    /**
     * 功能属性:1开始页;2内容页;3结束页
     */
    @ApiModelProperty(value = "功能属性:1开始页;2内容页;3结束页")
    private String property;
    /**
     * 内容类型:1动画;2图册;3视频
     */
    @ApiModelProperty(value = "内容类型:1动画;2图册;3视频")
    private String type;
    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    private Integer sort;
    /**
     * 文件链接
     */
    @ApiModelProperty(value = "文件链接")
    @TableField(value = "file_url",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
    private Object fileUrl;
}
src/main/java/org/springblade/modules/modules/entity/ModulesEntity.java
New file
@@ -0,0 +1,64 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
 * 模块表 实体类
 *
 * @author BladeX
 * @since 2023-03-15
 */
@Data
@TableName(value = "sys_modules",autoResultMap = true)
@ApiModel(value = "Modules对象", description = "模块表")
@EqualsAndHashCode(callSuper = true)
public class ModulesEntity extends TenantEntity {
    /**
     * 模块名称
     */
    @ApiModelProperty(value = "模块名称")
    private String name;
    /**
     * 高
     */
    @ApiModelProperty(value = "高")
    private String height;
    /**
     * 宽
     */
    @ApiModelProperty(value = "宽")
    private String width;
    /**
     * 模块背景
     */
    @ApiModelProperty(value = "模块背景")
    @TableField(value = "background",typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.IGNORED)
    private Object background;
}
src/main/java/org/springblade/modules/modules/mapper/FunctionMapper.java
New file
@@ -0,0 +1,50 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.modules.entity.FunctionEntity;
import org.springblade.modules.modules.vo.FunctionVO;
import java.util.List;
/**
 * 功能表 Mapper 接口
 *
 * @author BladeX
 * @since 2023-03-15
 */
public interface FunctionMapper extends BaseMapper<FunctionEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param modulesFunction
     * @return
     */
    List<FunctionVO> selectFunctionPage(IPage page, FunctionVO modulesFunction);
    /**
     * 获取全部
     * @param function
     * @return
     */
    List<FunctionEntity> getAll(@Param("function") FunctionEntity function);
}
src/main/java/org/springblade/modules/modules/mapper/FunctionMapper.xml
New file
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.modules.mapper.FunctionMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="modulesFunctionResultMap" type="org.springblade.modules.modules.entity.FunctionEntity">
        <result column="id" property="id"/>
        <result column="modules_id" property="modulesId"/>
        <result column="name" property="name"/>
        <result column="property" property="property"/>
        <result column="type" property="type"/>
        <result column="sort" property="sort"/>
        <result column="file_url" property="fileUrl" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
    <select id="selectFunctionPage" resultMap="modulesFunctionResultMap">
        select * from sys_modules_function where is_deleted = 0
    </select>
    <select id="getAll" resultMap="modulesFunctionResultMap">
        select * from sys_modules_function
        where is_deleted = 0
        <if test="function.modulesId !=null and function.modulesId !=''">
          AND modules_id = #{function.modulesId}
        </if>
        ORDER BY property ASC,sort ASC
    </select>
</mapper>
src/main/java/org/springblade/modules/modules/mapper/ModulesMapper.java
New file
@@ -0,0 +1,43 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.mapper;
import org.springblade.modules.modules.entity.ModulesEntity;
import org.springblade.modules.modules.vo.ModulesVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 * 模块表 Mapper 接口
 *
 * @author BladeX
 * @since 2023-03-15
 */
public interface ModulesMapper extends BaseMapper<ModulesEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param modules
     * @return
     */
    List<ModulesVO> selectModulesPage(IPage page, ModulesVO modules);
}
src/main/java/org/springblade/modules/modules/mapper/ModulesMapper.xml
New file
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.modules.mapper.ModulesMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="modulesResultMap" type="org.springblade.modules.modules.entity.ModulesEntity">
        <result column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="height" property="height"/>
        <result column="width" property="width"/>
        <result column="background" property="background"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
    <select id="selectModulesPage" resultMap="modulesResultMap">
        select * from sys_modules where is_deleted = 0
    </select>
</mapper>
src/main/java/org/springblade/modules/modules/service/IFunctionService.java
New file
@@ -0,0 +1,49 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.service;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.modules.entity.FunctionEntity;
import org.springblade.modules.modules.vo.FunctionVO;
import java.util.List;
/**
 * 功能表 服务类
 *
 * @author BladeX
 * @since 2023-03-15
 */
public interface IFunctionService extends BaseService<FunctionEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param modulesFunction
     * @return
     */
    IPage<FunctionVO> selectFunctionPage(IPage<FunctionVO> page, FunctionVO modulesFunction);
    /**
     * 获取全部
     * @param function
     * @return
     */
    List<FunctionEntity> getAll(FunctionEntity function);
}
src/main/java/org/springblade/modules/modules/service/IModulesService.java
New file
@@ -0,0 +1,42 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.service;
import org.springblade.modules.modules.entity.ModulesEntity;
import org.springblade.modules.modules.vo.ModulesVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * 模块表 服务类
 *
 * @author BladeX
 * @since 2023-03-15
 */
public interface IModulesService extends BaseService<ModulesEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param modules
     * @return
     */
    IPage<ModulesVO> selectModulesPage(IPage<ModulesVO> page, ModulesVO modules);
}
src/main/java/org/springblade/modules/modules/service/impl/FunctionServiceImpl.java
New file
@@ -0,0 +1,50 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.modules.entity.FunctionEntity;
import org.springblade.modules.modules.mapper.FunctionMapper;
import org.springblade.modules.modules.service.IFunctionService;
import org.springblade.modules.modules.vo.FunctionVO;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 功能表 服务实现类
 *
 * @author BladeX
 * @since 2023-03-15
 */
@Service
public class FunctionServiceImpl extends BaseServiceImpl<FunctionMapper, FunctionEntity> implements IFunctionService {
    @Override
    public IPage<FunctionVO> selectFunctionPage(IPage<FunctionVO> page, FunctionVO modulesFunction) {
        return page.setRecords(baseMapper.selectFunctionPage(page, modulesFunction));
    }
    @Override
    public List<FunctionEntity> getAll(FunctionEntity function) {
        return baseMapper.getAll(function);
    }
}
src/main/java/org/springblade/modules/modules/service/impl/ModulesServiceImpl.java
New file
@@ -0,0 +1,42 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.service.impl;
import org.springblade.modules.modules.entity.ModulesEntity;
import org.springblade.modules.modules.vo.ModulesVO;
import org.springblade.modules.modules.mapper.ModulesMapper;
import org.springblade.modules.modules.service.IModulesService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * 模块表 服务实现类
 *
 * @author BladeX
 * @since 2023-03-15
 */
@Service
public class ModulesServiceImpl extends BaseServiceImpl<ModulesMapper, ModulesEntity> implements IModulesService {
    @Override
    public IPage<ModulesVO> selectModulesPage(IPage<ModulesVO> page, ModulesVO modules) {
        return page.setRecords(baseMapper.selectModulesPage(page, modules));
    }
}
src/main/java/org/springblade/modules/modules/vo/FunctionVO.java
New file
@@ -0,0 +1,35 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.vo;
import org.springblade.core.tool.node.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.modules.entity.FunctionEntity;
/**
 * 功能表 视图实体类
 *
 * @author BladeX
 * @since 2023-03-15
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class FunctionVO extends FunctionEntity {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/modules/vo/ModulesVO.java
New file
@@ -0,0 +1,35 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.modules.vo;
import org.springblade.modules.modules.entity.ModulesEntity;
import org.springblade.core.tool.node.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 模块表 视图实体类
 *
 * @author BladeX
 * @since 2023-03-15
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ModulesVO extends ModulesEntity {
    private static final long serialVersionUID = 1L;
}