|
|
@@ -1,7 +1,11 @@
|
|
|
package com.fs.company.controller.course;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import com.fs.company.service.impl.CompanyDeptServiceImpl;
|
|
|
+import com.fs.company.service.impl.CompanyUserServiceImpl;
|
|
|
import com.fs.framework.security.LoginUser;
|
|
|
import com.fs.framework.security.SecurityUtils;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
@@ -25,7 +29,7 @@ import com.fs.common.core.page.TableDataInfo;
|
|
|
|
|
|
/**
|
|
|
* 完课模板Controller
|
|
|
- *
|
|
|
+ *
|
|
|
* @author 吴树波
|
|
|
* @date 2025-05-22
|
|
|
*/
|
|
|
@@ -36,6 +40,12 @@ public class FsCourseFinishTempParentController extends BaseController
|
|
|
@Autowired
|
|
|
private IFsCourseFinishTempParentService fsCourseFinishTempParentService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CompanyDeptServiceImpl companyDeptService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CompanyUserServiceImpl companyUserService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询完课模板列表
|
|
|
*/
|
|
|
@@ -50,6 +60,55 @@ public class FsCourseFinishTempParentController extends BaseController
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询我创建的完课模板列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:myList')")
|
|
|
+ @GetMapping("/myList")
|
|
|
+ public TableDataInfo myList(FsCourseFinishTempParent fsCourseFinishTempParent)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ fsCourseFinishTempParent.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ fsCourseFinishTempParent.setCreateBy(String.valueOf(loginUser.getUser().getUserId()));
|
|
|
+ List<FsCourseFinishTempParent> list = fsCourseFinishTempParentService.selectFsCourseFinishTempParentList(fsCourseFinishTempParent);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询部门的创建的完课模板列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:deptList')")
|
|
|
+ @GetMapping("/deptList")
|
|
|
+ public TableDataInfo deptList(FsCourseFinishTempParent fsCourseFinishTempParent)
|
|
|
+ {
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ fsCourseFinishTempParent.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+
|
|
|
+ List<Long> combinedList = new ArrayList<>();
|
|
|
+ //本部门
|
|
|
+ Long deptId = loginUser.getUser().getDeptId();
|
|
|
+ if (deptId!=null){
|
|
|
+ combinedList.add(deptId);
|
|
|
+ }
|
|
|
+ //本部门的下级部门
|
|
|
+ List<Long> deptList = companyDeptService.selectCompanyDeptByParentId(deptId);
|
|
|
+ if (!deptList.isEmpty()){
|
|
|
+ combinedList.addAll(deptList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> userIds = companyUserService.selectCompanyQwUserByDept(deptList, loginUser.getUser().getUserType());
|
|
|
+ if (userIds.isEmpty()){
|
|
|
+ return getDataTable(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ fsCourseFinishTempParent.setUserIds(userIds);
|
|
|
+
|
|
|
+ startPage();
|
|
|
+ List<FsCourseFinishTempParent> list = fsCourseFinishTempParentService.selectFsCourseFinishTempParentList(fsCourseFinishTempParent);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 导出完课模板列表
|
|
|
*/
|
|
|
@@ -58,15 +117,67 @@ public class FsCourseFinishTempParentController extends BaseController
|
|
|
@GetMapping("/export")
|
|
|
public AjaxResult export(FsCourseFinishTempParent fsCourseFinishTempParent)
|
|
|
{
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ fsCourseFinishTempParent.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ List<FsCourseFinishTempParent> list = fsCourseFinishTempParentService.selectFsCourseFinishTempParentList(fsCourseFinishTempParent);
|
|
|
+ ExcelUtil<FsCourseFinishTempParent> util = new ExcelUtil<FsCourseFinishTempParent>(FsCourseFinishTempParent.class);
|
|
|
+ return util.exportExcel(list, "完课模板数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出我的完课模板列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:myExport')")
|
|
|
+ @Log(title = "完课模板", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/myExport")
|
|
|
+ public AjaxResult myExport(FsCourseFinishTempParent fsCourseFinishTempParent)
|
|
|
+ {
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ fsCourseFinishTempParent.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ fsCourseFinishTempParent.setCreateBy(String.valueOf(loginUser.getUser().getUserId()));
|
|
|
List<FsCourseFinishTempParent> list = fsCourseFinishTempParentService.selectFsCourseFinishTempParentList(fsCourseFinishTempParent);
|
|
|
ExcelUtil<FsCourseFinishTempParent> util = new ExcelUtil<FsCourseFinishTempParent>(FsCourseFinishTempParent.class);
|
|
|
return util.exportExcel(list, "完课模板数据");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 导出部门完课模板列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:myExport')")
|
|
|
+ @Log(title = "完课模板", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/deptExport")
|
|
|
+ public AjaxResult deptExport(FsCourseFinishTempParent fsCourseFinishTempParent)
|
|
|
+ {
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+
|
|
|
+ List<Long> combinedList = new ArrayList<>();
|
|
|
+ //本部门
|
|
|
+ Long deptId = loginUser.getUser().getDeptId();
|
|
|
+ if (deptId!=null){
|
|
|
+ combinedList.add(deptId);
|
|
|
+ }
|
|
|
+ //本部门的下级部门
|
|
|
+ List<Long> deptList = companyDeptService.selectCompanyDeptByParentId(deptId);
|
|
|
+ if (!deptList.isEmpty()){
|
|
|
+ combinedList.addAll(deptList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> userIds = companyUserService.selectCompanyQwUserByDept(deptList, loginUser.getUser().getUserType());
|
|
|
+ if (userIds.isEmpty()){
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+
|
|
|
+ fsCourseFinishTempParent.setUserIds(userIds);
|
|
|
+ List<FsCourseFinishTempParent> list = fsCourseFinishTempParentService.selectFsCourseFinishTempParentList(fsCourseFinishTempParent);
|
|
|
+ ExcelUtil<FsCourseFinishTempParent> util = new ExcelUtil<FsCourseFinishTempParent>(FsCourseFinishTempParent.class);
|
|
|
+ return util.exportExcel(list, "完课模板数据");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取完课模板详细信息
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:query')")
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:query') || @ss.hasPermi('course:courseFinishTempParent:myQuery') || @ss.hasPermi('course:courseFinishTempParent:deptQuery')")
|
|
|
@GetMapping(value = "/{id}")
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
{
|
|
|
@@ -76,20 +187,22 @@ public class FsCourseFinishTempParentController extends BaseController
|
|
|
/**
|
|
|
* 新增完课模板
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:add')")
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:add') || @ss.hasPermi('course:courseFinishTempParent:myAdd') || @ss.hasPermi('course:courseFinishTempParent:deptAdd')")
|
|
|
@Log(title = "完课模板", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody FsCourseFinishTempParent fsCourseFinishTempParent){
|
|
|
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
fsCourseFinishTempParent.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ fsCourseFinishTempParent.setCreateTime(new Date());
|
|
|
+ fsCourseFinishTempParent.setCreateBy(String.valueOf(loginUser.getUser().getUserId()));
|
|
|
return toAjax(fsCourseFinishTempParentService.insertFsCourseFinishTempParent(fsCourseFinishTempParent));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改完课模板
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:edit')")
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:edit') || @ss.hasPermi('course:courseFinishTempParent:myEdit') || @ss.hasPermi('course:courseFinishTempParent:deptEdit')")
|
|
|
@Log(title = "完课模板", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody FsCourseFinishTempParent fsCourseFinishTempParent)
|
|
|
@@ -102,7 +215,7 @@ public class FsCourseFinishTempParentController extends BaseController
|
|
|
/**
|
|
|
* 删除完课模板
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:remove')")
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:courseFinishTempParent:remove') || @ss.hasPermi('course:courseFinishTempParent:myRemove') || @ss.hasPermi('course:courseFinishTempParent:deptRemove')")
|
|
|
@Log(title = "完课模板", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{ids}")
|
|
|
public AjaxResult remove(@PathVariable Long[] ids)
|