package {{packageName}}.core.{{clientEntity.entity.module}}.client;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.Map;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection;
import java.util.Objects;
import java.util.Optional;
import java.math.BigInteger;
import lombok.extern.slf4j.Slf4j;

import cn.ibizlab.util.security.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.util.Assert;
import org.springframework.beans.factory.annotation.Value;
import cn.ibizlab.util.errors.BadRequestAlertException;
{{#system.enableGlobalTransaction}}
import io.seata.spring.annotation.GlobalTransactional;
{{/system.enableGlobalTransaction}}
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Lazy;
import {{packageName}}.core.{{clientEntity.entity.module}}.domain.{{clientEntity.entity.codeName}};
import {{packageName}}.core.{{clientEntity.entity.module}}.filter.{{clientEntity.entity.codeName}}SearchContext;
import {{packageName}}.core.{{clientEntity.entity.module}}.service.{{clientEntity.entity.codeName}}Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "${ibiz.ref.service.{{lowerCase clientEntity.client.codeName}}:{{lowerCase clientEntity.client.service}}{{raw "}" }}", contextId = "{{lowerCase clientEntity.codeName}}")
public interface {{clientEntity.codeName}}FeignClient  {
{{#each clientEntity.methods}}
    {{#neq name "Select"}}
    @RequestMapping(method = RequestMethod.{{requestMethod}}, value = "{{requestPath2}}")
    {{#neq codeName "CheckKey"}}{{outParam}}{{/neq}}{{#eq codeName "CheckKey"}}Integer{{/eq}} {{camelCase codeName}}{{#each pathVariables}}{{#if @first}}By{{else}}And{{/if}}{{pascalCase name}}{{/each}}({{#each pathVariables}}{{#unless @first}}, {{/unless}}@PathVariable("{{camelCase name}}") {{type.java}} {{camelCase name}}{{/each}}{{#if body}}{{#if pathVariables}}, {{/if}}{{#neq requestMethod 'GET'}}@Validated @RequestBody {{/neq}}{{body}}{{/if}}) ;

    {{/neq}}
{{/each}}
    @RequestMapping(method = RequestMethod.POST, value = "{{pluralize clientEntity.codeName}}/batch")
    Boolean createBatch(@RequestBody List<{{clientEntity.entity.codeName}}> domains);

    @RequestMapping(method = RequestMethod.PUT, value = "{{pluralize clientEntity.codeName}}/batch")
    boolean updateBatch(@RequestBody List<{{clientEntity.entity.codeName}}> domains);

    @RequestMapping(method = RequestMethod.POST, value = "{{pluralize clientEntity.codeName}}/savebatch")
    boolean saveBatch(@RequestBody List<{{clientEntity.entity.codeName}}> domains);

    @RequestMapping(method = RequestMethod.POST, value = "{{pluralize clientEntity.codeName}}/import")
    Map importData(@RequestParam(value = "config") String config ,@RequestBody List<{{clientEntity.entity.codeName}}> domains);

    @RequestMapping(method = RequestMethod.DELETE, value = "{{pluralize clientEntity.codeName}}")
    boolean removeBatch(@RequestBody List<{{clientEntity.entity.keyField.type.java}}> ids);

}