{{#eq apps "link1"}}
package {{packageName}}.api.{{apps}}.rest;

import cn.ibizlab.edge.api.link.annotation.G1;
import cn.ibizlab.edge.core.extensions.annotation.LsbData;
import cn.ibizlab.edge.api.link.dto.TyywKgXfjsdj.SubDfUpdateDto;
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;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Api( tags = "资源目录")
@RestController("link-g1res")
@RequestMapping("/link/g1")
@G1
@ApiSort(1)
@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.appEntities as |appEntity|}}
          {{#each appEntity.forms as |form|}}
          INSERT INTO apioperation (C_ID, C_RESOURCE_ID, C_VALUE, C_TAGS, C_HTTP_METHOD, C_PATH, C_DOC_PATH) VALUES ('add{{pascalCase appEntity.codeName}}{{pascalCase form.codeName}}UsingPOST', 'push', '新建{{appEntity.entity.logicName}}[{{form.codeName}}]{{replace form.logicName "表单" ""}}', '{{appEntity.entity.logicName}}', 'POST', '/xftong/link/{{pluralize appEntity.entity.codeName}}/{{lowerCase form.codeName}}', '/xftong/doc2.html#/服务接口/{{appEntity.entity.logicName}}/add{{pascalCase appEntity.codeName}}{{pascalCase form.codeName}}UsingPOST');
          {{/each}}
         {{/each}}
     */


{{#each app.exModel as |item|}}
    @ApiOperationSupport(order = 1{{@index}})
    @ApiOperation(value = "{{item}}", tags = {"资源目录" },  notes = "topic主题：TOPIC_WSXF_RESOURCE_{{upperCase @key}}")
    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','TOPIC_WSXF_RESOURCE_{{upperCase @key}}')")
    @LsbData("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第三方接入token") @RequestHeader("Access-Token") String accessToken,
            @ApiParam(value = "偏移量，不提供或0时默认计算",example = "0") @RequestParam(value = "offset",required = false,defaultValue = "0") Long offset,
            @ApiParam(value = "拉取多少条，默认32",example = "32") @RequestParam(value = "maxnums",required = false,defaultValue = "32") Integer maxNums) {

        List<{{@key}}Dto> list=new ArrayList<>();
        list.add(new {{@key}}Dto());
        return ResponseEntity.ok(list);
    }
{{/each}}

}
{{/eq}}