feign 改为 dubbo
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
package com.czg.service.account.feign;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
/**
|
||||
* @author GYJoker
|
||||
*/
|
||||
@FeignClient("system-server")
|
||||
public interface FeignSystemService {
|
||||
@GetMapping("/admin/feign/testCall/{name}") // 使用 get 方式,调用服务提供者的 /call/{name} 接口
|
||||
String testCall(@PathVariable(value = "name") String name);
|
||||
}
|
||||
@@ -41,6 +41,12 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>cash-common-service</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>cash-common-sa-token</artifactId>
|
||||
@@ -51,18 +57,6 @@
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
|
||||
<version>1.10.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-processor</artifactId>
|
||||
<version>1.10.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
@@ -90,28 +84,25 @@
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--openfeign依赖-->
|
||||
<!--start-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<!--end-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-nacos</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -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