You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
2.7 KiB
92 lines
2.7 KiB
package ${package.Controller};
|
|
|
|
import java.util.List;
|
|
import com.iteaj.framework.result.Result;
|
|
import org.apache.shiro.authz.annotation.Logical;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import ${package.Entity}.${entity};
|
|
import ${package.Service}.${table.serviceName};
|
|
#if(${restControllerStyle})
|
|
#else
|
|
import org.springframework.stereotype.Controller;
|
|
#end
|
|
#if(${superControllerClassPackage})
|
|
import ${superControllerClassPackage};
|
|
#end
|
|
|
|
/**
|
|
* <p>
|
|
* $!{cfg.moduleName}管理
|
|
* </p>
|
|
*
|
|
* @author ${author}
|
|
* @since ${date}
|
|
*/
|
|
#if(${restControllerStyle})
|
|
@RestController
|
|
#else
|
|
@Controller
|
|
#end
|
|
@RequestMapping("#if(${package.ModuleName})/${package.ModuleName}#end/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end")
|
|
#if(${kotlin})
|
|
class ${table.controllerName}#if(${superControllerClass}) : ${superControllerClass}()#end
|
|
|
|
#else
|
|
#if(${superControllerClass})
|
|
public class ${table.controllerName} extends ${superControllerClass} {
|
|
#else
|
|
public class ${table.controllerName} {
|
|
#end
|
|
|
|
private final ${table.serviceName} ${cfg.serviceName};
|
|
|
|
public ${table.controllerName}(${table.serviceName} ${cfg.serviceName}) {
|
|
this.${cfg.serviceName} = ${cfg.serviceName};
|
|
}
|
|
|
|
/**
|
|
* 列表查询
|
|
* @param page 分页
|
|
* @param entity 搜索条件
|
|
*/
|
|
@GetMapping("/view")
|
|
@RequiresPermissions({"${package.ModuleName}:${table.entityPath}:view"})
|
|
public Result<IPage<${entity}>> list(Page<${entity}> page, ${entity} entity) {
|
|
return this.${cfg.serviceName}.page(page, entity);
|
|
}
|
|
|
|
/**
|
|
* 获取编辑记录
|
|
* @param id 记录id
|
|
*/
|
|
@GetMapping("/edit")
|
|
@RequiresPermissions({"${package.ModuleName}:${table.entityPath}:edit"})
|
|
public Result<${entity}> getById(Long id) {
|
|
return this.${cfg.serviceName}.getById(id);
|
|
}
|
|
|
|
/**
|
|
* 新增或者更新记录
|
|
* @param entity
|
|
*/
|
|
@PostMapping("/saveOrUpdate")
|
|
@RequiresPermissions(value = {"${package.ModuleName}:${table.entityPath}:edit", "${package.ModuleName}:${table.entityPath}:add"}, logical = Logical.OR)
|
|
public Result<Boolean> save(@RequestBody ${entity} entity) {
|
|
return this.${cfg.serviceName}.saveOrUpdate(entity);
|
|
}
|
|
|
|
/**
|
|
* 删除指定记录
|
|
* @param idList
|
|
*/
|
|
@PostMapping("/del")
|
|
@RequiresPermissions({"${package.ModuleName}:${table.entityPath}:del"})
|
|
public Result<Boolean> remove(@RequestBody List<Long> idList) {
|
|
return this.${cfg.serviceName}.removeByIds(idList);
|
|
}
|
|
}
|
|
|
|
#end
|