肖海南系统设置接口编写

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

@ -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;
}

@ -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