基地校优化

This commit is contained in:
paidaxing444
2020-09-04 11:57:14 +08:00
parent d0c0116e6f
commit a295566e3d
7 changed files with 390 additions and 329 deletions

View File

@ -2,6 +2,11 @@ package com.ruoyi.web.controller.jxjs;
import java.util.List; 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 com.ruoyi.web.controller.common.SchoolCommonController;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -24,26 +29,28 @@ import com.ruoyi.common.core.page.TableDataInfo;
/** /**
* 基地校Controller * 基地校Controller
* *
* @author ruoyi * @author ruoyi
* @date 2020-08-20 * @date 2020-08-20
*/ */
@RestController @RestController
@RequestMapping("/jxjs/jdx") @RequestMapping("/jxjs/jdx")
public class TsbzJdxController extends BaseController public class TsbzJdxController extends BaseController {
{
@Autowired @Autowired
private ITsbzJdxService tsbzJdxService; private ITsbzJdxService tsbzJdxService;
@Autowired @Autowired
private SchoolCommonController schoolCommonController; private SchoolCommonController schoolCommonController;
@Autowired
private ITsbzJxjsjbxxService tsbzJxjsjbxxService;
@Autowired
private ISysDeptService deptService;
/** /**
* 查询基地校列表 * 查询基地校列表
*/ */
@PreAuthorize("@ss.hasPermi('jxjs:jdx:list')") @PreAuthorize("@ss.hasPermi('jxjs:jdx:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(TsbzJdx tsbzJdx) public TableDataInfo list(TsbzJdx tsbzJdx) {
{
startPage(); startPage();
List<TsbzJdx> list = tsbzJdxService.selectTsbzJdxList(tsbzJdx); List<TsbzJdx> list = tsbzJdxService.selectTsbzJdxList(tsbzJdx);
return getDataTable(list); return getDataTable(list);
@ -55,8 +62,7 @@ public class TsbzJdxController extends BaseController
@PreAuthorize("@ss.hasPermi('jxjs:jdx:export')") @PreAuthorize("@ss.hasPermi('jxjs:jdx:export')")
@Log(title = "基地校", businessType = BusinessType.EXPORT) @Log(title = "基地校", businessType = BusinessType.EXPORT)
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(TsbzJdx tsbzJdx) public AjaxResult export(TsbzJdx tsbzJdx) {
{
List<TsbzJdx> list = tsbzJdxService.selectTsbzJdxList(tsbzJdx); List<TsbzJdx> list = tsbzJdxService.selectTsbzJdxList(tsbzJdx);
ExcelUtil<TsbzJdx> util = new ExcelUtil<TsbzJdx>(TsbzJdx.class); ExcelUtil<TsbzJdx> util = new ExcelUtil<TsbzJdx>(TsbzJdx.class);
return util.exportExcel(list, "jdx"); return util.exportExcel(list, "jdx");
@ -67,8 +73,7 @@ public class TsbzJdxController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('jxjs:jdx:query')") @PreAuthorize("@ss.hasPermi('jxjs:jdx:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) public AjaxResult getInfo(@PathVariable("id") String id) {
{
return AjaxResult.success(tsbzJdxService.selectTsbzJdxById(id)); return AjaxResult.success(tsbzJdxService.selectTsbzJdxById(id));
} }
@ -78,9 +83,18 @@ public class TsbzJdxController extends BaseController
@PreAuthorize("@ss.hasPermi('jxjs:jdx:add')") @PreAuthorize("@ss.hasPermi('jxjs:jdx:add')")
@Log(title = "基地校", businessType = BusinessType.INSERT) @Log(title = "基地校", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody TsbzJdx tsbzJdx) public AjaxResult add(@RequestBody TsbzJdx tsbzJdx) {
{ String uuid = schoolCommonController.getUuid();
tsbzJdx.setId(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)); return toAjax(tsbzJdxService.insertTsbzJdx(tsbzJdx));
} }
@ -90,8 +104,15 @@ public class TsbzJdxController extends BaseController
@PreAuthorize("@ss.hasPermi('jxjs:jdx:edit')") @PreAuthorize("@ss.hasPermi('jxjs:jdx:edit')")
@Log(title = "基地校", businessType = BusinessType.UPDATE) @Log(title = "基地校", businessType = BusinessType.UPDATE)
@PutMapping @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)); return toAjax(tsbzJdxService.updateTsbzJdx(tsbzJdx));
} }
@ -100,9 +121,18 @@ public class TsbzJdxController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('jxjs:jdx:remove')") @PreAuthorize("@ss.hasPermi('jxjs:jdx:remove')")
@Log(title = "基地校", businessType = BusinessType.DELETE) @Log(title = "基地校", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] 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<TsbzJxjsjbxx> list = tsbzJxjsjbxxService.selectTsbzJxjsjbxxList(tsbzJxjsjbxx);
if (list != null && list.size() > 0) {
return AjaxResult.error("当前基地校已分配见习教师,无法删除");
}
}
return toAjax(tsbzJdxService.deleteTsbzJdxByIds(ids)); return toAjax(tsbzJdxService.deleteTsbzJdxByIds(ids));
} }
} }

View File

@ -5,198 +5,212 @@ import java.util.List;
import javax.validation.constraints.Email; import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* 部门表 sys_dept * 部门表 sys_dept
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysDept extends BaseEntity public class SysDept extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 部门ID */ /**
* 部门ID
*/
private Long deptId; private Long deptId;
/** 父部门ID */ /**
* 父部门ID
*/
private Long parentId; private Long parentId;
/** 祖级列表 */ /**
* 祖级列表
*/
private String ancestors; private String ancestors;
/** 部门名称 */ /**
* 部门名称
*/
private String deptName; private String deptName;
/** 显示顺序 */ /**
* 显示顺序
*/
private String orderNum; private String orderNum;
/** 负责人 */ /**
* 负责人
*/
private String leader; private String leader;
/** 联系电话 */ /**
* 联系电话
*/
private String phone; private String phone;
/** 邮箱 */ /**
* 邮箱
*/
private String email; private String email;
/** 部门状态:0正常,1停用 */ /**
* 部门状态:0正常,1停用
*/
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /**
* 删除标志0代表存在 2代表删除
*/
private String delFlag; private String delFlag;
/** 父部门名称 */ /**
* 父部门名称
*/
private String parentName; private String parentName;
/** 子部门 */ /**
* 学校id
*/
private String schoolid;
/**
* 子部门
*/
private List<SysDept> children = new ArrayList<SysDept>(); private List<SysDept> children = new ArrayList<SysDept>();
public Long getDeptId() public Long getDeptId() {
{
return deptId; return deptId;
} }
public void setDeptId(Long deptId) public void setDeptId(Long deptId) {
{
this.deptId = deptId; this.deptId = deptId;
} }
public Long getParentId() public Long getParentId() {
{
return parentId; return parentId;
} }
public void setParentId(Long parentId) public void setParentId(Long parentId) {
{
this.parentId = parentId; this.parentId = parentId;
} }
public String getAncestors() public String getAncestors() {
{
return ancestors; return ancestors;
} }
public void setAncestors(String ancestors) public void setAncestors(String ancestors) {
{
this.ancestors = ancestors; this.ancestors = ancestors;
} }
@NotBlank(message = "部门名称不能为空") @NotBlank(message = "部门名称不能为空")
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
public String getDeptName() public String getDeptName() {
{
return deptName; return deptName;
} }
public void setDeptName(String deptName) public void setDeptName(String deptName) {
{
this.deptName = deptName; this.deptName = deptName;
} }
@NotBlank(message = "显示顺序不能为空") @NotBlank(message = "显示顺序不能为空")
public String getOrderNum() public String getOrderNum() {
{
return orderNum; return orderNum;
} }
public void setOrderNum(String orderNum) public void setOrderNum(String orderNum) {
{
this.orderNum = orderNum; this.orderNum = orderNum;
} }
public String getLeader() public String getLeader() {
{
return leader; return leader;
} }
public void setLeader(String leader) public void setLeader(String leader) {
{
this.leader = leader; this.leader = leader;
} }
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
public String getPhone() public String getPhone() {
{
return phone; return phone;
} }
public void setPhone(String phone) public void setPhone(String phone) {
{
this.phone = phone; this.phone = phone;
} }
@Email(message = "邮箱格式不正确") @Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() public String getEmail() {
{
return email; return email;
} }
public void setEmail(String email) public void setEmail(String email) {
{
this.email = email; this.email = email;
} }
public String getStatus() public String getStatus() {
{
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status) {
{
this.status = status; this.status = status;
} }
public String getDelFlag() public String getDelFlag() {
{
return delFlag; return delFlag;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag) {
{
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getParentName() public String getParentName() {
{
return parentName; return parentName;
} }
public void setParentName(String parentName) public void setParentName(String parentName) {
{
this.parentName = parentName; this.parentName = parentName;
} }
public List<SysDept> getChildren() public List<SysDept> getChildren() {
{
return children; return children;
} }
public void setChildren(List<SysDept> children) public void setChildren(List<SysDept> children) {
{
this.children = children; this.children = children;
} }
public void setSchoolid(String schoolid) {
this.schoolid = schoolid;
}
public String getSchoolid() {
return schoolid;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deptId", getDeptId()) .append("deptId", getDeptId())
.append("parentId", getParentId()) .append("parentId", getParentId())
.append("ancestors", getAncestors()) .append("ancestors", getAncestors())
.append("deptName", getDeptName()) .append("deptName", getDeptName())
.append("orderNum", getOrderNum()) .append("orderNum", getOrderNum())
.append("leader", getLeader()) .append("leader", getLeader())
.append("phone", getPhone()) .append("phone", getPhone())
.append("email", getEmail()) .append("email", getEmail())
.append("status", getStatus()) .append("status", getStatus())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.toString(); .append("schoolid", getSchoolid())
.toString();
} }
} }

View File

@ -1,49 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysDeptMapper"> <mapper namespace="com.ruoyi.system.mapper.SysDeptMapper">
<resultMap type="SysDept" id="SysDeptResult"> <resultMap type="SysDept" id="SysDeptResult">
<id property="deptId" column="dept_id" /> <id property="deptId" column="dept_id"/>
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors" /> <result property="ancestors" column="ancestors"/>
<result property="deptName" column="dept_name" /> <result property="deptName" column="dept_name"/>
<result property="orderNum" column="order_num" /> <result property="orderNum" column="order_num"/>
<result property="leader" column="leader" /> <result property="leader" column="leader"/>
<result property="phone" column="phone" /> <result property="phone" column="phone"/>
<result property="email" column="email" /> <result property="email" column="email"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag"/>
<result property="parentName" column="parent_name" /> <result property="parentName" column="parent_name"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
</resultMap> <result property="schoolid" column="schoolid"/>
</resultMap>
<sql id="selectDeptVo">
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 <sql id="selectDeptVo">
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 from sys_dept d
</sql> </sql>
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult"> <select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where d.del_flag = '0' where d.del_flag = '0'
<if test="parentId != null and parentId != 0"> <if test="parentId != null and parentId != 0">
AND parent_id = #{parentId} AND parent_id = #{parentId}
</if> </if>
<if test="deptName != null and deptName != ''"> <if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%') AND dept_name like concat('%', #{deptName}, '%')
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND status = #{status}
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
</select> </select>
<select id="selectDeptListByRoleId" parameterType="Long" resultType="Integer"> <select id="selectDeptListByRoleId" parameterType="Long" resultType="Integer">
select d.dept_id, d.parent_id select d.dept_id, d.parent_id
from sys_dept d from sys_dept d
@ -52,103 +53,106 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId}) and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
</select> </select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult"> <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where dept_id = #{deptId} where dept_id = #{deptId}
</select> </select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int"> <select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0' select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
</select> </select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int"> <select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept select count(1) from sys_dept
where del_flag = '0' and parent_id = #{deptId} limit 1 where del_flag = '0' and parent_id = #{deptId} limit 1
</select> </select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult"> <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{deptId}, ancestors) select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select> </select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int"> <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors) select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select> </select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult"> <select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} limit 1 where dept_name=#{deptName} and parent_id = #{parentId} limit 1
</select> </select>
<insert id="insertDept" parameterType="SysDept"> <insert id="insertDept" parameterType="SysDept">
insert into sys_dept( insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if> <if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if> <if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if> <if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if> <if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null and orderNum != ''">order_num,</if> <if test="orderNum != null and orderNum != ''">order_num,</if>
<if test="leader != null and leader != ''">leader,</if> <if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if> <if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if> <if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time <if test="schoolid != null">schoolid,</if>
)values( create_time
<if test="deptId != null and deptId != 0">#{deptId},</if> )values(
<if test="parentId != null and parentId != 0">#{parentId},</if> <if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if> <if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if> <if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="orderNum != null and orderNum != ''">#{orderNum},</if> <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="leader != null and leader != ''">#{leader},</if> <if test="orderNum != null and orderNum != ''">#{orderNum},</if>
<if test="phone != null and phone != ''">#{phone},</if> <if test="leader != null and leader != ''">#{leader},</if>
<if test="email != null and email != ''">#{email},</if> <if test="phone != null and phone != ''">#{phone},</if>
<if test="status != null">#{status},</if> <if test="email != null and email != ''">#{email},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="status != null">#{status},</if>
sysdate() <if test="createBy != null and createBy != ''">#{createBy},</if>
) <if test="schoolid != null">#{schoolid},</if>
</insert> sysdate()
)
<update id="updateDept" parameterType="SysDept"> </insert>
update sys_dept
<set> <update id="updateDept" parameterType="SysDept">
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if> update sys_dept
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if> <set>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if> <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if> <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="leader != null">leader = #{leader},</if> <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="phone != null">phone = #{phone},</if> <if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
<if test="email != null">email = #{email},</if> <if test="leader != null">leader = #{leader},</if>
<if test="status != null and status != ''">status = #{status},</if> <if test="phone != null">phone = #{phone},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="email != null">email = #{email},</if>
update_time = sysdate() <if test="status != null and status != ''">status = #{status},</if>
</set> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
where dept_id = #{deptId} <if test="schoolid != null">schoolid = #{schoolid},</if>
</update> update_time = sysdate()
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatus" parameterType="SysDept">
update sys_dept
<set>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set> </set>
where dept_id in (${ancestors}) where dept_id = #{deptId}
</update> </update>
<delete id="deleteDeptById" parameterType="Long"> <update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatus" parameterType="SysDept">
update sys_dept
<set>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dept_id in (${ancestors})
</update>
<delete id="deleteDeptById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{deptId} update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete> </delete>

View File

@ -425,7 +425,7 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$confirm('是否确认删除基地校编号为"' + ids + '"的数据项?', "警告", { this.$confirm('是否确认删除基地校数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning",

View File

@ -1,6 +1,12 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="姓名" prop="name"> <el-form-item label="姓名" prop="name">
<el-input <el-input
v-model="queryParams.name" v-model="queryParams.name"
@ -136,7 +142,7 @@
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> --> </el-form-item>-->
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -173,21 +179,12 @@
v-hasPermi="['jxjs:jxjsjbxx:remove']" v-hasPermi="['jxjs:jxjsjbxx:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['jxjs:jxjsjbxx:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="jxjsjbxxList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="jxjsjbxxList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" /> <!-- <el-table-column label="编号" align="center" prop="id" /> -->
<el-table-column label="姓名" align="center" prop="name" /> <el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="性别" align="center" prop="xb" :formatter="xbFormat" /> <el-table-column label="性别" align="center" prop="xb" :formatter="xbFormat" />
<el-table-column label="政治面貌" align="center" prop="zzmm" :formatter="zzmmFormat" /> <el-table-column label="政治面貌" align="center" prop="zzmm" :formatter="zzmmFormat" />
@ -227,7 +224,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
@ -256,18 +253,21 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="出生日期" prop="csrq"> <el-form-item label="出生日期" prop="csrq">
<el-date-picker clearable size="small" style="width: 200px" <el-date-picker
clearable
size="small"
style="width: 200px"
v-model="form.csrq" v-model="form.csrq"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择出生日期"> placeholder="选择出生日期"
</el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="电子邮件" prop="email"> <el-form-item label="电子邮件" prop="email">
<el-input v-model="form.email" placeholder="请输入电子邮件" /> <el-input v-model="form.email" placeholder="请输入电子邮件" />
</el-form-item> </el-form-item>
<el-form-item label="联系电话" prop="phone"> <el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11"/> <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
</el-form-item> </el-form-item>
<el-form-item label="邮编" prop="yzbm"> <el-form-item label="邮编" prop="yzbm">
<el-input v-model="form.yzbm" placeholder="请输入邮编" /> <el-input v-model="form.yzbm" placeholder="请输入邮编" />
@ -384,7 +384,13 @@
</template> </template>
<script> <script>
import { listJxjsjbxx, getJxjsjbxx, delJxjsjbxx, addJxjsjbxx, updateJxjsjbxx, exportJxjsjbxx } from "@/api/jxjs/jxjsjbxx"; import {
listJxjsjbxx,
getJxjsjbxx,
delJxjsjbxx,
addJxjsjbxx,
updateJxjsjbxx,
} from "@/api/jxjs/jxjsjbxx";
export default { export default {
name: "Jxjsjbxx", name: "Jxjsjbxx",
@ -464,49 +470,44 @@ export default {
jxbh: [ jxbh: [
{ required: true, message: "进修编号不能为空", trigger: "blur" }, { required: true, message: "进修编号不能为空", trigger: "blur" },
], ],
xb: [ xb: [{ required: true, message: "教师性别不能为空", trigger: "blur" }],
{ required: true, message: "教师性别不能为空", trigger: "blur" },
],
csrq: [ csrq: [
{ required: true, message: "出生日期不能为空", trigger: "blur" }, { required: true, message: "出生日期不能为空", trigger: "blur" },
], ],
phone: [ phone: [{ required: true, message: "电话不能为空", trigger: "blur" }],
{ required: true, message: "电话不能为空", trigger: "blur" }, },
],
}
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("sys_user_sex").then(response => { this.getDicts("sys_user_sex").then((response) => {
this.xbOptions = response.data; this.xbOptions = response.data;
}); });
this.getDicts("sys_dm_zzmm").then(response => { this.getDicts("sys_dm_zzmm").then((response) => {
this.zzmmOptions = response.data; this.zzmmOptions = response.data;
}); });
this.getDicts("sys_dm_mz").then(response => { this.getDicts("sys_dm_mz").then((response) => {
this.mzOptions = response.data; this.mzOptions = response.data;
}); });
this.getDicts("sys_dm_rjxd").then(response => { this.getDicts("sys_dm_rjxd").then((response) => {
this.rjxdOptions = response.data; this.rjxdOptions = response.data;
}); });
this.getDicts("sys_dm_rjxk").then(response => { this.getDicts("sys_dm_rjxk").then((response) => {
this.rjxkOptions = response.data; this.rjxkOptions = response.data;
}); });
this.getDicts("sys_dm_rjnj").then(response => { this.getDicts("sys_dm_rjnj").then((response) => {
this.rjnjOptions = response.data; this.rjnjOptions = response.data;
}); });
this.getDicts("sys_dm_xl").then(response => { this.getDicts("sys_dm_xl").then((response) => {
this.xlOptions = response.data; this.xlOptions = response.data;
}); });
this.getDicts("sys_dm_xw").then(response => { this.getDicts("sys_dm_xw").then((response) => {
this.xwOptions = response.data; this.xwOptions = response.data;
}); });
this.getDicts("sys_dm_sfsfs").then(response => { this.getDicts("sys_dm_sfsfs").then((response) => {
this.sfsfsOptions = response.data; this.sfsfsOptions = response.data;
}); });
this.getDicts("sys_dm_rxnf").then(response => { this.getDicts("sys_dm_rxnf").then((response) => {
this.lqnfOptions = response.data; this.lqnfOptions = response.data;
}); });
}, },
@ -514,7 +515,7 @@ export default {
/** 查询见习教师基本信息列表 */ /** 查询见习教师基本信息列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listJxjsjbxx(this.queryParams).then(response => { listJxjsjbxx(this.queryParams).then((response) => {
this.jxjsjbxxList = response.rows; this.jxjsjbxxList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -590,7 +591,7 @@ export default {
xw: null, xw: null,
sfsfs: null, sfsfs: null,
lqnf: null, lqnf: null,
createTime: null createTime: null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -606,9 +607,9 @@ export default {
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map((item) => item.id);
this.single = selection.length!==1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
@ -619,8 +620,8 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getJxjsjbxx(id).then(response => { getJxjsjbxx(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改见习教师基本信息"; this.title = "修改见习教师基本信息";
@ -628,10 +629,10 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateJxjsjbxx(this.form).then(response => { updateJxjsjbxx(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
@ -639,7 +640,7 @@ export default {
} }
}); });
} else { } else {
addJxjsjbxx(this.form).then(response => { addJxjsjbxx(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
@ -653,30 +654,24 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$confirm('是否确认删除见习教师基本信息编号为"' + ids + '"的数据项?', "警告", { this.$confirm(
'是否确认删除见习教师基本信息数据项?',
"警告",
{
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}).then(function() { }
)
.then(function () {
return delJxjsjbxx(ids); return delJxjsjbxx(ids);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(function() {}); })
.catch(function () {});
}, },
/** 导出按钮操作 */ },
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有见习教师基本信息数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportJxjsjbxx(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
}
}
}; };
</script> </script>

View File

@ -293,11 +293,8 @@ export default {
endtime: [ endtime: [
{ required: true, message: "考核结束时间不能为空", trigger: "blur" }, { required: true, message: "考核结束时间不能为空", trigger: "blur" },
], ],
filename: [
{ required: true, message: "考核文件名称不能为空", trigger: "blur" },
],
filepath: [ filepath: [
{ required: true, message: "文件路径不能为空", trigger: "blur" }, { required: true, message: "文件不能为空", trigger: "blur" },
], ],
khnf: [ khnf: [
{ required: true, message: "考核年份不能为空", trigger: "blur" }, { required: true, message: "考核年份不能为空", trigger: "blur" },

View File

@ -56,22 +56,24 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" v-if="!(scope.row.parentId==200)"
type="text" size="mini"
icon="el-icon-edit" type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:dept:edit']" v-hasPermi="['system:dept:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" v-if="!(scope.row.parentId==200)"
type="text" size="mini"
icon="el-icon-plus" type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)" @click="handleAdd(scope.row)"
v-hasPermi="['system:dept:add']" v-hasPermi="['system:dept:add']"
>新增</el-button> >新增</el-button>
<el-button <el-button
v-if="scope.row.parentId != 0" v-if="!(scope.row.parentId == 0)&&!(scope.row.parentId==200)"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@ -88,7 +90,12 @@
<el-row> <el-row>
<el-col :span="24" v-if="form.parentId !== 0"> <el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="上级部门" prop="parentId"> <el-form-item label="上级部门" prop="parentId">
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" /> <treeselect
v-model="form.parentId"
:options="deptOptions"
:normalizer="normalizer"
placeholder="选择上级部门"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -138,7 +145,14 @@
</template> </template>
<script> <script>
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; import {
listDept,
getDept,
delDept,
addDept,
updateDept,
listDeptExcludeChild,
} from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@ -164,41 +178,41 @@ export default {
// 查询参数 // 查询参数
queryParams: { queryParams: {
deptName: undefined, deptName: undefined,
status: undefined status: undefined,
}, },
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
parentId: [ parentId: [
{ required: true, message: "上级部门不能为空", trigger: "blur" } { required: true, message: "上级部门不能为空", trigger: "blur" },
], ],
deptName: [ deptName: [
{ required: true, message: "部门名称不能为空", trigger: "blur" } { required: true, message: "部门名称不能为空", trigger: "blur" },
], ],
orderNum: [ orderNum: [
{ required: true, message: "菜单顺序不能为空", trigger: "blur" } { required: true, message: "菜单顺序不能为空", trigger: "blur" },
], ],
email: [ email: [
{ {
type: "email", type: "email",
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
trigger: ["blur", "change"] trigger: ["blur", "change"],
} },
], ],
phone: [ phone: [
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码", message: "请输入正确的手机号码",
trigger: "blur" trigger: "blur",
} },
] ],
} },
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("sys_normal_disable").then(response => { this.getDicts("sys_normal_disable").then((response) => {
this.statusOptions = response.data; this.statusOptions = response.data;
}); });
}, },
@ -206,7 +220,7 @@ export default {
/** 查询部门列表 */ /** 查询部门列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listDept(this.queryParams).then(response => { listDept(this.queryParams).then((response) => {
this.deptList = this.handleTree(response.data, "deptId"); this.deptList = this.handleTree(response.data, "deptId");
this.loading = false; this.loading = false;
}); });
@ -219,7 +233,7 @@ export default {
return { return {
id: node.deptId, id: node.deptId,
label: node.deptName, label: node.deptName,
children: node.children children: node.children,
}; };
}, },
// 字典状态字典翻译 // 字典状态字典翻译
@ -241,7 +255,7 @@ export default {
leader: undefined, leader: undefined,
phone: undefined, phone: undefined,
email: undefined, email: undefined,
status: "0" status: "0",
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -262,28 +276,28 @@ export default {
} }
this.open = true; this.open = true;
this.title = "添加部门"; this.title = "添加部门";
listDept().then(response => { listDept().then((response) => {
this.deptOptions = this.handleTree(response.data, "deptId"); this.deptOptions = this.handleTree(response.data, "deptId");
}); });
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
getDept(row.deptId).then(response => { getDept(row.deptId).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改部门"; this.title = "修改部门";
}); });
listDeptExcludeChild(row.deptId).then(response => { listDeptExcludeChild(row.deptId).then((response) => {
this.deptOptions = this.handleTree(response.data, "deptId"); this.deptOptions = this.handleTree(response.data, "deptId");
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.deptId != undefined) { if (this.form.deptId != undefined) {
updateDept(this.form).then(response => { updateDept(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
@ -291,7 +305,7 @@ export default {
} }
}); });
} else { } else {
addDept(this.form).then(response => { addDept(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
@ -304,17 +318,24 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?', "警告", { this.$confirm(
'是否确认删除名称为"' + row.deptName + '"的数据项?',
"警告",
{
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}).then(function() { }
)
.then(function () {
return delDept(row.deptId); return delDept(row.deptId);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(function() {}); })
} .catch(function () {});
} },
},
}; };
</script> </script>