update to v1.4.0
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
package org.txlcn.demo.common.db.domain;
|
||||
|
||||
import com.codingapi.txlcn.common.util.id.RandomUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2018/12/25
|
||||
*
|
||||
* @author ujued
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class Demo {
|
||||
private Long id;
|
||||
private String kid = RandomUtils.randomKey();
|
||||
private String demoField;
|
||||
private String groupId;
|
||||
private Date createTime;
|
||||
private String appName;
|
||||
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package org.txlcn.demo.common.db.mapper;
|
||||
|
||||
import org.txlcn.demo.common.db.domain.Demo;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2018/12/25
|
||||
*
|
||||
* @author ujued
|
||||
*/
|
||||
@Mapper
|
||||
public interface BaseDemoMapper {
|
||||
|
||||
@Insert("insert into t_demo(kid, demo_field, group_id, create_time,app_name) values(#{kid}, #{demoField}, #{groupId}, #{createTime},#{appName})")
|
||||
void save(Demo demo);
|
||||
|
||||
@Delete("delete from t_demo where id=#{id}")
|
||||
void deleteByKId(Long id);
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package org.txlcn.demo.common.spring;
|
||||
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2018/12/25
|
||||
*
|
||||
* @author ujued
|
||||
*/
|
||||
@ComponentScan
|
||||
@Configuration
|
||||
@EnableFeignClients
|
||||
public class FeignConfiguration {
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package org.txlcn.demo.common.spring;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2018/12/25
|
||||
*
|
||||
* @author ujued
|
||||
*/
|
||||
@FeignClient(value = "txlcn-demo-spring-service-b", fallback = ServiceBFallback.class)
|
||||
public interface ServiceBClient {
|
||||
|
||||
@GetMapping("/rpc")
|
||||
String rpc(@RequestParam("value") String name);
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package org.txlcn.demo.common.spring;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 19-2-19 下午1:53
|
||||
*
|
||||
* @author ujued
|
||||
*/
|
||||
@Component
|
||||
public class ServiceBFallback implements ServiceBClient {
|
||||
@Override
|
||||
public String rpc(String name) {
|
||||
return "fallback";
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package org.txlcn.demo.common.spring;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2018/12/25
|
||||
*
|
||||
* @author ujued
|
||||
*/
|
||||
@FeignClient(value = "txlcn-demo-spring-service-c", fallback = ServiceCFallback.class)
|
||||
public interface ServiceCClient {
|
||||
|
||||
@GetMapping("/rpc")
|
||||
String rpc(@RequestParam("value") String name);
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.txlcn.demo.common.spring;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 19-2-19 下午1:53
|
||||
*
|
||||
* @author ujued
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ServiceCFallback implements ServiceCClient {
|
||||
@Override
|
||||
public String rpc(String name) {
|
||||
return "fallback";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=org.txlcn.demo.common.spring.FeignConfiguration
|
||||
Reference in New Issue
Block a user