From 325c7698c245530e3a666a0568ec053afb639184 Mon Sep 17 00:00:00 2001
From: ibiz4j <ibiz4j@ibizlab.cn>
Date: Sun, 28 Aug 2022 22:28:11 +0800
Subject: [PATCH] tj

---
 .../api/{{apps}}/dict/DictHtmlResource.java.hbs       |  2 +-
 .../api/{{apps}}/dict/DictResource.java.hbs           |  5 +++++
 .../api/{{apps}}/rest/G1ResResource.java.hbs          | 11 +++++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/dict/DictHtmlResource.java.hbs b/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/dict/DictHtmlResource.java.hbs
index f2130c04..8c475407 100644
--- a/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/dict/DictHtmlResource.java.hbs
+++ b/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/dict/DictHtmlResource.java.hbs
@@ -31,7 +31,7 @@ public class DictHtmlResource {
     {{#each app.dicts}}
     @ApiOperation(value = "瀛楀吀锛歿{name}}[{{pascalCase codeName}}Dict]", tags = {"鏁版嵁瀛楀吀" },  notes = "瀛楀吀锛歿{name}}[{{pascalCase codeName}}Dict]")
     @RequestMapping(method = RequestMethod.GET, value = "/{{pascalCase codeName}}Dict.html")
-    public ResponseEntity<String> get{{pascalCase codeName}}Dict() {
+    public ResponseEntity<String> show{{pascalCase codeName}}Dict() {
         List<String> tr=new ArrayList<>();
         new {{pascalCase codeName}}Dict().getAllItems().forEach(item->tr.add(String.format(templateItem,item.getValue(),item.getLabel(),item.getParent()==null?"":item.getParent())));
         return ResponseEntity.ok(String.format(html,String.format(template,"{{pascalCase codeName}}Dict","瀛楀吀锛歿{name}}[{{pascalCase codeName}}Dict]",String.join("",tr))));
diff --git a/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/dict/DictResource.java.hbs b/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/dict/DictResource.java.hbs
index 75b9e9fa..b87ee7b4 100644
--- a/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/dict/DictResource.java.hbs
+++ b/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/dict/DictResource.java.hbs
@@ -42,6 +42,11 @@ import {{packageName}}.api.{{apps}}.dict.*;
 @ApiSupport(order = 99)
 public class DictResource {
 
+    /**
+    {{#each app.dicts}}
+     INSERT INTO ibzdictcatalog (CID, CCODE, CNAME, CGROUP, ENABLE) VALUES ('{{pascalCase codeName}}Dict', '{{pascalCase codeName}}Dict', '{{name}}', 'link', 1);
+    {{/each}}
+     */
 
     {{#each app.dicts}}
     @ApiOperation(value = "瀛楀吀锛歿{name}}[{{pascalCase codeName}}Dict]", tags = {"鏁版嵁瀛楀吀" },  notes = "瀛楀吀锛歿{name}}[{{pascalCase codeName}}Dict]&nbsp;&nbsp;<a href=\"/xftong/link/dict/{{pascalCase codeName}}Dict.html\" target=\"_blank\">鏌ョ湅灞曠ず娓呭崟</a>&nbsp;&nbsp;<a href=\"/xftong/link/dict/{{pascalCase codeName}}Dict\" target=\"_blank\">鏌ョ湅json</a>")
diff --git a/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/rest/G1ResResource.java.hbs b/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/rest/G1ResResource.java.hbs
index db6aa47f..4ac14942 100644
--- a/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/rest/G1ResResource.java.hbs
+++ b/modules/ibizlab-template/ibizlab-template-apivo/src/main/resources/templ/{{projectName}}-rest/src/main/java/{{packageName}}/api/{{apps}}/rest/G1ResResource.java.hbs
@@ -7,6 +7,7 @@ import cn.ibizlab.edge.api.link.dto.ex.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.github.xiaoymin.knife4j.annotations.ApiSort;
 import com.github.xiaoymin.knife4j.annotations.ApiSupport;
+import org.springframework.security.access.prepost.PreAuthorize;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -28,9 +29,19 @@ import java.util.List;
 @ApiSupport(order = 1)
 public class G1ResResource {
 
+    /**
+    {{#each app.exModel as |item|}}
+     INSERT INTO dataresource (C_ID, C_VALUE, C_TOPIC, C_DOC_PATH, C_CATALOG_ID, C_POSITION) VALUES ('TOPIC_WSXF_RESOURCE_{{upperCase @key}}', '{{item}}', 'TOPIC_WSXF_RESOURCE_{{upperCase @key}}', 'pull{{@key}}UsingGET', 'xfyw', 1{{@index}});
+    {{/each}}
+    {{#each app.exModel as |item|}}
+    INSERT INTO datasubscription (C_ID, C_ACCESS_ID, C_RESOURCE_ID, C_CRON, C_TARGET) VALUES ('hbxfdpt0068-{{upperCase @key}}', 'hbxfdpt0068', 'TOPIC_WSXF_RESOURCE_{{upperCase @key}}', '20 3 * * *', null);
+    {{/each}}
+     */
+
 {{#each app.exModel as |item|}}
     @ApiOperationSupport(order = 1{{@index}})
     @ApiOperation(value = "{{item}}", tags = {"璧勬簮鐩綍" },  notes = "topic涓婚锛歍OPIC_WSXF_RESOURCE_{{upperCase @key}}")
+    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','TOPIC_WSXF_RESOURCE_{{upperCase @key}}')")
     @RequestMapping(method = RequestMethod.GET, value = "/mq/topic/TOPIC_WSXF_RESOURCE_{{upperCase @key}}/pullconsumer")
     public ResponseEntity<List<{{@key}}Dto>> pull{{@key}}(@ApiParam("oauth2绗笁鏂规帴鍏oken") @RequestHeader("Access-Token") String accessToken,
             @ApiParam(value = "鍋忕Щ閲忥紝涓嶆彁渚涙垨0鏃堕粯璁よ绠�",example = "0") @RequestParam(value = "offset",required = false,defaultValue = "0") Long offset,
-- 
2.21.0