From a295566e3dfcfb0d963960eaea6a7ee3ba72e682 Mon Sep 17 00:00:00 2001 From: paidaxing444 <12qwaszx> Date: Fri, 4 Sep 2020 11:57:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E5=9C=B0=E6=A0=A1=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/jxjs/TsbzJdxController.java | 64 +++-- .../common/core/domain/entity/SysDept.java | 174 +++++++------ .../resources/mapper/system/SysDeptMapper.xml | 244 +++++++++--------- ruoyi-ui/src/views/jxjs/jdx/index.vue | 2 +- ruoyi-ui/src/views/jxjs/jxjsjbxx/index.vue | 127 +++++---- .../src/views/jxzxkhgl/jxzxkhfa/index.vue | 5 +- ruoyi-ui/src/views/system/dept/index.vue | 103 +++++--- 7 files changed, 390 insertions(+), 329 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/jxjs/TsbzJdxController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/jxjs/TsbzJdxController.java index 322e4c7b8..b974bd8ff 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/jxjs/TsbzJdxController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/jxjs/TsbzJdxController.java @@ -2,6 +2,11 @@ package com.ruoyi.web.controller.jxjs; import java.util.List; +import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.jxjs.domain.TsbzJxjsjbxx; +import com.ruoyi.jxjs.service.ITsbzJxjsjbxxService; +import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.web.controller.common.SchoolCommonController; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -24,26 +29,28 @@ import com.ruoyi.common.core.page.TableDataInfo; /** * 基地校Controller - * + * * @author ruoyi * @date 2020-08-20 */ @RestController @RequestMapping("/jxjs/jdx") -public class TsbzJdxController extends BaseController -{ +public class TsbzJdxController extends BaseController { @Autowired private ITsbzJdxService tsbzJdxService; @Autowired private SchoolCommonController schoolCommonController; + @Autowired + private ITsbzJxjsjbxxService tsbzJxjsjbxxService; + @Autowired + private ISysDeptService deptService; /** * 查询基地校列表 */ @PreAuthorize("@ss.hasPermi('jxjs:jdx:list')") @GetMapping("/list") - public TableDataInfo list(TsbzJdx tsbzJdx) - { + public TableDataInfo list(TsbzJdx tsbzJdx) { startPage(); List list = tsbzJdxService.selectTsbzJdxList(tsbzJdx); return getDataTable(list); @@ -55,8 +62,7 @@ public class TsbzJdxController extends BaseController @PreAuthorize("@ss.hasPermi('jxjs:jdx:export')") @Log(title = "基地校", businessType = BusinessType.EXPORT) @GetMapping("/export") - public AjaxResult export(TsbzJdx tsbzJdx) - { + public AjaxResult export(TsbzJdx tsbzJdx) { List list = tsbzJdxService.selectTsbzJdxList(tsbzJdx); ExcelUtil util = new ExcelUtil(TsbzJdx.class); return util.exportExcel(list, "jdx"); @@ -67,8 +73,7 @@ public class TsbzJdxController extends BaseController */ @PreAuthorize("@ss.hasPermi('jxjs:jdx:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") String id) - { + public AjaxResult getInfo(@PathVariable("id") String id) { return AjaxResult.success(tsbzJdxService.selectTsbzJdxById(id)); } @@ -78,9 +83,18 @@ public class TsbzJdxController extends BaseController @PreAuthorize("@ss.hasPermi('jxjs:jdx:add')") @Log(title = "基地校", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody TsbzJdx tsbzJdx) - { - tsbzJdx.setId(schoolCommonController.getUuid()); + public AjaxResult add(@RequestBody TsbzJdx tsbzJdx) { + String uuid = schoolCommonController.getUuid(); + tsbzJdx.setId(uuid); + //将当前记录插入的dept表 + SysDept dept = new SysDept(); + dept.setSchoolid(uuid); + dept.setDeptName(tsbzJdx.getJdxmc()); + dept.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName()); + dept.setParentId(200L); + dept.setAncestors("0,100,200"); + dept.setOrderNum(String.valueOf(tsbzJdxService.selectTsbzJdxList(null).size())); + deptService.insertDept(dept); return toAjax(tsbzJdxService.insertTsbzJdx(tsbzJdx)); } @@ -90,8 +104,15 @@ public class TsbzJdxController extends BaseController @PreAuthorize("@ss.hasPermi('jxjs:jdx:edit')") @Log(title = "基地校", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody TsbzJdx tsbzJdx) - { + public AjaxResult edit(@RequestBody TsbzJdx tsbzJdx) { + //创建dept实例 并且向要添加的dept中设置各个参数 + SysDept dept = new SysDept(); + //设置schoolID为xxdm + dept.setSchoolid(tsbzJdx.getId()); + dept = deptService.selectDeptList(dept).get(0); + dept.setDeptName(tsbzJdx.getJdxmc()); + dept.setUpdateBy(SecurityUtils.getLoginUser().getUser().getUserName()); + deptService.updateDept(dept); return toAjax(tsbzJdxService.updateTsbzJdx(tsbzJdx)); } @@ -100,9 +121,18 @@ public class TsbzJdxController extends BaseController */ @PreAuthorize("@ss.hasPermi('jxjs:jdx:remove')") @Log(title = "基地校", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable String[] ids) - { + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) { + TsbzJxjsjbxx tsbzJxjsjbxx = null; + //判断当前基地校是否已分配学生 + for (int i = 0; i < ids.length; i++) { + tsbzJxjsjbxx = new TsbzJxjsjbxx(); + tsbzJxjsjbxx.setJdxid(ids[i]); + List list = tsbzJxjsjbxxService.selectTsbzJxjsjbxxList(tsbzJxjsjbxx); + if (list != null && list.size() > 0) { + return AjaxResult.error("当前基地校已分配见习教师,无法删除"); + } + } return toAjax(tsbzJdxService.deleteTsbzJdxByIds(ids)); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index 423ef6852..01512950d 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -5,198 +5,212 @@ import java.util.List; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; + import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.domain.BaseEntity; /** * 部门表 sys_dept - * + * * @author ruoyi */ -public class SysDept extends BaseEntity -{ +public class SysDept extends BaseEntity { private static final long serialVersionUID = 1L; - /** 部门ID */ + /** + * 部门ID + */ private Long deptId; - /** 父部门ID */ + /** + * 父部门ID + */ private Long parentId; - /** 祖级列表 */ + /** + * 祖级列表 + */ private String ancestors; - /** 部门名称 */ + /** + * 部门名称 + */ private String deptName; - /** 显示顺序 */ + /** + * 显示顺序 + */ private String orderNum; - /** 负责人 */ + /** + * 负责人 + */ private String leader; - /** 联系电话 */ + /** + * 联系电话 + */ private String phone; - /** 邮箱 */ + /** + * 邮箱 + */ private String email; - /** 部门状态:0正常,1停用 */ + /** + * 部门状态:0正常,1停用 + */ private String status; - /** 删除标志(0代表存在 2代表删除) */ + /** + * 删除标志(0代表存在 2代表删除) + */ private String delFlag; - /** 父部门名称 */ + /** + * 父部门名称 + */ private String parentName; - - /** 子部门 */ + + /** + * 学校id + */ + private String schoolid; + + /** + * 子部门 + */ private List children = new ArrayList(); - public Long getDeptId() - { + public Long getDeptId() { return deptId; } - public void setDeptId(Long deptId) - { + public void setDeptId(Long deptId) { this.deptId = deptId; } - public Long getParentId() - { + public Long getParentId() { return parentId; } - public void setParentId(Long parentId) - { + public void setParentId(Long parentId) { this.parentId = parentId; } - public String getAncestors() - { + public String getAncestors() { return ancestors; } - public void setAncestors(String ancestors) - { + public void setAncestors(String ancestors) { this.ancestors = ancestors; } @NotBlank(message = "部门名称不能为空") @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") - public String getDeptName() - { + public String getDeptName() { return deptName; } - public void setDeptName(String deptName) - { + public void setDeptName(String deptName) { this.deptName = deptName; } @NotBlank(message = "显示顺序不能为空") - public String getOrderNum() - { + public String getOrderNum() { return orderNum; } - public void setOrderNum(String orderNum) - { + public void setOrderNum(String orderNum) { this.orderNum = orderNum; } - public String getLeader() - { + public String getLeader() { return leader; } - public void setLeader(String leader) - { + public void setLeader(String leader) { this.leader = leader; } @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") - public String getPhone() - { + public String getPhone() { return phone; } - public void setPhone(String phone) - { + public void setPhone(String phone) { this.phone = phone; } @Email(message = "邮箱格式不正确") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") - public String getEmail() - { + public String getEmail() { return email; } - public void setEmail(String email) - { + public void setEmail(String email) { this.email = email; } - public String getStatus() - { + public String getStatus() { return status; } - public void setStatus(String status) - { + public void setStatus(String status) { this.status = status; } - public String getDelFlag() - { + public String getDelFlag() { return delFlag; } - public void setDelFlag(String delFlag) - { + public void setDelFlag(String delFlag) { this.delFlag = delFlag; } - public String getParentName() - { + public String getParentName() { return parentName; } - public void setParentName(String parentName) - { + public void setParentName(String parentName) { this.parentName = parentName; } - public List getChildren() - { + public List getChildren() { return children; } - public void setChildren(List children) - { + public void setChildren(List children) { this.children = children; } + public void setSchoolid(String schoolid) { + this.schoolid = schoolid; + } + + public String getSchoolid() { + return schoolid; + } + @Override public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("deptId", getDeptId()) - .append("parentId", getParentId()) - .append("ancestors", getAncestors()) - .append("deptName", getDeptName()) - .append("orderNum", getOrderNum()) - .append("leader", getLeader()) - .append("phone", getPhone()) - .append("email", getEmail()) - .append("status", getStatus()) - .append("delFlag", getDelFlag()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .toString(); + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("deptId", getDeptId()) + .append("parentId", getParentId()) + .append("ancestors", getAncestors()) + .append("deptName", getDeptName()) + .append("orderNum", getOrderNum()) + .append("leader", getLeader()) + .append("phone", getPhone()) + .append("email", getEmail()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("schoolid", getSchoolid()) + .toString(); } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 36c2aa564..cb4f5c09d 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -1,49 +1,50 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - - - select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time + + + + + + + + + + + + + + + + + + + + + select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time , schoolid from sys_dept d - - where d.del_flag = '0' - AND parent_id = #{parentId} - - - AND dept_name like concat('%', #{deptName}, '%') - - - AND status = #{status} - - - ${params.dataScope} - order by d.parent_id, d.order_num + AND parent_id = #{parentId} + + + AND dept_name like concat('%', #{deptName}, '%') + + + AND status = #{status} + + + ${params.dataScope} + order by d.parent_id, d.order_num - + - + - + + where dept_id = #{deptId} + + - - select count(1) from sys_dept where del_flag = '0' and parent_id = #{deptId} limit 1 - - select * from sys_dept where find_in_set(#{deptId}, ancestors) - - select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors) - - - + + + - insert into sys_dept( - dept_id, - parent_id, - dept_name, - ancestors, - order_num, - leader, - phone, - email, - status, - create_by, - create_time - )values( - #{deptId}, - #{parentId}, - #{deptName}, - #{ancestors}, - #{orderNum}, - #{leader}, - #{phone}, - #{email}, - #{status}, - #{createBy}, - sysdate() - ) - - - - update sys_dept - - parent_id = #{parentId}, - dept_name = #{deptName}, - ancestors = #{ancestors}, - order_num = #{orderNum}, - leader = #{leader}, - phone = #{phone}, - email = #{email}, - status = #{status}, - update_by = #{updateBy}, - update_time = sysdate() - - where dept_id = #{deptId} - - - - update sys_dept set ancestors = - - when #{item.deptId} then #{item.ancestors} - - where dept_id in - - #{item.deptId} - - - - - update sys_dept - - status = #{status}, - update_by = #{updateBy}, - update_time = sysdate() + insert into sys_dept( + dept_id, + parent_id, + dept_name, + ancestors, + order_num, + leader, + phone, + email, + status, + create_by, + schoolid, + create_time + )values( + #{deptId}, + #{parentId}, + #{deptName}, + #{ancestors}, + #{orderNum}, + #{leader}, + #{phone}, + #{email}, + #{status}, + #{createBy}, + #{schoolid}, + sysdate() + ) + + + + update sys_dept + + parent_id = #{parentId}, + dept_name = #{deptName}, + ancestors = #{ancestors}, + order_num = #{orderNum}, + leader = #{leader}, + phone = #{phone}, + email = #{email}, + status = #{status}, + update_by = #{updateBy}, + schoolid = #{schoolid}, + update_time = sysdate() - where dept_id in (${ancestors}) - - - + where dept_id = #{deptId} + + + + update sys_dept set ancestors = + + when #{item.deptId} then #{item.ancestors} + + where dept_id in + + #{item.deptId} + + + + + update sys_dept + + status = #{status}, + update_by = #{updateBy}, + update_time = sysdate() + + where dept_id in (${ancestors}) + + + update sys_dept set del_flag = '2' where dept_id = #{deptId} diff --git a/ruoyi-ui/src/views/jxjs/jdx/index.vue b/ruoyi-ui/src/views/jxjs/jdx/index.vue index 1982a0c11..94ca103ff 100644 --- a/ruoyi-ui/src/views/jxjs/jdx/index.vue +++ b/ruoyi-ui/src/views/jxjs/jdx/index.vue @@ -425,7 +425,7 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const ids = row.id || this.ids; - this.$confirm('是否确认删除基地校编号为"' + ids + '"的数据项?', "警告", { + this.$confirm('是否确认删除基地校数据项?', "警告", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", diff --git a/ruoyi-ui/src/views/jxjs/jxjsjbxx/index.vue b/ruoyi-ui/src/views/jxjs/jxjsjbxx/index.vue index 880eb8b42..76a2b75fb 100644 --- a/ruoyi-ui/src/views/jxjs/jxjsjbxx/index.vue +++ b/ruoyi-ui/src/views/jxjs/jxjsjbxx/index.vue @@ -1,6 +1,12 @@ - + - - + placeholder="选择出生日期" + > - + @@ -384,7 +384,13 @@ diff --git a/ruoyi-ui/src/views/jxzxkhgl/jxzxkhfa/index.vue b/ruoyi-ui/src/views/jxzxkhgl/jxzxkhfa/index.vue index b386da17a..6e101adb2 100644 --- a/ruoyi-ui/src/views/jxzxkhgl/jxzxkhfa/index.vue +++ b/ruoyi-ui/src/views/jxzxkhgl/jxzxkhfa/index.vue @@ -293,11 +293,8 @@ export default { endtime: [ { required: true, message: "考核结束时间不能为空", trigger: "blur" }, ], - filename: [ - { required: true, message: "考核文件名称不能为空", trigger: "blur" }, - ], filepath: [ - { required: true, message: "文件路径不能为空", trigger: "blur" }, + { required: true, message: "文件不能为空", trigger: "blur" }, ], khnf: [ { required: true, message: "考核年份不能为空", trigger: "blur" }, diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index ae2aaaa82..30f9f5562 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -56,22 +56,24 @@ \ No newline at end of file