Commit 8dd6121e authored by 赵啸非's avatar 赵啸非

添加feign接口自动生成

parent aa098ae5
......@@ -162,43 +162,56 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
continue;
}
//如果开启feign生成模式,加载feign生成模板
if (gentableEntity.getGenFeign()!=null&&gentableEntity.getGenFeign() == 0) {
if (gentableEntity.getGenFeign() != null && gentableEntity.getGenFeign() == 0) {
if (temp.contains("feign.java.ftl") || temp.contains("pdu.java.ftl")) {
continue;
}
}
if (gentableEntity.getIsShowControl()!=null&&gentableEntity.getIsShowControl() == 2) {
if (temp.contains("webForm.java.ftl")) {
continue;
}
if (gentableEntity.getIsShowControl() != null) {
if (gentableEntity.getIsShowControl() == 2) {
if (temp.contains("webForm.java.ftl")) {
continue;
}
// if (temp.contains("entity.java.ftl")||temp.contains("entityQuery.java.ftl")) {
// continue;
// }
}
if (gentableEntity.getIsShowControl() == 0) {
if (temp.contains("webBody.java.ftl")) {
} else if (gentableEntity.getIsShowControl() == 0) {
if (temp.contains("webBody.java.ftl")) {
continue;
}
}
} else {
if (temp.contains("webForm.java.ftl")) {
continue;
}
}
if (gentableEntity.getDetailShow()!=null&&gentableEntity.getDetailShow() == 0) {
if (temp.contains("VueDialogShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
} else if (gentableEntity.getDetailShow() == 1) {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
} else if (gentableEntity.getDetailShow() == 2) {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDialogShow.vue.ftl")) {
continue;
if (gentableEntity.getDetailShow() != null) {
if (gentableEntity.getDetailShow() == 0) {
if (temp.contains("VueDialogShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
} else if (gentableEntity.getDetailShow() == 1) {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
} else if (gentableEntity.getDetailShow() == 2) {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDialogShow.vue.ftl")) {
continue;
}
} else {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
}
}else{
} else {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
}
if (temp.equals("menu.sql.ftl") || temp.equals("db.sql.ftl") || temp.equals("api.md.ftl")) {
try {
List<GentableEntity> tableList = new ArrayList<>();
......@@ -502,41 +515,45 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
continue;
}
//restBody模式 不加载web,webForm模式
if (gentableEntity.getIsShowControl() == 2) {
if (temp.contains("web.java.ftl") || temp.contains("webForm.java.ftl")) {
continue;
if (gentableEntity.getIsShowControl() != null) {
if (gentableEntity.getIsShowControl() == 2) {
if (temp.contains("webForm.java.ftl")) {
continue;
}
// if (temp.contains("entity.java.ftl")||temp.contains("entityQuery.java.ftl")) {
// continue;
// }
} else if (gentableEntity.getIsShowControl() == 0) {
if (temp.contains("webBody.java.ftl")) {
continue;
}
}
// if (temp.contains("entity.java.ftl")||temp.contains("entityQuery.java.ftl")) {
// continue;
// }
} else {
if (temp.contains("webBody.java.ftl")) {
continue;
}
}
//如果开启feign生成模式,加载feign生成模板
if (gentableEntity.getGenFeign() == 0) {
if (temp.contains("feign.java.ftl") || temp.contains("pdu.java.ftl")) {
if (temp.contains("webForm.java.ftl")) {
continue;
}
}
if (gentableEntity.getDetailShow()!=null&&gentableEntity.getDetailShow() == 0) {
if (temp.contains("VueDialogShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
} else if (gentableEntity.getDetailShow() == 1) {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
} else if (gentableEntity.getDetailShow() == 2) {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDialogShow.vue.ftl")) {
continue;
if (gentableEntity.getDetailShow() != null) {
if (gentableEntity.getDetailShow() == 0) {
if (temp.contains("VueDialogShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
} else if (gentableEntity.getDetailShow() == 1) {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
} else if (gentableEntity.getDetailShow() == 2) {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDialogShow.vue.ftl")) {
continue;
}
} else {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
}
}else{
} else {
if (temp.contains("webVueShow.vue.ftl") || temp.contains("VueDrawerShow.vue.ftl")) {
continue;
}
......
package ${packageFeignName};
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.${businessName}.${ClassName}Pdu;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest;
......@@ -9,13 +9,13 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* ${functionName} Feign接口
* @author ${author}
* @date ${datetime}
*/
@FeignClient(name = "${code}", path = "${path}", fallback = ${ClassName}FeignFallbackFactory.class)
@FeignClient(name = "${code}", path = "${path}", fallbackFactory = ${ClassName}FeignFallbackFactory.class)
public interface I${ClassName}Feign extends IFeign {
......@@ -26,7 +26,7 @@ public interface I${ClassName}Feign extends IFeign {
* @return
*/
@PostMapping(value = "/${RequestMapping}/list")
String list(@RequestBody ${ClassName}Pdu ${className}Pdu);
Rest<RespData<List<${ClassName}Pdu>>> list(@RequestBody ${ClassName}Pdu ${className}Pdu);
/**
......@@ -36,7 +36,7 @@ public interface I${ClassName}Feign extends IFeign {
* @return
*/
@GetMapping(value = "/${RequestMapping}/info")
String info(@RequestParam(value = "id") Long id);
Rest<${ClassName}Pdu> info(@RequestParam(value = "id") Long id);
/**
* 删除${functionName}
......@@ -45,7 +45,7 @@ public interface I${ClassName}Feign extends IFeign {
* @return
*/
@GetMapping(value = "/${RequestMapping}/delete")
String delete(Long[] ids,@RequestHeader("Authorization") String authorization);
Rest<Void> delete(Long[] ids,@RequestHeader("Authorization") String authorization);
/**
......@@ -55,7 +55,7 @@ public interface I${ClassName}Feign extends IFeign {
* @return
*/
@PostMapping(value = "/${RequestMapping}/save")
String save(@RequestBody ${ClassName}Pdu ${className}Pdu,@RequestHeader("Authorization") String authorization);
Rest<RespData<${ClassName}Pdu>> save(@RequestBody ${ClassName}Pdu ${className}Pdu,@RequestHeader("Authorization") String authorization);
}
......@@ -68,23 +68,23 @@ class ${ClassName}FeignFallbackFactory implements FallbackFactory<I${ClassName}F
public I${ClassName}Feign create(Throwable t) {
return new I${ClassName}Feign() {
@Override
public String list(${ClassName}Pdu ${className}Pdu) {
return JSON.toJSONString(Rest.fail("暂时无法获取${functionName}列表,请稍后再试!"));
public Rest<RespData<List<${ClassName}Pdu>>> list(${ClassName}Pdu ${className}Pdu) {
return Rest.fail("暂时无法获取${functionName}列表,请稍后再试!");
}
@Override
public String info(Long id) {
return JSON.toJSONString(Rest.fail("暂时无法获取${functionName}详细,请稍后再试!"));
public Rest<${ClassName}Pdu> info(Long id) {
return Rest.fail("暂时无法获取${functionName}详细,请稍后再试!");
}
@Override
public String delete(Long[] ids, String authorization) {
return JSON.toJSONString(Rest.fail("暂时无法删除${functionName},请稍后再试!"));
public Rest<Void> delete(Long[] ids, String authorization) {
return Rest.fail("暂时无法删除${functionName},请稍后再试!");
}
@Override
public String save(${ClassName}Pdu ${className}Pdu, String authorization) {
return JSON.toJSONString(Rest.fail("暂时无法保存${functionName},请稍后再试!"));
public Rest<RespData<${ClassName}Pdu>> save(${ClassName}Pdu ${className}Pdu, String authorization) {
return Rest.fail("暂时无法保存${functionName},请稍后再试!");
}
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment