diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml
index ba6834a..f1e842c 100644
--- a/ruoyi-admin/src/main/resources/application-dev.yml
+++ b/ruoyi-admin/src/main/resources/application-dev.yml
@@ -49,7 +49,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
- url: jdbc:mysql://localhost:3306/ry-flowable-plus?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true
+ url: jdbc:mysql://192.168.31.120:3306/ry-flowable-plus?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true
username: root
password: jyzbyj306
# 从库数据源
diff --git a/ruoyi-ui/src/api/scientific/department.js b/ruoyi-ui/src/api/scientific/department.js
new file mode 100644
index 0000000..a270c89
--- /dev/null
+++ b/ruoyi-ui/src/api/scientific/department.js
@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询department列表
+export function listDepartment(query) {
+ return request({
+ url: '/scientific/department/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 查询department详细
+export function getDepartment(departmentId) {
+ return request({
+ url: '/scientific/department/' + departmentId,
+ method: 'get'
+ })
+}
+
+// 新增department
+export function addDepartment(data) {
+ return request({
+ url: '/scientific/department',
+ method: 'post',
+ data: data
+ })
+}
+
+// 修改department
+export function updateDepartment(data) {
+ return request({
+ url: '/scientific/department',
+ method: 'put',
+ data: data
+ })
+}
+
+// 删除department
+export function delDepartment(departmentId) {
+ return request({
+ url: '/scientific/department/' + departmentId,
+ method: 'delete'
+ })
+}
diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js
index 9229127..9ac18e3 100644
--- a/ruoyi-ui/src/router/index.js
+++ b/ruoyi-ui/src/router/index.js
@@ -346,6 +346,41 @@ export const dynamicRoutes = [
// },
// ]
// },
+
+ // 合作单位路由
+ {
+ path: '/scientific/department',
+ component: Layout,
+ hidden: true,
+ permissions: ['scientific:department'],
+ children: [
+ {
+ path: 'list',
+ component: () => import('@/views/scientific/department/index'),
+ name: 'departmentList',
+ meta: { title: '合作单位列表', icon: '' }
+ },
+ {
+ path: 'detail/:departmentProcId([\\w|\\-]+)',
+ component: () => import('@/views/scientific/department/detail'),
+ name: 'departmentDetail',
+ meta: { title: '合作单位详情' }
+ },
+ // {
+ // path: 'planProjectQuery/:planId([\\w|\\-]+)',
+ // // permissions: ['scientific:application:list'],
+ // component: () => import('@/views/scientific/project/index'),
+ // name: 'planProjectQuery',
+ // meta: { title: '已申报项目' }
+ // },
+ {
+ path: 'departmentApply',
+ component: () => import('@/views/scientific/department/departmentApply'),
+ name: 'departmentApply',
+ meta: { title: '合作单位录入', icon: '' }
+ },
+ ]
+ },
]
// 防止连续点击多次路由报错
diff --git a/ruoyi-ui/src/views/scientific/department/departmentApply.vue b/ruoyi-ui/src/views/scientific/department/departmentApply.vue
new file mode 100644
index 0000000..49e2891
--- /dev/null
+++ b/ruoyi-ui/src/views/scientific/department/departmentApply.vue
@@ -0,0 +1,151 @@
+
+
+
+
+ 合作单位录入
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-ui/src/views/scientific/department/detail.vue b/ruoyi-ui/src/views/scientific/department/detail.vue
new file mode 100644
index 0000000..b19b504
--- /dev/null
+++ b/ruoyi-ui/src/views/scientific/department/detail.vue
@@ -0,0 +1,476 @@
+
+
+
+
+
+
+
+
+
+
+ 合作单位详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-ui/src/views/scientific/department/index.vue b/ruoyi-ui/src/views/scientific/department/index.vue
new file mode 100644
index 0000000..0cbf22c
--- /dev/null
+++ b/ruoyi-ui/src/views/scientific/department/index.vue
@@ -0,0 +1,377 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+ 新增
+
+
+ 修改
+
+
+ 删除
+
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 详情
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scientific/src/main/java/com/ruoyi/scientific/controller/DepartmentController.java b/scientific/src/main/java/com/ruoyi/scientific/controller/DepartmentController.java
new file mode 100644
index 0000000..d034aad
--- /dev/null
+++ b/scientific/src/main/java/com/ruoyi/scientific/controller/DepartmentController.java
@@ -0,0 +1,109 @@
+package com.ruoyi.scientific.controller;
+
+import java.util.List;
+import java.util.Arrays;
+import java.util.concurrent.TimeUnit;
+
+import com.ruoyi.scientific.domain.vo.DepartmentVo;
+import lombok.RequiredArgsConstructor;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.*;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.PageQuery;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.validate.AddGroup;
+import com.ruoyi.common.core.validate.EditGroup;
+import com.ruoyi.common.core.validate.QueryGroup;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+
+import com.ruoyi.scientific.domain.bo.DepartmentBo;
+import com.ruoyi.scientific.service.IDepartmentService;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * department
+ *
+ * @author zqjia
+ * @date 2024-08-13
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/scientific/department")
+public class DepartmentController extends BaseController {
+
+ private final IDepartmentService iDepartmentService;
+
+ /**
+ * 查询department列表
+ */
+ @SaCheckPermission("scientific:department:list")
+ @GetMapping("/list")
+ public TableDataInfo list(DepartmentBo bo, PageQuery pageQuery) {
+ return iDepartmentService.queryPageList(bo, pageQuery);
+ }
+
+ /**
+ * 导出department列表
+ */
+ @SaCheckPermission("scientific:department:export")
+ @Log(title = "department", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(DepartmentBo bo, HttpServletResponse response) {
+ List list = iDepartmentService.queryList(bo);
+ ExcelUtil.exportExcel(list, "department", DepartmentVo.class, response);
+ }
+
+ /**
+ * 获取department详细信息
+ *
+ * @param departmentId 主键
+ */
+ @SaCheckPermission("scientific:department:query")
+ @GetMapping("/{departmentId}")
+ public R getInfo(@NotNull(message = "主键不能为空")
+ @PathVariable Long departmentId) {
+ return R.ok(iDepartmentService.queryById(departmentId));
+ }
+
+ /**
+ * 新增department
+ */
+ @SaCheckPermission("scientific:department:add")
+ @Log(title = "department", businessType = BusinessType.INSERT)
+ @RepeatSubmit()
+ @PostMapping()
+ public R add(@Validated(AddGroup.class) @RequestBody DepartmentBo bo) {
+ return toAjax(iDepartmentService.insertByBo(bo));
+ }
+
+ /**
+ * 修改department
+ */
+ @SaCheckPermission("scientific:department:edit")
+ @Log(title = "department", businessType = BusinessType.UPDATE)
+ @RepeatSubmit()
+ @PutMapping()
+ public R edit(@Validated(EditGroup.class) @RequestBody DepartmentBo bo) {
+ return toAjax(iDepartmentService.updateByBo(bo));
+ }
+
+ /**
+ * 删除department
+ *
+ * @param departmentIds 主键串
+ */
+ @SaCheckPermission("scientific:department:remove")
+ @Log(title = "department", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{departmentIds}")
+ public R remove(@NotEmpty(message = "主键不能为空")
+ @PathVariable Long[] departmentIds) {
+ return toAjax(iDepartmentService.deleteWithValidByIds(Arrays.asList(departmentIds), true));
+ }
+}
diff --git a/scientific/src/main/java/com/ruoyi/scientific/domain/Department.java b/scientific/src/main/java/com/ruoyi/scientific/domain/Department.java
new file mode 100644
index 0000000..d279a87
--- /dev/null
+++ b/scientific/src/main/java/com/ruoyi/scientific/domain/Department.java
@@ -0,0 +1,72 @@
+package com.ruoyi.scientific.domain;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.io.Serializable;
+import java.util.Date;
+import java.math.BigDecimal;
+
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * department对象 department
+ *
+ * @author zqjia
+ * @date 2024-08-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("department")
+public class Department extends BaseEntity {
+
+ private static final long serialVersionUID=1L;
+
+ /**
+ * 单位ID
+ */
+ @TableId(value = "department_id")
+ private Long departmentId;
+ /**
+ * 单位名称
+ */
+ private String departmentName;
+ /**
+ * 单位地址
+ */
+ private String departmentAddress;
+ /**
+ * 单位性质,1企业,2科研机构,3高校
+ */
+ private String departmentCategory;
+ /**
+ * 单位联系人姓名
+ */
+ private String departmentPerson;
+ /**
+ * 单位联系人电话
+ */
+ private String departmentPhone;
+ /**
+ * 单位联系人邮件
+ */
+ private String departmentEmail;
+ /**
+ * 相关文件
+ */
+ private String departmentFile;
+ /**
+ * 其他备注信息
+ */
+ private String departmentNote;
+
+ /**
+ * 指南录入流程实例Id
+ */
+ private String departmentProcId;
+
+ /**
+ * 指南录入流程状态(0未发起审核 1审核中 2审核失败 3审核通过)
+ */
+ private String departmentStatus;
+}
diff --git a/scientific/src/main/java/com/ruoyi/scientific/domain/bo/DepartmentBo.java b/scientific/src/main/java/com/ruoyi/scientific/domain/bo/DepartmentBo.java
new file mode 100644
index 0000000..8c8a31a
--- /dev/null
+++ b/scientific/src/main/java/com/ruoyi/scientific/domain/bo/DepartmentBo.java
@@ -0,0 +1,80 @@
+package com.ruoyi.scientific.domain.bo;
+
+import com.ruoyi.common.core.validate.AddGroup;
+import com.ruoyi.common.core.validate.EditGroup;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import javax.validation.constraints.*;
+
+import java.util.Date;
+
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * department业务对象 department
+ *
+ * @author zqjia
+ * @date 2024-08-13
+ */
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DepartmentBo extends BaseEntity {
+
+ /**
+ * 单位ID
+ */
+ @NotNull(message = "单位ID不能为空", groups = { EditGroup.class })
+ private Long departmentId;
+
+ /**
+ * 单位名称
+ */
+ @NotBlank(message = "单位不能为空", groups = { AddGroup.class, EditGroup.class })
+ private String departmentName;
+
+ /**
+ * 单位地址
+ */
+ private String departmentAddress;
+
+ /**
+ * 单位性质,1企业,2科研机构,3高校
+ */
+ private String departmentCategory;
+
+ /**
+ * 单位联系人姓名
+ */
+ private String departmentPerson;
+
+ /**
+ * 单位联系人电话
+ */
+ private String departmentPhone;
+
+ /**
+ * 单位联系人邮件
+ */
+ private String departmentEmail;
+
+ /**
+ * 相关文件
+ */
+ private String departmentFile;
+
+ /**
+ * 其他备注信息
+ */
+ private String departmentNote;
+
+ /**
+ * 指南录入流程实例Id
+ */
+ private String departmentProcId;
+
+ /**
+ * 指南录入流程状态(0未发起审核 1审核中 2审核失败 3审核通过)
+ */
+ private String departmentStatus;
+}
diff --git a/scientific/src/main/java/com/ruoyi/scientific/domain/vo/DepartmentVo.java b/scientific/src/main/java/com/ruoyi/scientific/domain/vo/DepartmentVo.java
new file mode 100644
index 0000000..2ccecf5
--- /dev/null
+++ b/scientific/src/main/java/com/ruoyi/scientific/domain/vo/DepartmentVo.java
@@ -0,0 +1,87 @@
+package com.ruoyi.scientific.domain.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.ruoyi.common.annotation.ExcelDictFormat;
+import com.ruoyi.common.convert.ExcelDictConvert;
+import lombok.Data;
+import java.util.Date;
+
+
+
+/**
+ * department视图对象 department
+ *
+ * @author zqjia
+ * @date 2024-08-13
+ */
+@Data
+@ExcelIgnoreUnannotated
+public class DepartmentVo {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 单位ID
+ */
+ @ExcelProperty(value = "单位ID")
+ private Long departmentId;
+
+ /**
+ * 单位名称
+ */
+ @ExcelProperty(value = "单位名称")
+ private String departmentName;
+
+ /**
+ * 单位地址
+ */
+ @ExcelProperty(value = "单位地址")
+ private String departmentAddress;
+
+ /**
+ * 单位性质,1企业,2科研机构,3高校
+ */
+ @ExcelProperty(value = "单位性质,1企业,2科研机构,3高校")
+ private String departmentCategory;
+
+ /**
+ * 单位联系人姓名
+ */
+ @ExcelProperty(value = "单位联系人姓名")
+ private String departmentPerson;
+
+ /**
+ * 单位联系人电话
+ */
+ @ExcelProperty(value = "单位联系人电话")
+ private String departmentPhone;
+
+ /**
+ * 单位联系人邮件
+ */
+ @ExcelProperty(value = "单位联系人邮件")
+ private String departmentEmail;
+
+ /**
+ * 相关文件
+ */
+ @ExcelProperty(value = "相关文件")
+ private String departmentFile;
+
+ /**
+ * 其他备注信息
+ */
+ @ExcelProperty(value = "其他备注信息")
+ private String departmentNote;
+
+ /**
+ * 指南录入流程实例Id
+ */
+ private String departmentProcId;
+
+ /**
+ * 指南录入流程状态(0未发起审核 1审核中 2审核失败 3审核通过)
+ */
+ private String departmentStatus;
+}
diff --git a/scientific/src/main/java/com/ruoyi/scientific/listener/DepartmentUpdateListener.java b/scientific/src/main/java/com/ruoyi/scientific/listener/DepartmentUpdateListener.java
new file mode 100644
index 0000000..9ee5fab
--- /dev/null
+++ b/scientific/src/main/java/com/ruoyi/scientific/listener/DepartmentUpdateListener.java
@@ -0,0 +1,59 @@
+package com.ruoyi.scientific.listener;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.flowable.common.constant.ProcessConstants;
+import com.ruoyi.scientific.domain.bo.DepartmentBo;
+import com.ruoyi.scientific.service.IDepartmentService;
+import com.ruoyi.scientific.service.IDepartmentService;
+import org.flowable.engine.RuntimeService;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.ExecutionListener;
+import org.springframework.stereotype.Component;
+import org.flowable.engine.HistoryService;
+import com.ruoyi.common.core.domain.PageQuery;
+import com.ruoyi.scientific.domain.vo.DepartmentVo;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+@Component
+public class DepartmentUpdateListener implements ExecutionListener {
+ /**
+ * 注入字段(名称与流程设计时字段名称一致)
+ */
+
+ private final IDepartmentService IdepartmentService =
+ SpringUtils.getBean(IDepartmentService.class);
+ private final HistoryService historyService =
+ SpringUtils.getBean(HistoryService.class);
+
+ private final RuntimeService runtimeService =
+ SpringUtils.getBean(RuntimeService.class);
+
+ @Override
+ public void notify(DelegateExecution execution) {
+ System.out.println("科研模块:执行合作单位更新任务监听器...");
+
+ String departmentProcId = execution.getProcessInstanceId();
+ DepartmentBo bo = new DepartmentBo();
+ bo.setDepartmentProcId(departmentProcId);
+ PageQuery pageQuery = new PageQuery();
+ TableDataInfo result = IdepartmentService.queryPageList(bo, pageQuery);
+ Long departmentId = result.getRows().get(0).getDepartmentId();
+
+ // zqjia:获取在task complete时注入的review状态
+ String reviewStatus = (String) execution.getVariable("review");
+ // 获取流程状态
+ String status = (String) runtimeService.getVariable(departmentProcId, ProcessConstants.PROCESS_STATUS_KEY);
+
+ // zqjia: runtimeService获取是否terminated,判断注入review字段可以区分是complete还是cancel
+ if("terminated".equals(status)) {
+ IdepartmentService.updateDepartmentInfoById(departmentId, "2");
+ }
+ else {
+ if("1".equals(reviewStatus)) {
+ IdepartmentService.updateDepartmentInfoById(departmentId, "3");
+ }
+ else {
+ IdepartmentService.updateDepartmentInfoById(departmentId, "0");
+ }
+ }
+ }
+}
diff --git a/scientific/src/main/java/com/ruoyi/scientific/mapper/DepartmentMapper.java b/scientific/src/main/java/com/ruoyi/scientific/mapper/DepartmentMapper.java
new file mode 100644
index 0000000..2bf2372
--- /dev/null
+++ b/scientific/src/main/java/com/ruoyi/scientific/mapper/DepartmentMapper.java
@@ -0,0 +1,15 @@
+package com.ruoyi.scientific.mapper;
+
+import com.ruoyi.scientific.domain.Department;
+import com.ruoyi.scientific.domain.vo.DepartmentVo;
+import com.ruoyi.common.core.mapper.BaseMapperPlus;
+
+/**
+ * departmentMapper接口
+ *
+ * @author zqjia
+ * @date 2024-08-13
+ */
+public interface DepartmentMapper extends BaseMapperPlus {
+
+}
diff --git a/scientific/src/main/java/com/ruoyi/scientific/service/IDepartmentService.java b/scientific/src/main/java/com/ruoyi/scientific/service/IDepartmentService.java
new file mode 100644
index 0000000..11ae226
--- /dev/null
+++ b/scientific/src/main/java/com/ruoyi/scientific/service/IDepartmentService.java
@@ -0,0 +1,51 @@
+package com.ruoyi.scientific.service;
+
+import com.ruoyi.scientific.domain.Department;
+import com.ruoyi.scientific.domain.vo.DepartmentVo;
+import com.ruoyi.scientific.domain.bo.DepartmentBo;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.domain.PageQuery;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * departmentService接口
+ *
+ * @author zqjia
+ * @date 2024-08-13
+ */
+public interface IDepartmentService {
+
+ /**
+ * 查询department
+ */
+ DepartmentVo queryById(Long departmentId);
+
+ /**
+ * 查询department列表
+ */
+ TableDataInfo queryPageList(DepartmentBo bo, PageQuery pageQuery);
+
+ /**
+ * 查询department列表
+ */
+ List queryList(DepartmentBo bo);
+
+ /**
+ * 新增department
+ */
+ Boolean insertByBo(DepartmentBo bo);
+
+ /**
+ * 修改department
+ */
+ Boolean updateByBo(DepartmentBo bo);
+
+ /**
+ * 校验并批量删除department信息
+ */
+ Boolean deleteWithValidByIds(Collection ids, Boolean isValid);
+
+ Boolean updateDepartmentInfoById(Long handbookId, String status);
+}
diff --git a/scientific/src/main/java/com/ruoyi/scientific/service/impl/DepartmentServiceImpl.java b/scientific/src/main/java/com/ruoyi/scientific/service/impl/DepartmentServiceImpl.java
new file mode 100644
index 0000000..ad395b4
--- /dev/null
+++ b/scientific/src/main/java/com/ruoyi/scientific/service/impl/DepartmentServiceImpl.java
@@ -0,0 +1,134 @@
+package com.ruoyi.scientific.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.core.domain.PageQuery;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.scientific.domain.ProjectHandbook;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import com.ruoyi.scientific.domain.bo.DepartmentBo;
+import com.ruoyi.scientific.domain.vo.DepartmentVo;
+import com.ruoyi.scientific.domain.Department;
+import com.ruoyi.scientific.mapper.DepartmentMapper;
+import com.ruoyi.scientific.service.IDepartmentService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * departmentService业务层处理
+ *
+ * @author zqjia
+ * @date 2024-08-13
+ */
+@RequiredArgsConstructor
+@Service
+public class DepartmentServiceImpl implements IDepartmentService {
+
+ private final DepartmentMapper baseMapper;
+
+ /**
+ * 查询department
+ */
+ @Override
+ public DepartmentVo queryById(Long departmentId){
+ return baseMapper.selectVoById(departmentId);
+ }
+
+ /**
+ * 查询department列表
+ */
+ @Override
+ public TableDataInfo queryPageList(DepartmentBo bo, PageQuery pageQuery) {
+ LambdaQueryWrapper lqw = buildQueryWrapper(bo);
+ Page result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+ return TableDataInfo.build(result);
+ }
+
+ /**
+ * 查询department列表
+ */
+ @Override
+ public List queryList(DepartmentBo bo) {
+ LambdaQueryWrapper lqw = buildQueryWrapper(bo);
+ return baseMapper.selectVoList(lqw);
+ }
+
+ private LambdaQueryWrapper buildQueryWrapper(DepartmentBo bo) {
+ Map params = bo.getParams();
+ LambdaQueryWrapper lqw = Wrappers.lambdaQuery();
+ lqw.eq(bo.getDepartmentId() != null, Department::getDepartmentId, bo.getDepartmentId());
+ lqw.like(StringUtils.isNotBlank(bo.getDepartmentName()), Department::getDepartmentName, bo.getDepartmentName());
+ lqw.eq(StringUtils.isNotBlank(bo.getDepartmentAddress()), Department::getDepartmentAddress, bo.getDepartmentAddress());
+ lqw.eq(StringUtils.isNotBlank(bo.getDepartmentCategory()), Department::getDepartmentCategory, bo.getDepartmentCategory());
+ lqw.eq(StringUtils.isNotBlank(bo.getDepartmentPerson()), Department::getDepartmentPerson, bo.getDepartmentPerson());
+ lqw.eq(StringUtils.isNotBlank(bo.getDepartmentPhone()), Department::getDepartmentPhone, bo.getDepartmentPhone());
+ lqw.eq(StringUtils.isNotBlank(bo.getDepartmentEmail()), Department::getDepartmentEmail, bo.getDepartmentEmail());
+ lqw.eq(StringUtils.isNotBlank(bo.getDepartmentFile()), Department::getDepartmentFile, bo.getDepartmentFile());
+ lqw.eq(StringUtils.isNotBlank(bo.getDepartmentNote()), Department::getDepartmentNote, bo.getDepartmentNote());
+ lqw.eq(StringUtils.isNotBlank(bo.getDepartmentProcId()), Department::getDepartmentProcId, bo.getDepartmentProcId());
+ lqw.eq(StringUtils.isNotBlank(bo.getDepartmentStatus()), Department::getDepartmentStatus, bo.getDepartmentStatus());
+ return lqw;
+ }
+
+ /**
+ * 新增department
+ */
+ @Override
+ public Boolean insertByBo(DepartmentBo bo) {
+ Department add = BeanUtil.toBean(bo, Department.class);
+ validEntityBeforeSave(add);
+ boolean flag = baseMapper.insert(add) > 0;
+ if (flag) {
+ bo.setDepartmentId(add.getDepartmentId());
+ }
+ return flag;
+ }
+
+ /**
+ * 修改department
+ */
+ @Override
+ public Boolean updateByBo(DepartmentBo bo) {
+ Department update = BeanUtil.toBean(bo, Department.class);
+ validEntityBeforeSave(update);
+ return baseMapper.updateById(update) > 0;
+ }
+
+ /**
+ * 保存前的数据校验
+ */
+ private void validEntityBeforeSave(Department entity){
+ //TODO 做一些数据校验,如唯一约束
+ }
+
+ /**
+ * 批量删除department
+ */
+ @Override
+ public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) {
+ if(isValid){
+ //TODO 做一些业务上的校验,判断是否需要校验
+ }
+ return baseMapper.deleteBatchIds(ids) > 0;
+ }
+
+ public Boolean updateDepartmentInfoById(Long departmentId, String status){
+ // 获取项目的详细信息
+ Department update = baseMapper.selectById(departmentId);
+ if (update == null) {
+ return false;
+ }
+ // 更新状态信息
+ update.setDepartmentStatus(status);
+ // 保存信息
+ validEntityBeforeSave(update);
+ // 返回结果取决于是否更新成功
+ return baseMapper.updateById(update) > 0;
+ }
+}
diff --git a/scientific/src/main/resources/mapper/scientific/DepartmentMapper.xml b/scientific/src/main/resources/mapper/scientific/DepartmentMapper.xml
new file mode 100644
index 0000000..89bb3ab
--- /dev/null
+++ b/scientific/src/main/resources/mapper/scientific/DepartmentMapper.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+