浏览代码

微信登录

Administrator 2 年之前
父节点
当前提交
134e746fa1
共有 25 个文件被更改,包括 1571 次插入4 次删除
  1. 61 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/AppletController.java
  2. 104 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/FormalTeacherClassController.java
  3. 9 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
  4. 9 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
  5. 109 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/XiakeConfigController.java
  6. 4 0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
  7. 126 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/FormalTeacherClass.java
  8. 10 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
  9. 20 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java
  10. 1 1
      ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java
  11. 112 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/XiakeConfig.java
  12. 63 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/FormalTeacherClassMapper.java
  13. 1 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java
  14. 78 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/XiakeConfigMapper.java
  15. 15 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IAppletService.java
  16. 63 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IFormalTeacherClassService.java
  17. 1 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
  18. 78 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IXiakeConfigService.java
  19. 110 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AppletServiceImpl.java
  20. 116 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FormalTeacherClassServiceImpl.java
  21. 16 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
  22. 229 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XiakeConfigServiceImpl.java
  23. 105 0
      ruoyi-system/src/main/resources/mapper/system/FormalTeacherClassMapper.xml
  24. 8 2
      ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
  25. 123 0
      ruoyi-system/src/main/resources/mapper/system/XiakeConfigMapper.xml

+ 61 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/AppletController.java

@@ -0,0 +1,61 @@
+package com.ruoyi.web.controller.common;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.config.ServerConfig;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.service.IAppletService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**小程序公共接口
+ * @Author: tjf
+ * @Date: 2023/5/25 11:46
+ * @Describe:
+ */
+@RestController
+@RequestMapping("/applet")
+public class AppletController {
+    @Autowired
+    private IAppletService appletService;
+
+    /**
+     * 准备下课
+     */
+    @PostMapping("/xiaKe")
+    public void xiake(@Validated @RequestBody FormalTeacherClass formalTeacherClass)
+    {
+        appletService.xiake(formalTeacherClass);
+    }
+
+    /**
+     * 小程序首页数据
+     * 共多少班级
+     * 已放学 未放学
+     */
+    @PostMapping("/index")
+    public AjaxResult index(@Validated @RequestBody FormalTeacherClass formalTeacherClass)
+    {
+        return  appletService.index(formalTeacherClass);
+    }
+
+    /**
+     * 小程序首页数据
+     * 共多少班级
+     * 已放学 未放学
+     */
+    @PostMapping("/indexList")
+    public AjaxResult indexList(@Validated @RequestBody FormalTeacherClass formalTeacherClass)
+    {
+        return  appletService.indexList(formalTeacherClass);
+    }
+
+}

+ 104 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/FormalTeacherClassController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.web.controller.system;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
+import com.ruoyi.system.service.IFormalTeacherClassService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 老师-班级(学科)(审核通过之后数据)Controller
+ * 
+ * @author ruoyi
+ * @date 2023-05-25
+ */
+@RestController
+@RequestMapping("/system/class")
+public class FormalTeacherClassController extends BaseController
+{
+    @Autowired
+    private IFormalTeacherClassService formalTeacherClassService;
+
+    /**
+     * 查询老师-班级(学科)(审核通过之后数据)列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:class:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FormalTeacherClass formalTeacherClass)
+    {
+        startPage();
+        List<FormalTeacherClass> list = formalTeacherClassService.selectFormalTeacherClassList(formalTeacherClass);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出老师-班级(学科)(审核通过之后数据)列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:class:export')")
+    @Log(title = "老师-班级(学科)(审核通过之后数据)", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, FormalTeacherClass formalTeacherClass)
+    {
+        List<FormalTeacherClass> list = formalTeacherClassService.selectFormalTeacherClassList(formalTeacherClass);
+        ExcelUtil<FormalTeacherClass> util = new ExcelUtil<FormalTeacherClass>(FormalTeacherClass.class);
+        util.exportExcel(response, list, "老师-班级(学科)(审核通过之后数据)数据");
+    }
+
+    /**
+     * 获取老师-班级(学科)(审核通过之后数据)详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:class:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(formalTeacherClassService.selectFormalTeacherClassById(id));
+    }
+
+    /**
+     * 新增老师-班级(学科)(审核通过之后数据)
+     */
+    @PreAuthorize("@ss.hasPermi('system:class:add')")
+    @Log(title = "老师-班级(学科)(审核通过之后数据)", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FormalTeacherClass formalTeacherClass)
+    {
+        return toAjax(formalTeacherClassService.insertFormalTeacherClass(formalTeacherClass));
+    }
+
+    /**
+     * 修改老师-班级(学科)(审核通过之后数据)
+     */
+    @PreAuthorize("@ss.hasPermi('system:class:edit')")
+    @Log(title = "老师-班级(学科)(审核通过之后数据)", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FormalTeacherClass formalTeacherClass)
+    {
+        return toAjax(formalTeacherClassService.updateFormalTeacherClass(formalTeacherClass));
+    }
+
+    /**
+     * 删除老师-班级(学科)(审核通过之后数据)
+     */
+    @PreAuthorize("@ss.hasPermi('system:class:remove')")
+    @Log(title = "老师-班级(学科)(审核通过之后数据)", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(formalTeacherClassService.deleteFormalTeacherClassByIds(ids));
+    }
+}

+ 9 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java

@@ -67,13 +67,21 @@ public class SysConfigController extends BaseController
     }
 
     /**
-     * 根据参数键名查询参数值
+     * 根据参数键名查询参数值config_value
      */
     @GetMapping(value = "/configKey/{configKey}")
     public AjaxResult getConfigKey(@PathVariable String configKey)
     {
         return success(configService.selectConfigByKey(configKey));
     }
+    /**
+     * 根据参数键名修改参数值
+     */
+    @PostMapping(value = "/updateConfigKey")
+    public AjaxResult updateConfigKey(@Validated @RequestBody SysConfig config)
+    {
+        return success(configService.updateConfigValue(config));
+    }
 
     /**
      * 新增参数配置

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java

@@ -3,6 +3,7 @@ package com.ruoyi.web.controller.system;
 import java.util.List;
 import java.util.Set;
 
+import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.framework.web.domain.AppletLoginForm;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -82,6 +83,14 @@ public class SysLoginController
         Set<String> roles = permissionService.getRolePermission(user);
         // 权限集合
         Set<String> permissions = permissionService.getMenuPermission(user);
+        //formal_teacher_class
+        if (roles != null && roles.size() > 0){
+            for (String role : roles) {
+                if ("teacher".equals(role)){
+                    permissionService.getTeacherClass(user);
+                }
+            }
+        }
         AjaxResult ajax = AjaxResult.success();
         ajax.put("user", user);
         ajax.put("roles", roles);

+ 109 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/XiakeConfigController.java

@@ -0,0 +1,109 @@
+package com.ruoyi.web.controller.system;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.XiakeConfig;
+import com.ruoyi.system.service.IXiakeConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 参数配置 信息操作处理
+ * 
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/xiaKeConfig")
+public class XiakeConfigController extends BaseController
+{
+    @Autowired
+    private IXiakeConfigService configService;
+
+
+    /**
+     * 根据参数编号获取详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:config:query')")
+    @GetMapping(value = "/{configId}")
+    public AjaxResult getInfo(@PathVariable Long configId)
+    {
+        return success(configService.selectConfigById(configId));
+    }
+
+    /**
+     * 根据参数键名(班级id)查询参数值config_value(下课时间)
+     */
+    @PostMapping(value = "/configKey")
+    public AjaxResult getConfigKey(@Validated @RequestBody XiakeConfig config)
+    {
+        return success(configService.selectConfigByKey(config));
+    }
+    /**
+     * 根据参数键名修改参数值
+     */
+    @PostMapping(value = "/updateConfigKey")
+    public AjaxResult updateConfigKey(@Validated @RequestBody XiakeConfig config)
+    {
+        return success(configService.updateConfigValue(config));
+    }
+
+/*    *//**
+     * 新增参数配置
+     *//*
+    @PreAuthorize("@ss.hasPermi('system:config:add')")
+    @Log(title = "参数管理", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@Validated @RequestBody XiakeConfig config)
+    {
+        if (!configService.checkConfigKeyUnique(config))
+        {
+            return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
+        }
+        config.setCreateBy(getUsername());
+        return toAjax(configService.insertConfig(config));
+    }*/
+
+/*    *//**
+     * 修改参数配置
+     *//*
+    @PreAuthorize("@ss.hasPermi('system:config:edit')")
+    @Log(title = "参数管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@Validated @RequestBody XiakeConfig config)
+    {
+        if (!configService.checkConfigKeyUnique(config))
+        {
+            return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
+        }
+        config.setUpdateBy(getUsername());
+        return toAjax(configService.updateConfig(config));
+    }*/
+
+/*    *//**
+     * 删除参数配置
+     *//*
+    @PreAuthorize("@ss.hasPermi('system:config:remove')")
+    @Log(title = "参数管理", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{configIds}")
+    public AjaxResult remove(@PathVariable Long[] configIds)
+    {
+        configService.deleteConfigByIds(configIds);
+        return success();
+    }*/
+
+    /**
+     * 刷新参数缓存
+     */
+    @PreAuthorize("@ss.hasPermi('system:config:remove')")
+    @Log(title = "参数管理", businessType = BusinessType.CLEAN)
+    @DeleteMapping("/refreshCache")
+    public AjaxResult refreshCache()
+    {
+        configService.resetConfigCache();
+        return success();
+    }
+}

+ 4 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java

@@ -21,6 +21,10 @@ public class CacheConstants
      * 参数管理 cache key
      */
     public static final String SYS_CONFIG_KEY = "sys_config:";
+    /**
+     * 下课管理
+     */
+    public static final String XIA_CONFIG_KEY = "xiake_config:";
 
     /**
      * 字典管理 cache key

+ 126 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/FormalTeacherClass.java

@@ -0,0 +1,126 @@
+package com.ruoyi.common.core.domain.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 老师-班级(学科)(审核通过之后数据)对象 formal_teacher_class
+ * 
+ * @author ruoyi
+ * @date 2023-05-25
+ */
+public class FormalTeacherClass extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** ID */
+    private Long id;
+
+    /** 老师id */
+    @Excel(name = "老师id")
+    private String teacherId;
+
+    /** 学校id */
+    @Excel(name = "学校id")
+    private String schoolId;
+
+    /** 学校名称 */
+    @Excel(name = "学校名称")
+    private String schoolName;
+
+    /** 班级id */
+    @Excel(name = "班级id")
+    private String classId;
+
+    /** 班级名称 */
+    @Excel(name = "班级名称")
+    private String className;
+
+    /** 学科 */
+    @Excel(name = "学科")
+    private String discipline;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setTeacherId(String teacherId) 
+    {
+        this.teacherId = teacherId;
+    }
+
+    public String getTeacherId() 
+    {
+        return teacherId;
+    }
+    public void setSchoolId(String schoolId) 
+    {
+        this.schoolId = schoolId;
+    }
+
+    public String getSchoolId() 
+    {
+        return schoolId;
+    }
+    public void setSchoolName(String schoolName) 
+    {
+        this.schoolName = schoolName;
+    }
+
+    public String getSchoolName() 
+    {
+        return schoolName;
+    }
+    public void setClassId(String classId) 
+    {
+        this.classId = classId;
+    }
+
+    public String getClassId() 
+    {
+        return classId;
+    }
+    public void setClassName(String className) 
+    {
+        this.className = className;
+    }
+
+    public String getClassName() 
+    {
+        return className;
+    }
+    public void setDiscipline(String discipline) 
+    {
+        this.discipline = discipline;
+    }
+
+    public String getDiscipline() 
+    {
+        return discipline;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("teacherId", getTeacherId())
+            .append("schoolId", getSchoolId())
+            .append("schoolName", getSchoolName())
+            .append("classId", getClassId())
+            .append("className", getClassName())
+            .append("discipline", getDiscipline())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 10 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@@ -89,6 +89,16 @@ public class SysUser extends BaseEntity
     /** 角色ID */
     private Long roleId;
 
+    private List<FormalTeacherClass> teacherClass;
+
+    public List<FormalTeacherClass> getTeacherClass() {
+        return teacherClass;
+    }
+
+    public void setTeacherClass(List<FormalTeacherClass> teacherClass) {
+        this.teacherClass = teacherClass;
+    }
+
     public SysUser()
     {
 

+ 20 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java

@@ -3,6 +3,10 @@ package com.ruoyi.framework.web.service;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
+import com.ruoyi.system.service.IFormalTeacherClassService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import com.ruoyi.common.core.domain.entity.SysRole;
@@ -24,6 +28,9 @@ public class SysPermissionService
     @Autowired
     private ISysMenuService menuService;
 
+    @Autowired
+    private IFormalTeacherClassService formalTeacherClassService;
+
     /**
      * 获取角色数据权限
      * 
@@ -45,6 +52,19 @@ public class SysPermissionService
         return roles;
     }
 
+    /**
+     * 获取角色数据权限
+     *
+     * @param user 用户信息
+     * @return 角色权限信息
+     */
+    public void getTeacherClass(SysUser user)
+    {
+        List<FormalTeacherClass> teacherClass = formalTeacherClassService.getTeacherClass(String.valueOf(user.getUserId()));
+        user.setTeacherClass(teacherClass);
+    }
+
+
     /**
      * 获取菜单数据权限
      * 

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java

@@ -47,7 +47,7 @@ public class SysConfig extends BaseEntity
         this.configId = configId;
     }
 
-    @NotBlank(message = "参数名称不能为空")
+    //@NotBlank(message = "参数名称不能为空")
     @Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
     public String getConfigName()
     {

+ 112 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/XiakeConfig.java

@@ -0,0 +1,112 @@
+package com.ruoyi.system.domain;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.annotation.Excel.ColumnType;
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
+
+/**
+ * 参数配置表 sys_config
+ * 
+ * @author ruoyi
+ */
+public class XiakeConfig extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 参数主键 */
+    @Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
+    private Long configId;
+
+    /** 参数名称 */
+    @Excel(name = "参数名称")
+    private String configName;
+
+    /** 参数键名 */
+    @Excel(name = "参数键名")
+    private String configKey;
+
+    /** 参数键值 */
+    @Excel(name = "参数键值")
+    private String configValue;
+
+    /** 系统内置(Y是 N否) */
+    @Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
+    private String configType;
+
+    public Long getConfigId()
+    {
+        return configId;
+    }
+
+    public void setConfigId(Long configId)
+    {
+        this.configId = configId;
+    }
+
+    //@NotBlank(message = "参数名称不能为空")
+    //@Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
+    public String getConfigName()
+    {
+        return configName;
+    }
+
+    public void setConfigName(String configName)
+    {
+        this.configName = configName;
+    }
+
+    //@NotBlank(message = "参数键名长度不能为空")
+    //@Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
+    public String getConfigKey()
+    {
+        return configKey;
+    }
+
+    public void setConfigKey(String configKey)
+    {
+        this.configKey = configKey;
+    }
+
+    //@NotBlank(message = "参数键值不能为空")
+    //@Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
+    public String getConfigValue()
+    {
+        return configValue;
+    }
+
+    public void setConfigValue(String configValue)
+    {
+        this.configValue = configValue;
+    }
+
+    public String getConfigType()
+    {
+        return configType;
+    }
+
+    public void setConfigType(String configType)
+    {
+        this.configType = configType;
+    }
+    
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("configId", getConfigId())
+            .append("configName", getConfigName())
+            .append("configKey", getConfigKey())
+            .append("configValue", getConfigValue())
+            .append("configType", getConfigType())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 63 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/FormalTeacherClassMapper.java

@@ -0,0 +1,63 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
+
+/**
+ * 老师-班级(学科)(审核通过之后数据)Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-05-25
+ */
+public interface FormalTeacherClassMapper 
+{
+    /**
+     * 查询老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param id 老师-班级(学科)(审核通过之后数据)主键
+     * @return 老师-班级(学科)(审核通过之后数据)
+     */
+    public FormalTeacherClass selectFormalTeacherClassById(Long id);
+
+    /**
+     * 查询老师-班级(学科)(审核通过之后数据)列表
+     * 
+     * @param formalTeacherClass 老师-班级(学科)(审核通过之后数据)
+     * @return 老师-班级(学科)(审核通过之后数据)集合
+     */
+    public List<FormalTeacherClass> selectFormalTeacherClassList(FormalTeacherClass formalTeacherClass);
+
+    /**
+     * 新增老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param formalTeacherClass 老师-班级(学科)(审核通过之后数据)
+     * @return 结果
+     */
+    public int insertFormalTeacherClass(FormalTeacherClass formalTeacherClass);
+
+    /**
+     * 修改老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param formalTeacherClass 老师-班级(学科)(审核通过之后数据)
+     * @return 结果
+     */
+    public int updateFormalTeacherClass(FormalTeacherClass formalTeacherClass);
+
+    /**
+     * 删除老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param id 老师-班级(学科)(审核通过之后数据)主键
+     * @return 结果
+     */
+    public int deleteFormalTeacherClassById(Long id);
+
+    /**
+     * 批量删除老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteFormalTeacherClassByIds(Long[] ids);
+
+    public List<FormalTeacherClass> getTeacherClass(String teacherId);
+}

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java

@@ -57,6 +57,7 @@ public interface SysConfigMapper
      * @return 结果
      */
     public int updateConfig(SysConfig config);
+    public int updateConfigByKey(SysConfig config);
 
     /**
      * 删除参数配置

+ 78 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/XiakeConfigMapper.java

@@ -0,0 +1,78 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.domain.XiakeConfig;
+
+import java.util.List;
+
+/**
+ * 参数配置 数据层
+ * 
+ * @author ruoyi
+ */
+public interface XiakeConfigMapper
+{
+    /**
+     * 查询参数配置信息
+     * 
+     * @param config 参数配置信息
+     * @return 参数配置信息
+     */
+    public XiakeConfig selectConfig(XiakeConfig config);
+
+    /**
+     * 通过ID查询配置
+     * 
+     * @param configId 参数ID
+     * @return 参数配置信息
+     */
+    public XiakeConfig selectConfigById(Long configId);
+
+    /**
+     * 查询参数配置列表
+     * 
+     * @param config 参数配置信息
+     * @return 参数配置集合
+     */
+    public List<XiakeConfig> selectConfigList(XiakeConfig config);
+
+    /**
+     * 根据键名查询参数配置信息
+     * 
+     * @param configKey 参数键名
+     * @return 参数配置信息
+     */
+    public XiakeConfig checkConfigKeyUnique(String configKey);
+
+    /**
+     * 新增参数配置
+     * 
+     * @param config 参数配置信息
+     * @return 结果
+     */
+    public int insertConfig(XiakeConfig config);
+
+    /**
+     * 修改参数配置
+     * 
+     * @param config 参数配置信息
+     * @return 结果
+     */
+    public int updateConfig(XiakeConfig config);
+    public int updateConfigByKey(XiakeConfig config);
+
+    /**
+     * 删除参数配置
+     * 
+     * @param configId 参数ID
+     * @return 结果
+     */
+    public int deleteConfigById(Long configId);
+
+    /**
+     * 批量删除参数信息
+     * 
+     * @param configIds 需要删除的参数ID
+     * @return 结果
+     */
+    public int deleteConfigByIds(Long[] configIds);
+}

+ 15 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IAppletService.java

@@ -0,0 +1,15 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
+
+/**
+ * @Author: tjf
+ * @Date: 2023/5/25 11:47
+ * @Describe:
+ */
+public interface IAppletService {
+    public void xiake(FormalTeacherClass formalTeacherClass);
+    public AjaxResult index(FormalTeacherClass formalTeacherClass);
+    public AjaxResult indexList(FormalTeacherClass formalTeacherClass);
+}

+ 63 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IFormalTeacherClassService.java

@@ -0,0 +1,63 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
+
+/**
+ * 老师-班级(学科)(审核通过之后数据)Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-05-25
+ */
+public interface IFormalTeacherClassService 
+{
+    /**
+     * 查询老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param id 老师-班级(学科)(审核通过之后数据)主键
+     * @return 老师-班级(学科)(审核通过之后数据)
+     */
+    public FormalTeacherClass selectFormalTeacherClassById(Long id);
+
+    /**
+     * 查询老师-班级(学科)(审核通过之后数据)列表
+     * 
+     * @param formalTeacherClass 老师-班级(学科)(审核通过之后数据)
+     * @return 老师-班级(学科)(审核通过之后数据)集合
+     */
+    public List<FormalTeacherClass> selectFormalTeacherClassList(FormalTeacherClass formalTeacherClass);
+
+    /**
+     * 新增老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param formalTeacherClass 老师-班级(学科)(审核通过之后数据)
+     * @return 结果
+     */
+    public int insertFormalTeacherClass(FormalTeacherClass formalTeacherClass);
+
+    /**
+     * 修改老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param formalTeacherClass 老师-班级(学科)(审核通过之后数据)
+     * @return 结果
+     */
+    public int updateFormalTeacherClass(FormalTeacherClass formalTeacherClass);
+
+    /**
+     * 批量删除老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param ids 需要删除的老师-班级(学科)(审核通过之后数据)主键集合
+     * @return 结果
+     */
+    public int deleteFormalTeacherClassByIds(Long[] ids);
+
+    /**
+     * 删除老师-班级(学科)(审核通过之后数据)信息
+     * 
+     * @param id 老师-班级(学科)(审核通过之后数据)主键
+     * @return 结果
+     */
+    public int deleteFormalTeacherClassById(Long id);
+
+    public List<FormalTeacherClass> getTeacherClass(String teacherId);
+}

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java

@@ -56,6 +56,7 @@ public interface ISysConfigService
      * @return 结果
      */
     public int updateConfig(SysConfig config);
+    public int updateConfigValue(SysConfig config);
 
     /**
      * 批量删除参数信息

+ 78 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IXiakeConfigService.java

@@ -0,0 +1,78 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.system.domain.XiakeConfig;
+
+import java.util.List;
+
+/**
+ * 参数配置 服务层
+ * 
+ * @author ruoyi
+ */
+public interface IXiakeConfigService
+{
+    /**
+     * 查询参数配置信息
+     * 
+     * @param configId 参数配置ID
+     * @return 参数配置信息
+     */
+    public XiakeConfig selectConfigById(Long configId);
+
+    /**
+     * 根据键名查询参数配置信息
+     * 
+     * @param config 参数键名
+     * @return 参数键值
+     */
+    public String selectConfigByKey(XiakeConfig config);
+
+
+
+    /**
+     * 新增参数配置
+     * 
+     * @param config 参数配置信息
+     * @return 结果
+     */
+    public int insertConfig(XiakeConfig config);
+
+    /**
+     * 修改参数配置
+     * 
+     * @param config 参数配置信息
+     * @return 结果
+     */
+    public int updateConfig(XiakeConfig config);
+    public int updateConfigValue(XiakeConfig config);
+
+    /**
+     * 批量删除参数信息
+     * 
+     * @param configIds 需要删除的参数ID
+     */
+    public void deleteConfigByIds(Long[] configIds);
+
+    /**
+     * 加载参数缓存数据
+     */
+    public void loadingConfigCache();
+
+    /**
+     * 清空参数缓存数据
+     */
+    public void clearConfigCache();
+
+    /**
+     * 重置参数缓存数据
+     */
+    public void resetConfigCache();
+
+    /**
+     * 校验参数键名是否唯一
+     * 
+     * @param config 参数信息
+     * @return 结果
+     */
+    public boolean checkConfigKeyUnique(XiakeConfig config);
+}

+ 110 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AppletServiceImpl.java

@@ -0,0 +1,110 @@
+package com.ruoyi.system.service.impl;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.mapper.SysConfigMapper;
+import com.ruoyi.system.service.IAppletService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * @Author: tjf
+ * @Date: 2023/5/25 11:48
+ * @Describe:
+ */
+@Service
+public class AppletServiceImpl implements IAppletService {
+    @Autowired
+    private RedisCache redisCache;
+
+    @Autowired
+    private SysConfigMapper configMapper;
+
+    /**
+     * 老师准备下课按钮
+     *
+     * @param formalTeacherClass
+     */
+    @Override
+    public void xiake(FormalTeacherClass formalTeacherClass) {
+        Collection<String> keys = redisCache.keys(formalTeacherClass.getSchoolId() + "*");
+        //key = 学校id:班级id
+        for (String key : keys) {
+            //从key键中提取班级ID
+            String classId = key.replaceAll(formalTeacherClass.getSchoolId()+":", "");
+            if (classId.equals(formalTeacherClass.getClassId())) {
+                //Redis根据key键,查询对应的值
+                String value = redisCache.getCacheObject(key);
+                //value = 班级名称:放学时间
+                //获取当前时间
+                Calendar nowTime = Calendar.getInstance();
+                //获取参数中默认下课时间
+                SysConfig config = new SysConfig();
+                config.setConfigKey("xiake.time");
+                SysConfig retConfig = configMapper.selectConfig(config);
+                String configValue = retConfig.getConfigValue();
+                nowTime.add(Calendar.MINUTE, Integer.parseInt(configValue));
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                value = value.replace("time", sdf.format(nowTime.getTime()));
+                redisCache.setCacheObject(key, value);
+            }
+        }
+    }
+
+    @Override
+    public AjaxResult index(FormalTeacherClass formalTeacherClass) {
+        Map<String, Object> map = new HashMap<>(3);
+        map.put("all", 0);
+        Collection<String> keys = redisCache.keys(formalTeacherClass.getSchoolId() + "*");
+        if (keys != null && keys.size() > 0) {
+            map.put("all", keys.size());
+            map.put("n", 0);
+            map.put("y", 0);
+            int n = 0;
+            for (String key : keys) {
+                //Redis根据key键,查询对应的值
+                String value = redisCache.getCacheObject(key);
+                //value = 班级名称:放学时间
+                //判断有多少放学时间是time,占位符
+                String[] split = value.split(":");
+                String time = split[1];
+                if ("time".equals(time)) {
+                    n = n + 1;
+                }
+            }
+            if (n > 0) {
+                map.put("n", n);
+                int y = keys.size() - n;
+                map.put("y", Math.max(y, 0));
+            }
+        }
+        return AjaxResult.success(map);
+    }
+
+    @Override
+    public AjaxResult indexList(FormalTeacherClass formalTeacherClass) {
+        List<Map<String, Object>> list = new ArrayList<>();
+        Collection<String> keys = redisCache.keys(formalTeacherClass.getSchoolId() + "*");
+        if (keys != null && keys.size() > 0) {
+            for (String key : keys) {
+                String value = redisCache.getCacheObject(key);
+                //value = 班级名称:放学时间
+                String[] split = value.split(":");
+                Map<String, Object> map = new HashMap<>();
+                map.put("className", split[0]);
+                map.put("time", split[1]);
+                list.add(map);
+            }
+        }
+        return AjaxResult.success(list);
+    }
+}

+ 116 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FormalTeacherClassServiceImpl.java

@@ -0,0 +1,116 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.domain.XiakeConfig;
+import com.ruoyi.system.mapper.XiakeConfigMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.FormalTeacherClassMapper;
+import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
+import com.ruoyi.system.service.IFormalTeacherClassService;
+
+/**
+ * 老师-班级(学科)(审核通过之后数据)Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-05-25
+ */
+@Service
+public class FormalTeacherClassServiceImpl implements IFormalTeacherClassService 
+{
+    @Autowired
+    private FormalTeacherClassMapper formalTeacherClassMapper;
+    @Autowired
+    private XiakeConfigMapper xiakeConfigMapper;
+
+    /**
+     * 查询老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param id 老师-班级(学科)(审核通过之后数据)主键
+     * @return 老师-班级(学科)(审核通过之后数据)
+     */
+    @Override
+    public FormalTeacherClass selectFormalTeacherClassById(Long id)
+    {
+        return formalTeacherClassMapper.selectFormalTeacherClassById(id);
+    }
+
+    /**
+     * 查询老师-班级(学科)(审核通过之后数据)列表
+     * 
+     * @param formalTeacherClass 老师-班级(学科)(审核通过之后数据)
+     * @return 老师-班级(学科)(审核通过之后数据)
+     */
+    @Override
+    public List<FormalTeacherClass> selectFormalTeacherClassList(FormalTeacherClass formalTeacherClass)
+    {
+        return formalTeacherClassMapper.selectFormalTeacherClassList(formalTeacherClass);
+    }
+
+    /**
+     * 新增老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param formalTeacherClass 老师-班级(学科)(审核通过之后数据)
+     * @return 结果
+     */
+    @Override
+    public int insertFormalTeacherClass(FormalTeacherClass formalTeacherClass)
+    {
+        formalTeacherClass.setCreateTime(DateUtils.getNowDate());
+        //需要新增两个班级下课时间和延迟下课的默认值/
+        XiakeConfig xiakeConfig = new XiakeConfig();
+        xiakeConfig.setConfigKey(formalTeacherClass.getClassId() + ":1");
+        xiakeConfig.setConfigValue("5");
+        xiakeConfig.setConfigType("1");
+        xiakeConfigMapper.insertConfig(xiakeConfig);
+        XiakeConfig xiakeConfig2 = new XiakeConfig();
+        xiakeConfig2.setConfigKey(formalTeacherClass.getClassId() + ":2");
+        xiakeConfig2.setConfigValue("5");
+        xiakeConfig2.setConfigType("2");
+        xiakeConfigMapper.insertConfig(xiakeConfig2);
+        return formalTeacherClassMapper.insertFormalTeacherClass(formalTeacherClass);
+    }
+
+    /**
+     * 修改老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param formalTeacherClass 老师-班级(学科)(审核通过之后数据)
+     * @return 结果
+     */
+    @Override
+    public int updateFormalTeacherClass(FormalTeacherClass formalTeacherClass)
+    {
+        formalTeacherClass.setUpdateTime(DateUtils.getNowDate());
+        return formalTeacherClassMapper.updateFormalTeacherClass(formalTeacherClass);
+    }
+
+    /**
+     * 批量删除老师-班级(学科)(审核通过之后数据)
+     * 
+     * @param ids 需要删除的老师-班级(学科)(审核通过之后数据)主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFormalTeacherClassByIds(Long[] ids)
+    {
+        return formalTeacherClassMapper.deleteFormalTeacherClassByIds(ids);
+    }
+
+    /**
+     * 删除老师-班级(学科)(审核通过之后数据)信息
+     * 
+     * @param id 老师-班级(学科)(审核通过之后数据)主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFormalTeacherClassById(Long id)
+    {
+        return formalTeacherClassMapper.deleteFormalTeacherClassById(id);
+    }
+
+    @Override
+    public List<FormalTeacherClass> getTeacherClass(String teacherId) {
+        return formalTeacherClassMapper.getTeacherClass(teacherId);
+    }
+}

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java

@@ -148,6 +148,22 @@ public class SysConfigServiceImpl implements ISysConfigService
         return row;
     }
 
+    @Override
+    public int updateConfigValue(SysConfig config) {
+        SysConfig temp = configMapper.checkConfigKeyUnique(config.getConfigKey());
+        if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
+        {
+            redisCache.deleteObject(getCacheKey(temp.getConfigKey()));
+        }
+
+        int row = configMapper.updateConfigByKey(config);
+        if (row > 0)
+        {
+            redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
+        }
+        return row;
+    }
+
     /**
      * 批量删除参数信息
      * 

+ 229 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XiakeConfigServiceImpl.java

@@ -0,0 +1,229 @@
+package com.ruoyi.system.service.impl;
+
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.constant.CacheConstants;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.XiakeConfig;
+import com.ruoyi.system.mapper.XiakeConfigMapper;
+import com.ruoyi.system.mapper.XiakeConfigMapper;
+import com.ruoyi.system.service.IXiakeConfigService;
+import com.ruoyi.system.service.IXiakeConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 参数配置 服务层实现
+ * 
+ * @author ruoyi
+ */
+@Service
+public class XiakeConfigServiceImpl implements IXiakeConfigService
+{
+    @Autowired
+    private XiakeConfigMapper configMapper;
+
+    @Autowired
+    private RedisCache redisCache;
+
+    /**
+     * 项目启动时,初始化参数到缓存
+     */
+    @PostConstruct
+    public void init()
+    {
+        loadingConfigCache();
+    }
+
+    /**
+     * 查询参数配置信息
+     * 
+     * @param configId 参数配置ID
+     * @return 参数配置信息
+     */
+    @Override
+    @DataSource(DataSourceType.MASTER)
+    public XiakeConfig selectConfigById(Long configId)
+    {
+        XiakeConfig config = new XiakeConfig();
+        config.setConfigId(configId);
+        return configMapper.selectConfig(config);
+    }
+
+    /**
+     * 根据键名查询参数配置信息
+     * 
+     * @param config 参数key
+     * @return 参数键值
+     */
+    @Override
+    public String selectConfigByKey(XiakeConfig config)
+    {
+        String configType = config.getConfigType();
+        String cacheKey = getCacheKey(config.getConfigKey());
+        cacheKey = cacheKey + ":"+configType;
+        String configValue = Convert.toStr(redisCache.getCacheObject(cacheKey));
+        if (StringUtils.isNotEmpty(configValue))
+        {
+            return configValue;
+        }
+        config.setConfigKey(config.getConfigKey()+ ":"+configType);
+        XiakeConfig retConfig = configMapper.selectConfig(config);
+        if (StringUtils.isNotNull(retConfig))
+        {
+            redisCache.setCacheObject(getCacheKey(cacheKey), retConfig.getConfigValue());
+            return retConfig.getConfigValue();
+        }
+        return StringUtils.EMPTY;
+    }
+
+
+
+    /**
+     * 新增参数配置
+     * 
+     * @param config 参数配置信息
+     * @return 结果
+     */
+    @Override
+    public int insertConfig(XiakeConfig config)
+    {
+        int row = configMapper.insertConfig(config);
+        if (row > 0)
+        {
+            redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
+        }
+        return row;
+    }
+
+    /**
+     * 修改参数配置
+     * 
+     * @param config 参数配置信息
+     * @return 结果
+     */
+    @Override
+    public int updateConfig(XiakeConfig config)
+    {
+        XiakeConfig temp = configMapper.selectConfigById(config.getConfigId());
+        if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
+        {
+            redisCache.deleteObject(getCacheKey(temp.getConfigKey()));
+        }
+
+        int row = configMapper.updateConfig(config);
+        if (row > 0)
+        {
+            redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
+        }
+        return row;
+    }
+
+    @Override
+    public int updateConfigValue(XiakeConfig config) {
+        String key = config.getConfigKey() + ":" + config.getConfigType();
+
+        XiakeConfig temp = configMapper.checkConfigKeyUnique(key);
+        if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
+        {
+            redisCache.deleteObject(getCacheKey(temp.getConfigKey()));
+        }
+        config.setConfigKey(key);
+        int row = configMapper.updateConfigByKey(config);
+        if (row > 0)
+        {
+            redisCache.setCacheObject(getCacheKey(key), config.getConfigValue());
+        }
+        return row;
+    }
+
+    /**
+     * 批量删除参数信息
+     * 
+     * @param configIds 需要删除的参数ID
+     */
+    @Override
+    public void deleteConfigByIds(Long[] configIds)
+    {
+        for (Long configId : configIds)
+        {
+            XiakeConfig config = selectConfigById(configId);
+            if (StringUtils.equals(UserConstants.YES, config.getConfigType()))
+            {
+                throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
+            }
+            configMapper.deleteConfigById(configId);
+            redisCache.deleteObject(getCacheKey(config.getConfigKey()));
+        }
+    }
+
+    /**
+     * 加载参数缓存数据
+     */
+    @Override
+    public void loadingConfigCache()
+    {
+        List<XiakeConfig> configsList = configMapper.selectConfigList(new XiakeConfig());
+        for (XiakeConfig config : configsList)
+        {
+            redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
+        }
+    }
+
+    /**
+     * 清空参数缓存数据
+     */
+    @Override
+    public void clearConfigCache()
+    {
+        Collection<String> keys = redisCache.keys(CacheConstants.XIA_CONFIG_KEY + "*");
+        redisCache.deleteObject(keys);
+    }
+
+    /**
+     * 重置参数缓存数据
+     */
+    @Override
+    public void resetConfigCache()
+    {
+        clearConfigCache();
+        loadingConfigCache();
+    }
+
+    /**
+     * 校验参数键名是否唯一
+     * 
+     * @param config 参数配置信息
+     * @return 结果
+     */
+    @Override
+    public boolean checkConfigKeyUnique(XiakeConfig config)
+    {
+        Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
+        XiakeConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
+        if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
+        {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
+
+    /**
+     * 设置cache key
+     * 
+     * @param configKey 参数键
+     * @return 缓存键key
+     */
+    private String getCacheKey(String configKey)
+    {
+        return CacheConstants.XIA_CONFIG_KEY + configKey;
+    }
+}

+ 105 - 0
ruoyi-system/src/main/resources/mapper/system/FormalTeacherClassMapper.xml

@@ -0,0 +1,105 @@
+<?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="com.ruoyi.system.mapper.FormalTeacherClassMapper">
+    
+    <resultMap type="FormalTeacherClass" id="FormalTeacherClassResult">
+        <result property="id"    column="id"    />
+        <result property="teacherId"    column="teacher_id"    />
+        <result property="schoolId"    column="school_id"    />
+        <result property="schoolName"    column="school_name"    />
+        <result property="classId"    column="class_id"    />
+        <result property="className"    column="class_name"    />
+        <result property="discipline"    column="discipline"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectFormalTeacherClassVo">
+        select id, teacher_id, school_id, school_name, class_id, class_name, discipline, create_by, create_time, update_by, update_time, remark from formal_teacher_class
+    </sql>
+
+    <select id="selectFormalTeacherClassList" parameterType="FormalTeacherClass" resultMap="FormalTeacherClassResult">
+        <include refid="selectFormalTeacherClassVo"/>
+        <where>  
+            <if test="teacherId != null  and teacherId != ''"> and teacher_id = #{teacherId}</if>
+            <if test="schoolId != null  and schoolId != ''"> and school_id = #{schoolId}</if>
+            <if test="schoolName != null  and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
+            <if test="classId != null  and classId != ''"> and class_id = #{classId}</if>
+            <if test="className != null  and className != ''"> and class_name like concat('%', #{className}, '%')</if>
+            <if test="discipline != null  and discipline != ''"> and discipline = #{discipline}</if>
+        </where>
+    </select>
+    
+    <select id="selectFormalTeacherClassById" parameterType="Long" resultMap="FormalTeacherClassResult">
+        <include refid="selectFormalTeacherClassVo"/>
+        where id = #{id}
+    </select>
+    <select id="getTeacherClass" parameterType="string" resultMap="FormalTeacherClassResult">
+        <include refid="selectFormalTeacherClassVo"/>
+        where teacher_id = #{teacherId}
+    </select>
+
+    <insert id="insertFormalTeacherClass" parameterType="FormalTeacherClass" useGeneratedKeys="true" keyProperty="id">
+        insert into formal_teacher_class
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="teacherId != null and teacherId != ''">teacher_id,</if>
+            <if test="schoolId != null">school_id,</if>
+            <if test="schoolName != null">school_name,</if>
+            <if test="classId != null and classId != ''">class_id,</if>
+            <if test="className != null and className != ''">class_name,</if>
+            <if test="discipline != null and discipline != ''">discipline,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="teacherId != null and teacherId != ''">#{teacherId},</if>
+            <if test="schoolId != null">#{schoolId},</if>
+            <if test="schoolName != null">#{schoolName},</if>
+            <if test="classId != null and classId != ''">#{classId},</if>
+            <if test="className != null and className != ''">#{className},</if>
+            <if test="discipline != null and discipline != ''">#{discipline},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFormalTeacherClass" parameterType="FormalTeacherClass">
+        update formal_teacher_class
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="teacherId != null and teacherId != ''">teacher_id = #{teacherId},</if>
+            <if test="schoolId != null">school_id = #{schoolId},</if>
+            <if test="schoolName != null">school_name = #{schoolName},</if>
+            <if test="classId != null and classId != ''">class_id = #{classId},</if>
+            <if test="className != null and className != ''">class_name = #{className},</if>
+            <if test="discipline != null and discipline != ''">discipline = #{discipline},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteFormalTeacherClassById" parameterType="Long">
+        delete from formal_teacher_class where id = #{id}
+    </delete>
+
+    <delete id="deleteFormalTeacherClassByIds" parameterType="String">
+        delete from formal_teacher_class where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 8 - 2
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml

@@ -68,7 +68,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectConfigVo"/>
         where config_key = #{configKey} limit 1
     </select>
-    
     <insert id="insertConfig" parameterType="SysConfig">
         insert into sys_config (
 			<if test="configName != null and configName != '' ">config_name,</if>
@@ -102,7 +101,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </set>
         where config_id = #{configId}
     </update>
-	
+    <update id="updateConfigByKey">
+        update sys_config
+        <set>
+            <if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
+        </set>
+        where config_key = #{configKey}
+    </update>
+
     <delete id="deleteConfigById" parameterType="Long">
         delete from sys_config where config_id = #{configId}
     </delete>

+ 123 - 0
ruoyi-system/src/main/resources/mapper/system/XiakeConfigMapper.xml

@@ -0,0 +1,123 @@
+<?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="com.ruoyi.system.mapper.XiakeConfigMapper">
+    
+    <resultMap type="XiakeConfig" id="XiakeConfigResult">
+    	<id     property="configId"      column="config_id"      />
+        <result property="configName"    column="config_name"    />
+        <result property="configKey"     column="config_key"     />
+        <result property="configValue"   column="config_value"   />
+        <result property="configType"    column="config_type"    />
+        <result property="createBy"      column="create_by"      />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"      column="update_by"      />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+    
+    <sql id="selectConfigVo">
+        select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark 
+		from xiake_config
+    </sql>
+    
+    <!-- 查询条件 -->
+	<sql id="sqlwhereSearch">
+		<where>
+			<if test="configId !=null">
+				and config_id = #{configId}
+			</if>
+			<if test="configKey !=null and configKey != ''">
+				and config_key = #{configKey}
+			</if>
+		</where>
+	</sql>
+    
+    <select id="selectConfig" parameterType="XiakeConfig" resultMap="XiakeConfigResult">
+        <include refid="selectConfigVo"/>
+        <include refid="sqlwhereSearch"/>
+    </select>
+    
+    <select id="selectConfigList" parameterType="XiakeConfig" resultMap="XiakeConfigResult">
+        <include refid="selectConfigVo"/>
+        <where>
+			<if test="configName != null and configName != ''">
+				AND config_name like concat('%', #{configName}, '%')
+			</if>
+			<if test="configType != null and configType != ''">
+				AND config_type = #{configType}
+			</if>
+			<if test="configKey != null and configKey != ''">
+				AND config_key like concat('%', #{configKey}, '%')
+			</if>
+			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+				and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+			</if>
+			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+				and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+			</if>
+		</where>
+    </select>
+    
+    <select id="selectConfigById" parameterType="Long" resultMap="XiakeConfigResult">
+        <include refid="selectConfigVo"/>
+        where config_id = #{configId}
+    </select>
+	
+    <select id="checkConfigKeyUnique" parameterType="String" resultMap="XiakeConfigResult">
+        <include refid="selectConfigVo"/>
+        where config_key = #{configKey} limit 1
+    </select>
+    <insert id="insertConfig" parameterType="XiakeConfig">
+        insert into xiake_config (
+			<if test="configName != null and configName != '' ">config_name,</if>
+			<if test="configKey != null and configKey != '' ">config_key,</if>
+			<if test="configValue != null and configValue != '' ">config_value,</if>
+			<if test="configType != null and configType != '' ">config_type,</if>
+			<if test="createBy != null and createBy != ''">create_by,</if>
+			<if test="remark != null and remark != ''">remark,</if>
+ 			create_time
+        )values(
+			<if test="configName != null and configName != ''">#{configName},</if>
+			<if test="configKey != null and configKey != ''">#{configKey},</if>
+			<if test="configValue != null and configValue != ''">#{configValue},</if>
+			<if test="configType != null and configType != ''">#{configType},</if>
+			<if test="createBy != null and createBy != ''">#{createBy},</if>
+			<if test="remark != null and remark != ''">#{remark},</if>
+ 			sysdate()
+		)
+    </insert>
+	 
+    <update id="updateConfig" parameterType="XiakeConfig">
+        update xiake_config 
+        <set>
+            <if test="configName != null and configName != ''">config_name = #{configName},</if>
+            <if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
+            <if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
+            <if test="configType != null and configType != ''">config_type = #{configType},</if>
+            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+            <if test="remark != null">remark = #{remark},</if>
+ 			update_time = sysdate()
+        </set>
+        where config_id = #{configId}
+    </update>
+    <update id="updateConfigByKey">
+        update xiake_config
+        <set>
+            <if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
+        </set>
+        where config_key = #{configKey}
+    </update>
+
+    <delete id="deleteConfigById" parameterType="Long">
+        delete from xiake_config where config_id = #{configId}
+    </delete>
+    
+    <delete id="deleteConfigByIds" parameterType="Long">
+        delete from xiake_config where config_id in 
+        <foreach item="configId" collection="array" open="(" separator="," close=")">
+        	#{configId}
+        </foreach>
+    </delete>
+    
+</mapper>