feign 改为 dubbo
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
package com.czg.service.system.dto;
|
||||
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author GYJoker
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SysParamsDTO {
|
||||
|
||||
@NotBlank(message = "参数编码不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String paramCode;
|
||||
|
||||
@NotBlank(message = "参数值不能为空", groups = DefaultGroup.class)
|
||||
private String paramValue;
|
||||
|
||||
@NotNull(message = "参数类型不能为空", groups = {UpdateGroup.class, UpdateGroup.class})
|
||||
private Integer paramType;
|
||||
private String remark;
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.czg.service.system.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 实体类。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-02-07
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("sys_params")
|
||||
public class SysParams implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 参数编码
|
||||
*/
|
||||
@Id
|
||||
private String paramCode;
|
||||
|
||||
/**
|
||||
* 参数值
|
||||
*/
|
||||
private String paramValue;
|
||||
|
||||
/**
|
||||
* 类型 0:系统参数 1:非系统参数
|
||||
*/
|
||||
private Integer paramType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建者id
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新者id
|
||||
*/
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.czg.service.system.mapper;
|
||||
|
||||
import com.czg.system.entity.SysParams;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.service.system.entity.SysParams;
|
||||
|
||||
/**
|
||||
* 映射层。
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.czg.service.system.service;
|
||||
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.system.dto.SysParamsDTO;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.service.system.entity.SysParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-02-07
|
||||
*/
|
||||
public interface SysParamsService extends IService<SysParams> {
|
||||
|
||||
/**
|
||||
* 新增参数
|
||||
* @param paramsDTO 参数
|
||||
* @return 新增结果
|
||||
*/
|
||||
CzgResult<String> insertParams(SysParamsDTO paramsDTO);
|
||||
|
||||
/**
|
||||
* 修改参数
|
||||
* @param paramsDTO 参数
|
||||
* @return 修改结果
|
||||
*/
|
||||
CzgResult<String> updateParams(SysParamsDTO paramsDTO);
|
||||
|
||||
/**
|
||||
* 删除参数
|
||||
* @param code 参数code
|
||||
* @return 删除结果
|
||||
*/
|
||||
CzgResult<Boolean> deleteParams(String code);
|
||||
|
||||
/**
|
||||
* 根据参数编码获取参数
|
||||
* @param code 参数编码
|
||||
* @return 参数
|
||||
*/
|
||||
CzgResult<SysParamsDTO> getParamsByCode(String code);
|
||||
|
||||
/**
|
||||
* 根据参数类型获取参数
|
||||
* @param type 参数类型
|
||||
* @return 参数列表
|
||||
*/
|
||||
CzgResult<List<SysParamsDTO>> getParamsByType(Integer type);
|
||||
|
||||
}
|
||||
@@ -3,16 +3,16 @@ package com.czg.service.system.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.system.dto.SysParamsDTO;
|
||||
import com.czg.service.system.entity.SysParams;
|
||||
import com.czg.service.system.mapper.SysParamsMapper;
|
||||
import com.czg.service.system.service.SysParamsService;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.entity.SysParams;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -23,9 +23,9 @@ import java.util.List;
|
||||
* @author mac
|
||||
* @since 2025-02-07
|
||||
*/
|
||||
@Service
|
||||
@DubboService(interfaceClass = SysParamsService.class)
|
||||
@CacheConfig(cacheNames = "params")
|
||||
public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams> implements SysParamsService{
|
||||
public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams> implements SysParamsService {
|
||||
|
||||
@Override
|
||||
public CzgResult<String> insertParams(SysParamsDTO paramsDTO) {
|
||||
@@ -103,6 +103,17 @@ public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams
|
||||
return CzgResult.success(sysParamsDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysParamsDTO getParamsByCode2(String code) {
|
||||
SysParams sysParams = getOne(new QueryWrapper().eq(SysParams::getParamCode, code));
|
||||
|
||||
if (sysParams == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return BeanUtil.toBean(sysParams, SysParamsDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<List<SysParamsDTO>> getParamsByType(Integer type) {
|
||||
List<SysParams> sysParamsList = list(new QueryWrapper().eq(SysParams::getParamType, type));
|
||||
|
||||
Reference in New Issue
Block a user