package ${packageName}.controller;

import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service;
import com.hxhq.common.core.web.controller.BaseController;
import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.core.web.page.TableDataInfo;


/**
 * ${functionName}Controller
 *
 * @author ${author}
 * @date ${datetime}
 */
@RestController
@RequestMapping("/${moduleName}/${businessName}")
public class ${ClassName}Controller extends BaseController
{
    @Autowired
    private I${ClassName}Service ${className}Service;

    /**
     * 查询${functionName}列表
     */
    @GetMapping("/list")
    public TableDataInfo list(${ClassName} ${className})
    {
        startPage();
        List<${ClassName}> list = ${className}Service.queryList(${className});
        return getDataTable(list);
    }

    /**
     * 获取${functionName}详细信息
     */
    @GetMapping(value = "/info")
    public AjaxResult getInfo(Long id)
    {
        return AjaxResult.success(${className}Service.getById(id));
    }

    /**
     * 新增${functionName}信息
     */
    @PostMapping("/save")
    public AjaxResult save(@RequestBody ${ClassName} ${className})
    {
        return toAjax(${className}Service.saveOrUpdate(${className}));
    }

    /**
     * 删除${functionName}信息
     */
    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody Long[] ids)
    {
        return toAjax(${className}Service.removeByIds(Arrays.asList(ids)));
    }
}
