first commit
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
package ${packageName}.interfaces.${className}.facadeApi;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ${packageName}.interfaces.dto.${className}.${ClassName}DTO;
|
||||
import ${packageName}.domain.${className}.repository.todo.${ClassName}DO;
|
||||
import ${packageName}.domain.${className}.repository.po.${ClassName}PO;
|
||||
import ${packageName}.application.service.${className}.${ClassName}ApplicationService;
|
||||
import ${packageName}.interfaces.assembler.${className}.${ClassName}Assembler;
|
||||
import javax.annotation.Resource;
|
||||
import com.mhd.common.core.web.controller.BaseController;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
#elseif($table.tree)
|
||||
#end
|
||||
|
||||
/**
|
||||
* ${functionName}Api
|
||||
*
|
||||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${className}Api")
|
||||
public class ${ClassName}Api extends BaseController{
|
||||
@Autowired
|
||||
private ${ClassName}ApplicationService ${className}ApplicationService;
|
||||
|
||||
@Resource
|
||||
private ${ClassName}Assembler ${className}Assembler;
|
||||
|
||||
/**
|
||||
* 分页查询${functionName}列表
|
||||
*/
|
||||
## @RequiresPermissions("${permissionPrefix}:list")
|
||||
@ApiOperation("查询${functionName}列表")
|
||||
@GetMapping("/list")
|
||||
#if($table.crud || $table.sub)
|
||||
public TableDataInfo list(${ClassName}DTO ${className}DTO)
|
||||
{
|
||||
//转换实体
|
||||
${ClassName}DO ${className}DO = ${className}Assembler.toDO(${className}DTO);
|
||||
startPage();
|
||||
List<${ClassName}PO> list = ${className}ApplicationService.queryList(${className}DO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
#elseif($table.tree)
|
||||
public AjaxResult list(${ClassName} ${className})
|
||||
{
|
||||
List<${ClassName}> list = ${className}ApplicationService.queryList(${className});
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
#end
|
||||
|
||||
/**
|
||||
* 编辑${functionName}
|
||||
*/
|
||||
## @RequiresPermissions("${permissionPrefix}:edit")
|
||||
## @Log(title = "${functionName}", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("编辑${functionName}")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody ${ClassName}DTO ${className}DTO)
|
||||
{
|
||||
//转换实体
|
||||
${ClassName}DO ${className}DO = ${className}Assembler.toDO(${className}DTO);
|
||||
if(${className}DTO.get${pkColumn.capJavaField}() != null){
|
||||
return toAjax(${className}ApplicationService.update(${className}DO));
|
||||
}else {
|
||||
return toAjax(${className}ApplicationService.insert(${className}DO));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
*/
|
||||
## @RequiresPermissions("${permissionPrefix}:remove")
|
||||
## @Log(title = "${functionName}", businessType = BusinessType.DELETE)
|
||||
@ApiOperation("批量删除${functionName}")
|
||||
@DeleteMapping("/deleteByIds/{${pkColumn.javaField}s}")
|
||||
public AjaxResult delete(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||
{
|
||||
return toAjax(${className}ApplicationService.delete(${pkColumn.javaField}s));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取${functionName}详细信息
|
||||
*/
|
||||
@ApiOperation("获取${functionName}")
|
||||
## @RequiresPermissions("${permissionPrefix}:query")
|
||||
@GetMapping(value = "/getInfo/{${pkColumn.javaField}}")
|
||||
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
|
||||
{
|
||||
return AjaxResult.success(${className}ApplicationService.getInfo(${pkColumn.javaField}));
|
||||
}
|
||||
|
||||
|
||||
#*/**
|
||||
* 导出${functionName}列表
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:export")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ${ClassName}DTO ${className}DTO)
|
||||
{
|
||||
List<${ClassName}> list = ${className}ApplicationService.select${ClassName}List(${className});
|
||||
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
|
||||
util.exportExcel(response, list, "${functionName}数据");
|
||||
}*#
|
||||
|
||||
|
||||
|
||||
#* /**
|
||||
* 新增${functionName}
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:add")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ${ClassName} ${className})
|
||||
{
|
||||
return toAjax(${className}ApplicationService.insert${ClassName}(${className}));
|
||||
}*#
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user