7 changed files with 253 additions and 0 deletions
@ -0,0 +1,15 @@ |
|||||
|
package com.qs.serve.common.model.consts; |
||||
|
|
||||
|
/** |
||||
|
* 系统配置 |
||||
|
* @author YenHex |
||||
|
* @since 2022/11/12 |
||||
|
*/ |
||||
|
public interface SysConfigKey { |
||||
|
|
||||
|
/** |
||||
|
* 费用超支 |
||||
|
*/ |
||||
|
String TbsBudgetOverspend = "budget-overspend"; |
||||
|
|
||||
|
} |
@ -0,0 +1,70 @@ |
|||||
|
package com.qs.serve.modules.sys.controller; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.common.util.CopierUtil; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import com.qs.serve.modules.sys.entity.bo.SysConfigBo; |
||||
|
import com.qs.serve.modules.sys.entity.SysConfig; |
||||
|
import com.qs.serve.modules.sys.service.SysConfigService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 系统 系统配置 |
||||
|
* @author YenHex |
||||
|
* @since 2022-11-12 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("sys/config") |
||||
|
public class SysConfigController { |
||||
|
|
||||
|
private SysConfigService sysConfigService; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* ID查询 |
||||
|
* @param key |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getByKey/{key}") |
||||
|
@SysLog(module = SystemModule.SYSTEM, title = "系统配置", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('sys:config:query')") |
||||
|
public R<SysConfig> getById(@PathVariable("key") String key){ |
||||
|
LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<>(); |
||||
|
lqw.eq(SysConfig::getConfigKey,key); |
||||
|
SysConfig sysConfig = sysConfigService.getOne(lqw); |
||||
|
return R.ok(sysConfig); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
@SysLog(module = SystemModule.SYSTEM, title = "系统配置", biz = BizType.UPDATE) |
||||
|
@PreAuthorize("hasRole('sys:config:update')") |
||||
|
public R<?> updateById(@RequestBody @Valid SysConfigBo param){ |
||||
|
LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<>(); |
||||
|
lqw.eq(SysConfig::getConfigKey,param.getConfigKey()); |
||||
|
SysConfig sysConfig = sysConfigService.getOne(lqw); |
||||
|
sysConfig.setConfigValue(param.getConfigValue()); |
||||
|
sysConfigService.updateById(sysConfig); |
||||
|
return R.ok(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,81 @@ |
|||||
|
package com.qs.serve.modules.sys.entity; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* 实体类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-11-12 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("sys_config") |
||||
|
public class SysConfig implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 参数名称 */ |
||||
|
@Length(max = 100,message = "参数名称长度不能超过100字") |
||||
|
private String configName; |
||||
|
|
||||
|
/** 参数键名 */ |
||||
|
@Length(max = 100,message = "参数键名长度不能超过100字") |
||||
|
private String configKey; |
||||
|
|
||||
|
/** 参数键值 */ |
||||
|
@Length(max = 500,message = "参数键值长度不能超过500字") |
||||
|
private String configValue; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
@Length(max = 255,message = "备注长度不能超过255字") |
||||
|
private String remark; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
/** 创建人 */ |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private String createBy; |
||||
|
|
||||
|
/** 更新时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private LocalDateTime updateTime; |
||||
|
|
||||
|
/** 更新人 */ |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private String updateBy; |
||||
|
|
||||
|
/** 租户id */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String tenantId; |
||||
|
|
||||
|
/** 删除标识 */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private Boolean delFlag; |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,37 @@ |
|||||
|
package com.qs.serve.modules.sys.entity.bo; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* Bo |
||||
|
* @author YenHex |
||||
|
* @since 2022-11-12 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysConfigBo implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 参数键名 */ |
||||
|
@Length(max = 100,message = "参数键名长度不能超过100字") |
||||
|
private String configKey; |
||||
|
|
||||
|
/** 参数键值 */ |
||||
|
@Length(max = 500,message = "参数键值长度不能超过500字") |
||||
|
private String configValue; |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.sys.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.qs.serve.modules.sys.entity.SysConfig; |
||||
|
|
||||
|
/** |
||||
|
* Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2022-11-12 |
||||
|
*/ |
||||
|
public interface SysConfigMapper extends BaseMapper<SysConfig> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.sys.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.qs.serve.modules.sys.entity.SysConfig; |
||||
|
|
||||
|
/** |
||||
|
* 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2022-11-12 |
||||
|
*/ |
||||
|
public interface SysConfigService extends IService<SysConfig> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
package com.qs.serve.modules.sys.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.qs.serve.modules.sys.entity.SysConfig; |
||||
|
import com.qs.serve.modules.sys.service.SysConfigService; |
||||
|
import com.qs.serve.modules.sys.mapper.SysConfigMapper; |
||||
|
|
||||
|
/** |
||||
|
* 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-11-12 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper,SysConfig> implements SysConfigService { |
||||
|
|
||||
|
} |
||||
|
|
Loading…
Reference in new issue