diff --git a/src/main/java/com/teaching/backend/controller/system/SystemController.java b/src/main/java/com/teaching/backend/controller/system/SystemController.java deleted file mode 100644 index 748b4a8..0000000 --- a/src/main/java/com/teaching/backend/controller/system/SystemController.java +++ /dev/null @@ -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 { - - - -} diff --git a/src/main/java/com/teaching/backend/controller/system/SystemSettingsController.java b/src/main/java/com/teaching/backend/controller/system/SystemSettingsController.java new file mode 100644 index 0000000..d67125d --- /dev/null +++ b/src/main/java/com/teaching/backend/controller/system/SystemSettingsController.java @@ -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 save(){ + SystemSettingVO systemSettings = systemSettingsService.getSystemSettings(); + return CommonResult.success(systemSettings); + } + + /** + * 编辑系统设置信息 + * @param systemSetting + * @return + */ + @PutMapping + @ApiOperation("编辑系统设置信息") + public CommonResult update(@RequestBody SystemSetting systemSetting){ + return systemSettingsService.updateSystemSettings(systemSetting); + } + +} diff --git a/src/main/java/com/teaching/backend/mapper/report/ReportMapper.java b/src/main/java/com/teaching/backend/mapper/report/ReportMapper.java index 6da6396..a74f15a 100644 --- a/src/main/java/com/teaching/backend/mapper/report/ReportMapper.java +++ b/src/main/java/com/teaching/backend/mapper/report/ReportMapper.java @@ -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 { String getBrowseByTime(LocalDate day); diff --git a/src/main/java/com/teaching/backend/mapper/system/SystemSettingsMapper.java b/src/main/java/com/teaching/backend/mapper/system/SystemSettingsMapper.java new file mode 100644 index 0000000..116e5b0 --- /dev/null +++ b/src/main/java/com/teaching/backend/mapper/system/SystemSettingsMapper.java @@ -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 { + boolean updateSystemSettings(SystemSetting systemSetting); +} diff --git a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsStudentMapper.java b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsStudentMapper.java index fb58d74..946f34f 100644 --- a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsStudentMapper.java +++ b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsStudentMapper.java @@ -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; /** *

@@ -11,6 +12,8 @@ import com.teaching.backend.model.entity.umsAdmin.UmsStudent; * @author zjh * @since 2024-06-12 */ + +@Mapper public interface UmsStudentMapper extends BaseMapper { boolean updateStudentInfo(UmsStudent umsStudent); diff --git a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsTeacherMapper.java b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsTeacherMapper.java index 04e99e9..8e58a6c 100644 --- a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsTeacherMapper.java +++ b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsTeacherMapper.java @@ -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; /** *

@@ -11,6 +12,8 @@ import com.teaching.backend.model.entity.umsAdmin.UmsTeacher; * @author zjh * @since 2024-06-12 */ + +@Mapper public interface UmsTeacherMapper extends BaseMapper { boolean updateTeacherInfo(UmsTeacher umsTeacher); diff --git a/src/main/java/com/teaching/backend/model/entity/system/SystemSetting.java b/src/main/java/com/teaching/backend/model/entity/system/SystemSetting.java index 2e7b2df..96ea030 100644 --- a/src/main/java/com/teaching/backend/model/entity/system/SystemSetting.java +++ b/src/main/java/com/teaching/backend/model/entity/system/SystemSetting.java @@ -9,7 +9,7 @@ import java.io.Serializable; import java.time.LocalDateTime; @Data -@TableName("system_setting") +@TableName("system_settings") public class SystemSetting implements Serializable { //主键 diff --git a/src/main/java/com/teaching/backend/model/vo/system/SystemSettingVO.java b/src/main/java/com/teaching/backend/model/vo/system/SystemSettingVO.java new file mode 100644 index 0000000..36a127e --- /dev/null +++ b/src/main/java/com/teaching/backend/model/vo/system/SystemSettingVO.java @@ -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; +} diff --git a/src/main/java/com/teaching/backend/service/impl/system/SystemSettingsServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/system/SystemSettingsServiceImpl.java new file mode 100644 index 0000000..20dc9c0 --- /dev/null +++ b/src/main/java/com/teaching/backend/service/impl/system/SystemSettingsServiceImpl.java @@ -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 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("修改失败"); + } + } +} diff --git a/src/main/java/com/teaching/backend/service/system/SystemSettingsService.java b/src/main/java/com/teaching/backend/service/system/SystemSettingsService.java new file mode 100644 index 0000000..f6dea64 --- /dev/null +++ b/src/main/java/com/teaching/backend/service/system/SystemSettingsService.java @@ -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 { + SystemSettingVO getSystemSettings(); + + CommonResult updateSystemSettings(SystemSetting systemSetting); +} diff --git a/src/main/resources/mapper/SystemSettingsMapper.xml b/src/main/resources/mapper/SystemSettingsMapper.xml new file mode 100644 index 0000000..d5b2e9b --- /dev/null +++ b/src/main/resources/mapper/SystemSettingsMapper.xml @@ -0,0 +1,48 @@ + + + + + + update system_settings + + + name = #{name,jdbcType=VARCHAR}, + + + logo = #{logo,jdbcType=VARCHAR}, + + + promotional_images = #{promotionalImages,jdbcType=VARCHAR}, + + + login_address = #{loginAddress,jdbcType=VARCHAR}, + + + title = #{title,jdbcType=VARCHAR}, + + + copyright_information = #{copyrightInformation,jdbcType=VARCHAR}, + + + record_number = #{recordNumber,jdbcType=VARCHAR}, + + + qq_number = #{qqNumber,jdbcType=VARCHAR}, + + + mailbox = #{mailbox,jdbcType=VARCHAR}, + + + phone = #{phone,jdbcType=VARCHAR}, + + + address = #{address,jdbcType=VARCHAR}, + + + qr_code = #{qrCode,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + diff --git a/src/main/resources/mapper/UmsStudentManageService.xml b/src/main/resources/mapper/UmsStudentManageMapper.xml similarity index 100% rename from src/main/resources/mapper/UmsStudentManageService.xml rename to src/main/resources/mapper/UmsStudentManageMapper.xml