All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template.hibernate.Controller.ftl Maven / Gradle / Ivy

There is a newer version: 1.1.10-2024
Show newest version
package ${controllerPackage};

import com.nbsaas.boot.rest.annotations.AddOperator;
import com.nbsaas.boot.rest.annotations.DeleteOperator;
import com.nbsaas.boot.rest.annotations.UpdateOperator;
import com.nbsaas.boot.rest.annotations.ViewOperator;
import com.nbsaas.boot.rest.response.ListResponse;
import com.nbsaas.boot.rest.response.PageResponse;
import com.nbsaas.boot.rest.response.ResponseObject;
import com.nbsaas.boot.rest.annotations.CreateData;
import com.nbsaas.boot.rest.annotations.UpdateData;
import ${requestPackage}.${formBean.className}DataRequest;
import ${requestPackage}.${formBean.className}SearchRequest;
import ${responsePackage}.${formBean.className}Response;
import ${simplePackage}.${formBean.className}Simple;
import ${apiPackage}.${formBean.className}Api;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
*  对外控制器
*/
@RequiresAuthentication
@RestController
@RequestMapping("/${formBean.className?uncap_first}")
public class ${formBean.className}Controller {


@Resource
private ${formBean.className}Api ${formBean.className?uncap_first}Api;


@RequestMapping("/search")
public PageResponse
<${formBean.className}Simple> search(${formBean.className}SearchRequest request) {
    return ${formBean.className?uncap_first}Api.search(request);
    }

    @RequestMapping("/list")
    public ListResponse
    <${formBean.className}Simple> list(${formBean.className}SearchRequest request) {
        return ${formBean.className?uncap_first}Api.list(request);
        }

        /**
        * 添加数据
        *
        * @param request
        * @return
        */
        @CreateData
        @RequestMapping("/create")
        public ResponseObject
        <${formBean.className}Response> create(@Validated(Add.class) ${formBean.className}DataRequest request) {
            return ${formBean.className?uncap_first}Api.create(request);
            }

            @UpdateData
            @RequestMapping("/update")
            public ResponseObject
            <${formBean.className}Response> update(@Validated(Update.class) ${formBean.className}DataRequest request) {
                return ${formBean.className?uncap_first}Api.update(request);
                }

                @RequestMapping("/delete")
                public ResponseObject delete(@Validated(Delete.class) ${formBean.className}DataRequest request) {
                return ${formBean.className?uncap_first}Api.delete(request);
                }

                @RequestMapping("/view")
                public ResponseObject
                <${formBean.className}Response> view(@Validated(View.class) ${formBean.className}DataRequest request) {
                    return ${formBean.className?uncap_first}Api.view(request);
                    }
                    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy