mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-08 21:37:42 +00:00
若依 2.0
This commit is contained in:
@@ -22,7 +22,7 @@ public class VelocityUtils
|
||||
private static final String PROJECT_PATH = "main/java";
|
||||
|
||||
/** mybatis空间路径 */
|
||||
private static final String MYBATIS_PATH = "main/resources/mybatis";
|
||||
private static final String MYBATIS_PATH = "main/resources/mapper";
|
||||
|
||||
/**
|
||||
* 设置模板变量信息
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package ${packageName}.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -11,15 +13,15 @@ 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 com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import ${packageName}.service.I${ClassName}Service;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
#if($table.crud)
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
#elseif($table.tree)
|
||||
#end
|
||||
|
||||
@@ -30,7 +32,7 @@ import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
* @date ${datetime}
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${moduleName}/${businessName}")
|
||||
@RequestMapping("/${businessName}")
|
||||
public class ${ClassName}Controller extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
@@ -62,11 +64,11 @@ public class ${ClassName}Controller extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
||||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(${ClassName} ${className})
|
||||
public void export(HttpServletResponse response, ${ClassName} ${className}) throws IOException
|
||||
{
|
||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
|
||||
return util.exportExcel(list, "${businessName}");
|
||||
return util.exportExcel(response, list, "${businessName}");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -42,12 +42,3 @@ export function del${BusinessName}(${pkColumn.javaField}) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出${functionName}
|
||||
export function export${BusinessName}(query) {
|
||||
return request({
|
||||
url: '/${moduleName}/${businessName}/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
@@ -229,7 +229,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||
|
||||
export default {
|
||||
name: "${BusinessName}",
|
||||
@@ -422,16 +422,9 @@ export default {
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有${functionName}数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return export${BusinessName}(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
}).catch(function() {});
|
||||
this.download('${moduleName}/${businessName}/export', {
|
||||
...this.queryParams
|
||||
}, `${moduleName}_${businessName}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user