parent
2aae3d172a
commit
f81720916f
12 changed files with 222 additions and 22 deletions
@ -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); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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); |
||||||
|
} |
@ -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…
Reference in new issue