|
|
@@ -1,4 +1,4 @@
|
|
|
-package ${PackageName}$.biz.controller.${ClientType}$;
|
|
|
+package <<ym.projectService.packageName>>.biz.controller.admin;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
@@ -8,8 +8,11 @@ import com.kxs.common.security.annotation.Inner;
|
|
|
import com.kxs.common.log.annotation.SysLog;
|
|
|
import org.springdoc.core.annotations.ParameterObject;
|
|
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
|
|
-import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
-${ImportList}$
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;<<ym-loop:databaseTables>>
|
|
|
+import <<ym.projectService.packageName>>.api.model.<<tableNameFirstUpper>>;<</ym-loop:databaseTables>>
|
|
|
+import org.apache.ibatis.annotations.Param;<<ym-loop:databaseTables>>
|
|
|
+import <<ym.projectService.packageName>>.biz.service.<<tableNameFirstUpper>>Service;<</ym-loop:databaseTables>>
|
|
|
+
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
@@ -18,26 +21,48 @@ import java.util.List;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
/**
|
|
|
- * ${TabName}$(${ClassName}$)控制层
|
|
|
- *
|
|
|
- * @author 系统
|
|
|
- * @since ${Now}$
|
|
|
- */
|
|
|
+* <<ym.apiGroup.groupTitle>>(<<ym.apiGroup.groupNameUpper>>)控制层
|
|
|
+*
|
|
|
+ * @author <<ym:author>>
|
|
|
+ * @since <<ym:since>>
|
|
|
+*/
|
|
|
@RestController
|
|
|
@RequiredArgsConstructor
|
|
|
-@RequestMapping("${ClassNameLower}$")
|
|
|
-@Tag(description = "${ClassNameLower}$", name = "${ClassName}$")
|
|
|
+@RequestMapping("<<ym.apiGroup.groupName>>")
|
|
|
+@Tag(description = "<<ym.apiGroup.groupName>>", name = "<<ym.apiGroup.groupNameUpper>>")
|
|
|
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
|
|
-public class ${ClassName}$Controller {
|
|
|
+public class <<ym.apiGroup.groupNameUpper>>Controller {
|
|
|
|
|
|
/**
|
|
|
- * 服务对象
|
|
|
- */
|
|
|
-${ServiceList}$
|
|
|
+ * 服务对象
|
|
|
+ */<<ym-loop:databaseTables>>
|
|
|
+ private final <<tableNameFirstUpper>>Service <<tableNameFirstUpper>>Service;<</ym-loop:databaseTables>>
|
|
|
+
|
|
|
|
|
|
|
|
|
-${MethodList}$
|
|
|
+ <<ym-loop:apiInfos>>
|
|
|
+ /**
|
|
|
+ * <<tabName>>-<<apiName>>
|
|
|
+ *
|
|
|
+ * @RequestBody param 实体参数
|
|
|
+ * @return <<tabName>>-<<apiName>>
|
|
|
+ */<<ym-if:<<apiKind>> > 2>>
|
|
|
+ @SysLog("<<tabName>><<apiName>>")<</ym-if>><<ym-if:<<apiKind>> < 3>>
|
|
|
+ @GetMapping("/<<methodName>>")<</ym-if>><<ym-if:<<apiKind>> == 3>>
|
|
|
+ @PostMapping("/<<methodName>>")<</ym-if>><<ym-if:<<apiKind>> == 4>>
|
|
|
+ @PutMapping("/<<methodName>>")<</ym-if>><<ym-if:<<apiKind>> == 5>>
|
|
|
+ @DeleteMapping("/<<methodName>>")<</ym-if>><<ym-if:<<apiKind>> > 2>>
|
|
|
+ @PreAuthorize("@pms.hasPermission('<<linkTableName>>_<<methodName>>')")<</ym-if>>
|
|
|
+ public R <<methodName>>(<<ym-if:<<apiKind>> == 1 && <<pageFlag>>>>@ParameterObject Page<<<linkTableNameFirstUpper>>> page, <</ym-if>><<ym-if:<<apiKind>> < 3>>@ParameterObject<</ym-if>><<ym-if:<<apiKind>> == 3 || <<apiKind>> == 4>>@RequestBody<</ym-if>> <<ym-if:<<apiKind>> == 5>>@PathVariable Long id<<ym-else>><<linkTableNameFirstUpper>> param<</ym-if) {<<ym-if:<<apiKind>> == 1>>
|
|
|
+ return R.ok(<<linkTableNameUpper>>Service.page(page, new QueryWrapper<>(param)));<</ym-if>><<ym-if:<<apiKind>> == 2>>
|
|
|
+ return R.ok(<<linkTableNameUpper>>Service.getById(param));<</ym-if>><<ym-if:<<apiKind>> == 3>>
|
|
|
+ return R.ok(<<linkTableNameUpper>>Service.save(param));<</ym-if>><<ym-if:<<apiKind>> == 4>>
|
|
|
+ return R.ok(<<linkTableNameUpper>>Service.updateById(param));<</ym-if>><<ym-if:<<apiKind>> == 5>>
|
|
|
+ return R.ok(<<linkTableNameUpper>>Service.removeById(id));<</ym-if>>
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
-}
|
|
|
+ <</ym-loop:apiInfos>>
|
|
|
|
|
|
+}
|