|
|
|
|
@@ -1,6 +1,11 @@
|
|
|
|
|
package com.jeesite.modules.biz.web;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.jeesite.modules.apps.Module.PageResult;
|
|
|
|
|
import com.jeesite.modules.apps.Module.Table.MyProjectParams;
|
|
|
|
|
import com.jeesite.modules.utils.PageUtil;
|
|
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
@@ -26,6 +31,7 @@ import com.jeesite.modules.biz.service.MyProjectInfoService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 项目信息 Controller
|
|
|
|
|
*
|
|
|
|
|
* @author gaoxq
|
|
|
|
|
* @version 2026-03-21
|
|
|
|
|
*/
|
|
|
|
|
@@ -33,123 +39,142 @@ import com.jeesite.modules.biz.service.MyProjectInfoService;
|
|
|
|
|
@RequestMapping(value = "${adminPath}/biz/myProjectInfo")
|
|
|
|
|
public class MyProjectInfoController extends BaseController {
|
|
|
|
|
|
|
|
|
|
private final MyProjectInfoService myProjectInfoService;
|
|
|
|
|
private final MyProjectInfoService myProjectInfoService;
|
|
|
|
|
|
|
|
|
|
public MyProjectInfoController(MyProjectInfoService myProjectInfoService) {
|
|
|
|
|
this.myProjectInfoService = myProjectInfoService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取数据
|
|
|
|
|
*/
|
|
|
|
|
@ModelAttribute
|
|
|
|
|
public MyProjectInfo get(String projectId, boolean isNewRecord) {
|
|
|
|
|
return myProjectInfoService.get(projectId, isNewRecord);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询列表
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:view")
|
|
|
|
|
@RequestMapping(value = {"list", ""})
|
|
|
|
|
public String list(MyProjectInfo myProjectInfo, Model model) {
|
|
|
|
|
model.addAttribute("myProjectInfo", myProjectInfo);
|
|
|
|
|
return "modules/biz/myProjectInfoList";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询列表数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:view")
|
|
|
|
|
@RequestMapping(value = "listData")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Page<MyProjectInfo> listData(MyProjectInfo myProjectInfo, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
myProjectInfo.setPage(new Page<>(request, response));
|
|
|
|
|
Page<MyProjectInfo> page = myProjectInfoService.findPage(myProjectInfo);
|
|
|
|
|
return page;
|
|
|
|
|
}
|
|
|
|
|
public MyProjectInfoController(MyProjectInfoService myProjectInfoService) {
|
|
|
|
|
this.myProjectInfoService = myProjectInfoService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查看编辑表单
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:view")
|
|
|
|
|
@RequestMapping(value = "form")
|
|
|
|
|
public String form(MyProjectInfo myProjectInfo, Model model) {
|
|
|
|
|
model.addAttribute("myProjectInfo", myProjectInfo);
|
|
|
|
|
return "modules/biz/myProjectInfoForm";
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取数据
|
|
|
|
|
*/
|
|
|
|
|
@ModelAttribute
|
|
|
|
|
public MyProjectInfo get(String projectId, boolean isNewRecord) {
|
|
|
|
|
return myProjectInfoService.get(projectId, isNewRecord);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:edit")
|
|
|
|
|
@PostMapping(value = "save")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String save(@Validated MyProjectInfo myProjectInfo) {
|
|
|
|
|
myProjectInfoService.save(myProjectInfo);
|
|
|
|
|
return renderResult(Global.TRUE, text("保存项目成功!"));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 查询列表
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:view")
|
|
|
|
|
@RequestMapping(value = {"list", ""})
|
|
|
|
|
public String list(MyProjectInfo myProjectInfo, Model model) {
|
|
|
|
|
model.addAttribute("myProjectInfo", myProjectInfo);
|
|
|
|
|
return "modules/biz/myProjectInfoList";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:view")
|
|
|
|
|
@RequestMapping(value = "exportData")
|
|
|
|
|
public void exportData(MyProjectInfo myProjectInfo, HttpServletResponse response) {
|
|
|
|
|
List<MyProjectInfo> list = myProjectInfoService.findList(myProjectInfo);
|
|
|
|
|
String fileName = "项目" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
|
|
|
|
try(ExcelExport ee = new ExcelExport("项目", MyProjectInfo.class)){
|
|
|
|
|
ee.setDataList(list).write(response, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 查询列表数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:view")
|
|
|
|
|
@RequestMapping(value = "listData")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Page<MyProjectInfo> listData(MyProjectInfo myProjectInfo, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
myProjectInfo.setPage(new Page<>(request, response));
|
|
|
|
|
Page<MyProjectInfo> page = myProjectInfoService.findPage(myProjectInfo);
|
|
|
|
|
return page;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 下载模板
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:view")
|
|
|
|
|
@RequestMapping(value = "importTemplate")
|
|
|
|
|
public void importTemplate(HttpServletResponse response) {
|
|
|
|
|
MyProjectInfo myProjectInfo = new MyProjectInfo();
|
|
|
|
|
List<MyProjectInfo> list = ListUtils.newArrayList(myProjectInfo);
|
|
|
|
|
String fileName = "项目模板.xlsx";
|
|
|
|
|
try(ExcelExport ee = new ExcelExport("项目", MyProjectInfo.class, Type.IMPORT)){
|
|
|
|
|
ee.setDataList(list).write(response, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 查看编辑表单
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:view")
|
|
|
|
|
@RequestMapping(value = "form")
|
|
|
|
|
public String form(MyProjectInfo myProjectInfo, Model model) {
|
|
|
|
|
model.addAttribute("myProjectInfo", myProjectInfo);
|
|
|
|
|
return "modules/biz/myProjectInfoForm";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导入数据
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:edit")
|
|
|
|
|
@PostMapping(value = "importData")
|
|
|
|
|
public String importData(MultipartFile file) {
|
|
|
|
|
try {
|
|
|
|
|
String message = myProjectInfoService.importData(file);
|
|
|
|
|
return renderResult(Global.TRUE, "posfull:"+message);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:edit")
|
|
|
|
|
@RequestMapping(value = "delete")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String delete(MyProjectInfo myProjectInfo) {
|
|
|
|
|
myProjectInfoService.delete(myProjectInfo);
|
|
|
|
|
return renderResult(Global.TRUE, text("删除项目成功!"));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 保存数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:edit")
|
|
|
|
|
@PostMapping(value = "save")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String save(@Validated MyProjectInfo myProjectInfo) {
|
|
|
|
|
myProjectInfoService.save(myProjectInfo);
|
|
|
|
|
return renderResult(Global.TRUE, text("保存项目成功!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 列表数据
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "listAll")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public List<MyProjectInfo> listAll(MyProjectInfo myProjectInfo){
|
|
|
|
|
return myProjectInfoService.findList(myProjectInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:view")
|
|
|
|
|
@RequestMapping(value = "exportData")
|
|
|
|
|
public void exportData(MyProjectInfo myProjectInfo, HttpServletResponse response) {
|
|
|
|
|
List<MyProjectInfo> list = myProjectInfoService.findList(myProjectInfo);
|
|
|
|
|
String fileName = "项目" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
|
|
|
|
try (ExcelExport ee = new ExcelExport("项目", MyProjectInfo.class)) {
|
|
|
|
|
ee.setDataList(list).write(response, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 下载模板
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:view")
|
|
|
|
|
@RequestMapping(value = "importTemplate")
|
|
|
|
|
public void importTemplate(HttpServletResponse response) {
|
|
|
|
|
MyProjectInfo myProjectInfo = new MyProjectInfo();
|
|
|
|
|
List<MyProjectInfo> list = ListUtils.newArrayList(myProjectInfo);
|
|
|
|
|
String fileName = "项目模板.xlsx";
|
|
|
|
|
try (ExcelExport ee = new ExcelExport("项目", MyProjectInfo.class, Type.IMPORT)) {
|
|
|
|
|
ee.setDataList(list).write(response, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导入数据
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:edit")
|
|
|
|
|
@PostMapping(value = "importData")
|
|
|
|
|
public String importData(MultipartFile file) {
|
|
|
|
|
try {
|
|
|
|
|
String message = myProjectInfoService.importData(file);
|
|
|
|
|
return renderResult(Global.TRUE, "posfull:" + message);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除数据
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("biz:myProjectInfo:edit")
|
|
|
|
|
@RequestMapping(value = "delete")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String delete(MyProjectInfo myProjectInfo) {
|
|
|
|
|
myProjectInfoService.delete(myProjectInfo);
|
|
|
|
|
return renderResult(Global.TRUE, text("删除项目成功!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 列表数据
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "listAll")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public List<MyProjectInfo> listAll(MyProjectInfo myProjectInfo) {
|
|
|
|
|
return myProjectInfoService.findList(myProjectInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 列表数据
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "projectList")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public PageResult<MyProjectInfo> getProjectList(MyProjectParams myProjectParams) {
|
|
|
|
|
MyProjectInfo myProjectInfo = new MyProjectInfo();
|
|
|
|
|
myProjectInfo.setProjectName(myProjectParams.getProjectName());
|
|
|
|
|
myProjectInfo.setProjectType(myProjectParams.getProjectType());
|
|
|
|
|
myProjectInfo.setProjectStatus(myProjectParams.getProjectStatus());
|
|
|
|
|
List<MyProjectInfo> list = myProjectInfoService.findList(myProjectInfo);
|
|
|
|
|
PageUtil<MyProjectInfo> util = new PageUtil<>(myProjectParams.getPageNum(), myProjectParams.getPageSize(), list);
|
|
|
|
|
return new PageResult<>(
|
|
|
|
|
util.OkData(),
|
|
|
|
|
util.getCurPage(),
|
|
|
|
|
util.getPageSize(),
|
|
|
|
|
util.getTotalCount()
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|