Merge branch 'master' of 39.106.16.162:/home/git/teaching-backend/teaching-backend

master
youhang20021127 3 months ago
commit a2209869a6
  1. 2
      src/main/java/com/teaching/backend/common/ErrorCode.java
  2. 21
      src/main/java/com/teaching/backend/controller/system/SystemController.java
  3. 45
      src/main/java/com/teaching/backend/controller/system/SystemSettingsController.java
  4. 2
      src/main/java/com/teaching/backend/mapper/report/ReportMapper.java
  5. 11
      src/main/java/com/teaching/backend/mapper/system/SystemSettingsMapper.java
  6. 3
      src/main/java/com/teaching/backend/mapper/umsAdmin/UmsStudentMapper.java
  7. 3
      src/main/java/com/teaching/backend/mapper/umsAdmin/UmsTeacherMapper.java
  8. 2
      src/main/java/com/teaching/backend/model/entity/system/SystemSetting.java
  9. 52
      src/main/java/com/teaching/backend/model/vo/system/SystemSettingVO.java
  10. 4
      src/main/java/com/teaching/backend/service/impl/courses/ObjectiveContentKnowServiceImpl.java
  11. 45
      src/main/java/com/teaching/backend/service/impl/system/SystemSettingsServiceImpl.java
  12. 12
      src/main/java/com/teaching/backend/service/system/SystemSettingsService.java
  13. 48
      src/main/resources/mapper/SystemSettingsMapper.xml
  14. 0
      src/main/resources/mapper/UmsStudentManageMapper.xml

@ -22,6 +22,8 @@ public enum ErrorCode {
INVALID_ROLE(400010, "角色不存在"),
MESSAGE_NO_READ(400011, "消息未读,禁止删除!"),
MESSAGE_NO_EXIT(400012, "消息不存在!"),
CONTENT_HAS_NO_KNOWS(400013, "该课程目标暂未关联知识点!"),
NOT_LOGIN_ERROR(40100, "未登录"),
NO_AUTH_ERROR(40101, "无权限"),
NOT_FOUND_ERROR(40400, "请求数据不存在"),

@ -1,21 +0,0 @@
package com.teaching.backend.controller.system;
import com.teaching.backend.common.CommonResult;
import com.teaching.backend.model.vo.report.BrowseReportVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Api(tags = "系统设置接口")
@RequestMapping("/api/system")
@Slf4j
public class SystemController {
}

@ -0,0 +1,45 @@
package com.teaching.backend.controller.system;
import com.teaching.backend.common.CommonResult;
import com.teaching.backend.model.entity.system.SystemSetting;
import com.teaching.backend.model.vo.system.SystemSettingVO;
import com.teaching.backend.service.system.SystemSettingsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@Api(tags = "系统设置接口")
@RequestMapping("/api/systemSettings")
@Slf4j
public class SystemSettingsController {
@Autowired
private SystemSettingsService systemSettingsService;
/**
* 查询系统设置信息
* @param
* @return
*/
@GetMapping("/save")
@ApiOperation("查询系统设置信息")
public CommonResult<SystemSettingVO> save(){
SystemSettingVO systemSettings = systemSettingsService.getSystemSettings();
return CommonResult.success(systemSettings);
}
/**
* 编辑系统设置信息
* @param systemSetting
* @return
*/
@PutMapping
@ApiOperation("编辑系统设置信息")
public CommonResult update(@RequestBody SystemSetting systemSetting){
return systemSettingsService.updateSystemSettings(systemSetting);
}
}

@ -3,9 +3,11 @@ package com.teaching.backend.mapper.report;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.dto.report.ReportDTO;
import com.teaching.backend.model.entity.report.Report;
import org.apache.ibatis.annotations.Mapper;
import java.time.LocalDate;
@Mapper
public interface ReportMapper extends BaseMapper<Report> {
String getBrowseByTime(LocalDate day);

@ -0,0 +1,11 @@
package com.teaching.backend.mapper.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.system.SystemSetting;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SystemSettingsMapper extends BaseMapper<SystemSetting> {
boolean updateSystemSettings(SystemSetting systemSetting);
}

@ -2,6 +2,7 @@ package com.teaching.backend.mapper.umsAdmin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.umsAdmin.UmsStudent;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
@ -11,6 +12,8 @@ import com.teaching.backend.model.entity.umsAdmin.UmsStudent;
* @author zjh
* @since 2024-06-12
*/
@Mapper
public interface UmsStudentMapper extends BaseMapper<UmsStudent> {
boolean updateStudentInfo(UmsStudent umsStudent);

@ -2,6 +2,7 @@ package com.teaching.backend.mapper.umsAdmin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.umsAdmin.UmsTeacher;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
@ -11,6 +12,8 @@ import com.teaching.backend.model.entity.umsAdmin.UmsTeacher;
* @author zjh
* @since 2024-06-12
*/
@Mapper
public interface UmsTeacherMapper extends BaseMapper<UmsTeacher> {
boolean updateTeacherInfo(UmsTeacher umsTeacher);

@ -9,7 +9,7 @@ import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@TableName("system_setting")
@TableName("system_settings")
public class SystemSetting implements Serializable {
//主键

@ -0,0 +1,52 @@
package com.teaching.backend.model.vo.system;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@Data
public class SystemSettingVO implements Serializable {
//主键
@TableId(type = IdType.AUTO)
private Long id;
//系统名称
private String name;
//LOGO
private String logo;
//宣传图片
private String promotionalImages;
//登录地址
private String loginAddress;
//标题
private String title;
//版权信息
private String copyrightInformation;
//备案号
private String recordNumber;
//QQ
private String qqNumber;
//邮箱
private String mailbox;
//手机号
private String phone;
//地址
private String address;
//二维码
private String qrCode;
}

@ -107,6 +107,9 @@ public class ObjectiveContentKnowServiceImpl extends ServiceImpl<ObjectiveConten
new LambdaQueryWrapper<ObjectiveContentKnow>()
.eq(ObjectiveContentKnow::getObjectiveContentId, objectiveContentId)
);
if(objectiveContentKnows.isEmpty()){
throw new BusinessException(ErrorCode.CONTENT_HAS_NO_KNOWS);
}
// 创建并设置ObjectiveContentKnowVO对象的属性
objectiveContentKnowVO = createObjectiveContentKnowVO(objectiveContentId, objectiveContentKnows);
@ -120,6 +123,7 @@ public class ObjectiveContentKnowServiceImpl extends ServiceImpl<ObjectiveConten
}
// 创建ObjectiveContentKnowVO对象,并计算知识点数量、总时间和关联的知识点部分数据
// TODO 查询知识点的数据 有优化空间!!!
private ObjectiveContentKnowVO createObjectiveContentKnowVO(String objectiveOrContentId, List<ObjectiveContentKnow> objectiveContentKnows) {
ObjectiveContentKnowVO vo = new ObjectiveContentKnowVO();
vo.setObjectiveOrContent(objectiveOrContentId);

@ -0,0 +1,45 @@
package com.teaching.backend.service.impl.system;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.common.CommonResult;
import com.teaching.backend.mapper.system.SystemSettingsMapper;
import com.teaching.backend.model.entity.system.SystemSetting;
import com.teaching.backend.model.vo.system.SystemSettingVO;
import com.teaching.backend.service.system.SystemSettingsService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
@Service
public class SystemSettingsServiceImpl extends ServiceImpl<SystemSettingsMapper, SystemSetting> implements SystemSettingsService {
@Autowired
private SystemSettingsMapper systemSettingsMapper;
@Override
public SystemSettingVO getSystemSettings() {
SystemSetting systemSetting = lambdaQuery().one();
if (systemSetting == null){
SystemSetting setting = new SystemSetting();
setting.setId(1L);
save(setting);
SystemSettingVO systemSettingVO = new SystemSettingVO();
BeanUtils.copyProperties(setting,systemSettingVO);
return systemSettingVO;
}
SystemSettingVO systemSettingVO = new SystemSettingVO();
BeanUtils.copyProperties(systemSetting,systemSettingVO);
return systemSettingVO;
}
@Override
public CommonResult updateSystemSettings(SystemSetting systemSetting) {
boolean systemSettings = systemSettingsMapper.updateSystemSettings(systemSetting);
if (systemSettings == true){
return CommonResult.success("修改成功");
}else {
return CommonResult.failed("修改失败");
}
}
}

@ -0,0 +1,12 @@
package com.teaching.backend.service.system;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.common.CommonResult;
import com.teaching.backend.model.entity.system.SystemSetting;
import com.teaching.backend.model.vo.system.SystemSettingVO;
public interface SystemSettingsService extends IService<SystemSetting> {
SystemSettingVO getSystemSettings();
CommonResult updateSystemSettings(SystemSetting systemSetting);
}

@ -0,0 +1,48 @@
<?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.teaching.backend.mapper.system.SystemSettingsMapper">
<update id="updateSystemSettings">
update system_settings
<set>
<if test="name != null and name != ''">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="logo != null and logo != ''">
logo = #{logo,jdbcType=VARCHAR},
</if>
<if test="promotionalImages != null and promotionalImages != ''">
promotional_images = #{promotionalImages,jdbcType=VARCHAR},
</if>
<if test="loginAddress != null and loginAddress != ''">
login_address = #{loginAddress,jdbcType=VARCHAR},
</if>
<if test="title != null and title != ''">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="copyrightInformation != null and copyrightInformation != ''">
copyright_information = #{copyrightInformation,jdbcType=VARCHAR},
</if>
<if test="recordNumber != null and recordNumber != ''">
record_number = #{recordNumber,jdbcType=VARCHAR},
</if>
<if test="qqNumber != null and qqNumber != ''">
qq_number = #{qqNumber,jdbcType=VARCHAR},
</if>
<if test="mailbox != null and mailbox != ''">
mailbox = #{mailbox,jdbcType=VARCHAR},
</if>
<if test="phone != null and phone != ''">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="address != null and address != ''">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="qrCode != null and qrCode != ''">
qr_code = #{qrCode,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
Loading…
Cancel
Save