平台参数设置
parent
eed0982e7e
commit
8adf4c0582
@ -0,0 +1,27 @@
|
||||
package com.flossom.miniProgram.Enums;
|
||||
|
||||
/**
|
||||
* 系统设置-key 枚举
|
||||
*/
|
||||
public enum SystemSettingKeyEnum {
|
||||
USER_AGREEMENT("USER_AGREEMENT", "用户协议"),
|
||||
PRIVACY_AGREEMENT("PRIVACY_AGREEMENT", "隐私协议"),
|
||||
INTEGRAL_RULE("INTEGRAL_RULE", "积分规则"),
|
||||
ABOUT_US("ABOUT_US", "关于我们");
|
||||
|
||||
private final String key;
|
||||
private final String remark;
|
||||
|
||||
SystemSettingKeyEnum(String key, String remark) {
|
||||
this.key = key;
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.flossom.miniProgram.controller;
|
||||
|
||||
import com.flossom.common.core.web.controller.BaseController;
|
||||
import com.flossom.common.core.web.domain.AjaxResult;
|
||||
import com.flossom.miniProgram.service.ISystemSettingService;
|
||||
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
|
||||
@RequestMapping("/system/setting")
|
||||
public class SystemSettingController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISystemSettingService systemSettingService;
|
||||
|
||||
/**
|
||||
* 获取 用户协议
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getUserAgreement")
|
||||
public AjaxResult getUserAgreement() {
|
||||
return AjaxResult.success(systemSettingService.getUserAgreement());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 隐私协议
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getPrivacyAgreement")
|
||||
public AjaxResult getPrivacyAgreement() {
|
||||
return AjaxResult.success(systemSettingService.getPrivacyAgreement());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 积分规则
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getIntegralRule")
|
||||
public AjaxResult getIntegralRule() {
|
||||
return AjaxResult.success(systemSettingService.getIntegralRule());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 关于我们
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getAboutUs")
|
||||
public AjaxResult getAboutUs() {
|
||||
return AjaxResult.success(systemSettingService.getAboutUs());
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.flossom.miniProgram.domain;
|
||||
package com.flossom.miniProgram.domain.vo;
|
||||
|
||||
/**
|
||||
* 登录响应结果
|
||||
@ -0,0 +1,10 @@
|
||||
package com.flossom.miniProgram.mapper;
|
||||
|
||||
import com.flossom.miniProgram.Enums.SystemSettingKeyEnum;
|
||||
import com.flossom.miniProgram.domain.WxSystemSetting;
|
||||
|
||||
public interface SystemSettingMapper {
|
||||
|
||||
WxSystemSetting getSystemSettingByKey(String systemSetKey);
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.flossom.miniProgram.service;
|
||||
|
||||
import com.flossom.miniProgram.domain.WxSystemSetting;
|
||||
|
||||
public interface ISystemSettingService {
|
||||
|
||||
WxSystemSetting getUserAgreement();
|
||||
|
||||
WxSystemSetting getPrivacyAgreement();
|
||||
|
||||
WxSystemSetting getIntegralRule();
|
||||
|
||||
WxSystemSetting getAboutUs();
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.flossom.miniProgram.service.impl;
|
||||
|
||||
import com.flossom.miniProgram.Enums.SystemSettingKeyEnum;
|
||||
import com.flossom.miniProgram.domain.WxSystemSetting;
|
||||
import com.flossom.miniProgram.mapper.SystemSettingMapper;
|
||||
import com.flossom.miniProgram.service.ISystemSettingService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class SystemSettingServiceImpl implements ISystemSettingService {
|
||||
|
||||
@Autowired
|
||||
private SystemSettingMapper systemSettingMapper;
|
||||
|
||||
/**
|
||||
* 获取 用户协议
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public WxSystemSetting getUserAgreement() {
|
||||
return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.USER_AGREEMENT.getKey());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取 隐私协议
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public WxSystemSetting getPrivacyAgreement() {
|
||||
return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.PRIVACY_AGREEMENT.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 积分规则
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public WxSystemSetting getIntegralRule() {
|
||||
return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.INTEGRAL_RULE.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 关于我们
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public WxSystemSetting getAboutUs() {
|
||||
return systemSettingMapper.getSystemSettingByKey(SystemSettingKeyEnum.ABOUT_US.getKey());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
<?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.flossom.miniProgram.mapper.SystemSettingMapper">
|
||||
|
||||
<resultMap type="WxSystemSetting" id="wxSystemSetting">
|
||||
<id property="id" column="id"/>
|
||||
<result property="key" column="key"/>
|
||||
<result property="value" column="value"/>
|
||||
<result property="instructions" column="instructions"/>
|
||||
<result property="status" column="status"/>
|
||||
<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="selectWxSystemSettingVo">
|
||||
select id,
|
||||
`key`,
|
||||
`value`,
|
||||
instructions,
|
||||
status,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark
|
||||
from wx_system_setting
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="sqlwhereSearch">
|
||||
<where>
|
||||
<if test="key !=null">
|
||||
and `key` = #{key}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="getSystemSettingByKey" parameterType="String" resultMap="wxSystemSetting">
|
||||
<include refid="selectWxSystemSettingVo"/>
|
||||
<include refid="sqlwhereSearch"/>
|
||||
order by update_time desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue