春风项目四线(合箱线、总装线)
cl
2024-02-02 e0a2b80807cc52e80bf632adba9cfcb6357025aa
提交 | 用户 | 时间
fd2207 1 package ${packageName}.controller;
2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
5 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.GetMapping;
8 import org.springframework.web.bind.annotation.PostMapping;
9 import org.springframework.web.bind.annotation.PutMapping;
10 import org.springframework.web.bind.annotation.DeleteMapping;
11 import org.springframework.web.bind.annotation.PathVariable;
12 import org.springframework.web.bind.annotation.RequestBody;
13 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RestController;
15 import com.jcdm.common.annotation.Log;
16 import com.jcdm.common.core.controller.BaseController;
17 import com.jcdm.common.core.domain.AjaxResult;
18 import com.jcdm.common.enums.BusinessType;
19 import ${packageName}.domain.${ClassName};
20 import ${packageName}.service.I${ClassName}Service;
21 import com.jcdm.common.utils.poi.ExcelUtil;
22 #if($table.crud || $table.sub)
23 import com.jcdm.common.core.page.TableDataInfo;
24 #elseif($table.tree)
25 #end
26
27 /**
28  * ${functionName}Controller
29  * 
30  * @author ${author}
31  * @date ${datetime}
32  */
33 @RestController
34 @RequestMapping("/${moduleName}/${businessName}")
35 public class ${ClassName}Controller extends BaseController
36 {
37     @Autowired
38     private I${ClassName}Service ${className}Service;
39
40     /**
41      * 查询${functionName}列表
42      */
43     @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
44     @GetMapping("/list")
45 #if($table.crud || $table.sub)
46     public TableDataInfo list(${ClassName} ${className})
47     {
48         startPage();
49         List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
50         return getDataTable(list);
51     }
52 #elseif($table.tree)
53     public AjaxResult list(${ClassName} ${className})
54     {
55         List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
56         return success(list);
57     }
58 #end
59
60     /**
61      * 导出${functionName}列表
62      */
63     @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
64     @Log(title = "${functionName}", businessType = BusinessType.EXPORT)
65     @PostMapping("/export")
66     public void export(HttpServletResponse response, ${ClassName} ${className})
67     {
68         List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
69         ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
70         util.exportExcel(response, list, "${functionName}数据");
71     }
72
73     /**
74      * 获取${functionName}详细信息
75      */
76     @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
77     @GetMapping(value = "/{${pkColumn.javaField}}")
78     public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
79     {
80         return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
81     }
82
83     /**
84      * 新增${functionName}
85      */
86     @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
87     @Log(title = "${functionName}", businessType = BusinessType.INSERT)
88     @PostMapping
89     public AjaxResult add(@RequestBody ${ClassName} ${className})
90     {
91         return toAjax(${className}Service.insert${ClassName}(${className}));
92     }
93
94     /**
95      * 修改${functionName}
96      */
97     @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
98     @Log(title = "${functionName}", businessType = BusinessType.UPDATE)
99     @PutMapping
100     public AjaxResult edit(@RequestBody ${ClassName} ${className})
101     {
102         return toAjax(${className}Service.update${ClassName}(${className}));
103     }
104
105     /**
106      * 删除${functionName}
107      */
108     @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
109     @Log(title = "${functionName}", businessType = BusinessType.DELETE)
110     @DeleteMapping("/{${pkColumn.javaField}s}")
111     public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
112     {
113         return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s));
114     }
115 }