<%
    var serviceInstanceName = util.lowerFirst(table.serviceName);
%>
package ${package.Controller};

<% if(isNotEmpty(controllerMethods.page)){  %>
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
<% } %>
<% if(isNotEmpty(superControllerClassPackage)){ %>
import ${superControllerClassPackage};
<% } %>
<% if(isNotEmpty(controllerMethods.create) || isNotEmpty(controllerMethods.update)){ %>
import ${entityPath}.dto.${table.entityName}Dto;
<% } %>
<% if(isNotEmpty(controllerMethods.page) || isNotEmpty(controllerMethods.list)){  %>
import ${entityPath}.dto.${table.entityName}SelectDto;
import ${entityPath}.vo.${table.entityName}Vo;
<% } %>
import ${package.Service}.${table.serviceName};
<% if(isNotEmpty(controllerMethods.detail) || isNotEmpty(controllerMethods.delete)){ %>
import com.jy.framework.model.base.BaseSelectDto;
<% } %>
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
<% if(isNotEmpty(controllerMethods.list)){  %>

import java.util.List;
<% } %>

/**
 * <p>
 * ${table.comment!} 前端控制器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@RestController
@RequestMapping("/${table.entityPath}")
public class ${table.controllerName} {

    @Resource
    private ${table.serviceName} ${serviceInstanceName};

<% if(isNotEmpty(controllerMethods.list)){  %>
    /**
     * ${table.comment!}列表
     */
    @GetMapping("/getList")
    public List<${table.entityName}Vo> getList(${table.entityName}SelectDto dto) {
        return ${serviceInstanceName}.getList(dto);
    }

<% } %>
<% if(isNotEmpty(controllerMethods.page)){  %>
    /**
     * ${table.comment!}分页
     */
    @GetMapping("/getPage")
    public Page<${table.entityName}Vo> getPage(${table.entityName}SelectDto dto) {
        return ${serviceInstanceName}.getPage(dto);
    }

<% } %>
<% if(isNotEmpty(controllerMethods.detail)){ %>
    /**
     * ${table.comment!}明细
     */
    @GetMapping("/getDetail")
    public ${table.entityName}Vo getDetail(BaseSelectDto dto) {
        return ${serviceInstanceName}.getDetail(dto.getId());
    }

<% } %>
<% if(isNotEmpty(controllerMethods.create)){ %>
    /**
     * ${table.comment!}新增
     */
    @PostMapping("/add")
    public void add(@RequestBody ${table.entityName}Dto dto) {
        ${table.entityPath}Service.add(dto);
    }

<% } %>
<% if(isNotEmpty(controllerMethods.update)){ %>
    /**
     * ${table.comment!}编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ${table.entityName}Dto dto) {
        ${table.entityPath}Service.edit(dto);
    }

<% } %>
<% if(isNotEmpty(controllerMethods.delete)){ %>
    /**
     * ${table.comment!}删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        ${table.entityPath}Service.delete(dto.getIdList());
    }

<% } %>
}
