20200407-lc-1

This commit is contained in:
sk1551 2020-04-15 18:02:55 +08:00
parent 64a6caf923
commit d56ad93516
9 changed files with 1002 additions and 892 deletions

View File

@ -88,7 +88,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 +143,13 @@
</template> </template>
<script> <script>
import { listDept, getDept, delDept, addDept, updateDept } from "@/api/system/dept"; import {
listDept,
getDept,
delDept,
addDept,
updateDept
} 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";
@ -162,7 +173,8 @@ export default {
// //
queryParams: { queryParams: {
deptName: undefined, deptName: undefined,
status: undefined status: undefined,
schoolId: undefined
}, },
// //
form: {}, form: {},
@ -245,7 +257,8 @@ export default {
leader: undefined, leader: undefined,
phone: undefined, phone: undefined,
email: undefined, email: undefined,
status: "0" status: "0",
schoolId: undefined
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -303,16 +316,23 @@ 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() {});
} }
} }
}; };

View File

@ -206,7 +206,7 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="幼儿园规模" prop="scale"> <el-form-item label="幼儿园规模" prop="scale">
<el-select v-model="form.scale" placeholder="请选择"> <el-select v-model="form.scale">
<el-option <el-option
v-for="dict in scaleOptions" v-for="dict in scaleOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -334,6 +334,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
xxdm: undefined,
schoolName: undefined, schoolName: undefined,
nameShort: undefined, nameShort: undefined,
type: undefined, type: undefined,
@ -428,6 +429,7 @@ export default {
reset() { reset() {
this.form = { this.form = {
id: undefined, id: undefined,
xxdm: undefined,
schoolName: undefined, schoolName: undefined,
nameShort: undefined, nameShort: undefined,
type: "1", type: "1",

View File

@ -3,6 +3,10 @@ package com.ruoyi.framework.web.controller;
import java.beans.PropertyEditorSupport; import java.beans.PropertyEditorSupport;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID;
import com.ruoyi.project.system.domain.BySchool;
import com.ruoyi.project.system.domain.SysDept;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
@ -27,6 +31,11 @@ public class BaseController
{ {
protected final Logger logger = LoggerFactory.getLogger(BaseController.class); protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
public static String getUUID32()
{
return UUID.randomUUID().toString().replace("-", "").toLowerCase();
}
/** /**
* 将前台传递过来的日期格式的字符串自动转化为Date类型 * 将前台传递过来的日期格式的字符串自动转化为Date类型
*/ */

View File

@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.system.service.ISysDeptService;
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;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -22,6 +23,7 @@ import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo; import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysDept;
/** /**
* 幼儿园机构Controller * 幼儿园机构Controller
@ -36,6 +38,11 @@ public class BySchoolController extends BaseController
@Autowired @Autowired
private IBySchoolService bySchoolService; private IBySchoolService bySchoolService;
@Autowired
private ISysDeptService deptService;
/** /**
* 查询幼儿园机构列表 * 查询幼儿园机构列表
*/ */
@ -79,9 +86,27 @@ public class BySchoolController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody BySchool bySchool) public AjaxResult add(@RequestBody BySchool bySchool)
{ {
String uuid = getUUID32();
//将UUID赋值给xxdm
bySchool.setXxdm(uuid);
bySchool.setCreateUser(SecurityUtils.getLoginUser().getUser().getUserId()); bySchool.setCreateUser(SecurityUtils.getLoginUser().getUser().getUserId());
bySchool.setApprovalUser(SecurityUtils.getLoginUser().getUser().getUserId()); bySchool.setApprovalUser(SecurityUtils.getLoginUser().getUser().getUserId());
bySchool.setCreateTime(new Date()); bySchool.setCreateTime(new Date());
//bySchoolService.insertBySchool(bySchool);
SysDept dept = new SysDept();
dept.setSchoolId(bySchool.getXxdm());
dept.setCreateBy(SecurityUtils.getUsername());
//dept.setDeptId(bySchool.getDept().getDeptId());
dept.setParentId(200L);
dept.setAncestors("0,100,200");
dept.setDeptName(bySchool.getSchoolName());
//dept.setPhone(bySchool.getTel());
//dept.setOrderNum(String.valueOf(bySchool.getId()));
dept.setLeader(SecurityUtils.getUsername());
deptService.insertDept(dept);
return toAjax(bySchoolService.insertBySchool(bySchool)); return toAjax(bySchoolService.insertBySchool(bySchool));
} }

View File

@ -1,6 +1,8 @@
package com.ruoyi.project.system.controller; package com.ruoyi.project.system.controller;
import java.util.List; import java.util.List;
import com.ruoyi.project.system.service.IBySchoolService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -33,6 +35,7 @@ public class SysDeptController extends BaseController
@Autowired @Autowired
private ISysDeptService deptService; private ISysDeptService deptService;
/** /**
* 获取部门列表 * 获取部门列表
*/ */

View File

@ -19,6 +19,9 @@ public class BySchool extends BaseEntity
/** 幼儿园ID */ /** 幼儿园ID */
private Long id; private Long id;
// 学校代码与dept相关联
private String xxdm;
/** 机构名称 */ /** 机构名称 */
@Excel(name = "机构名称") @Excel(name = "机构名称")
private String schoolName; private String schoolName;
@ -131,6 +134,17 @@ public class BySchool extends BaseEntity
@Excel(name = "当前学期") @Excel(name = "当前学期")
private String dqxq; private String dqxq;
//部门
private SysDept dept;
public SysDept getDept() {
return dept;
}
public void setDept(SysDept dept) {
this.dept = dept;
}
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
@ -393,10 +407,21 @@ public class BySchool extends BaseEntity
return dqxq; return dqxq;
} }
public String getXxdm() {
return xxdm;
}
public void setXxdm(String xxdm) {
this.xxdm = xxdm;
}
@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("id", getId()) .append("id", getId())
.append("xxdm",getXxdm())
.append("schoolName", getSchoolName()) .append("schoolName", getSchoolName())
.append("nameShort", getNameShort()) .append("nameShort", getNameShort())
.append("type", getType()) .append("type", getType())
@ -427,6 +452,9 @@ public class BySchool extends BaseEntity
.append("openDeadline", getOpenDeadline()) .append("openDeadline", getOpenDeadline())
.append("dqxn", getDqxn()) .append("dqxn", getDqxn())
.append("dqxq", getDqxq()) .append("dqxq", getDqxq())
.append("dept", getDept())
.toString(); .toString();
} }
} }

View File

@ -54,6 +54,17 @@ public class SysDept extends BaseEntity
/** 子部门 */ /** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>(); private List<SysDept> children = new ArrayList<SysDept>();
/** 学校ID与school表关联 */
private String schoolId;
public String getSchoolId() {
return schoolId;
}
public void setSchoolId(String schoolId) {
this.schoolId = schoolId;
}
public Long getDeptId() public Long getDeptId()
{ {
return deptId; return deptId;
@ -197,6 +208,9 @@ public class SysDept extends BaseEntity
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("school_id", getSchoolId())
.toString(); .toString();
} }
} }

View File

@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="BySchool" id="BySchoolResult"> <resultMap type="BySchool" id="BySchoolResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="xxdm" column="xxdm" />
<result property="schoolName" column="school_name" /> <result property="schoolName" column="school_name" />
<result property="nameShort" column="name_short" /> <result property="nameShort" column="name_short" />
<result property="type" column="type" /> <result property="type" column="type" />
@ -39,12 +40,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectBySchoolVo"> <sql id="selectBySchoolVo">
select id, school_name, name_short, type, parent_id, province, provincename, regionid, regionname, area, areaname, address, mastername, tel, em_man, em_tel, status, scale, create_time, create_user, approval_user, approval_time, remark, location, is_demonstr, businesslicenseimg, open_book, fee_status, open_deadline, dqxn, dqxq from by_school select id, xxdm, school_name, name_short, type, parent_id, province, provincename, regionid, regionname, area, areaname, address, mastername, tel, em_man, em_tel, status, scale, create_time, create_user, approval_user, approval_time, remark, location, is_demonstr, businesslicenseimg, open_book, fee_status, open_deadline, dqxn, dqxq from by_school
</sql> </sql>
<select id="selectBySchoolList" parameterType="BySchool" resultMap="BySchoolResult"> <select id="selectBySchoolList" parameterType="BySchool" resultMap="BySchoolResult">
<include refid="selectBySchoolVo"/> <include refid="selectBySchoolVo"/>
<where> <where>
<if test="xxdm != null and xxdm != ''"> and xxdm like concat('%', #{xxdm}, '%')</if>
<if test="schoolName != null and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if> <if test="schoolName != null and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
<if test="nameShort != null and nameShort != ''"> and name_short = #{nameShort}</if> <if test="nameShort != null and nameShort != ''"> and name_short = #{nameShort}</if>
<if test="type != null "> and type = #{type}</if> <if test="type != null "> and type = #{type}</if>
@ -84,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertBySchool" parameterType="BySchool" useGeneratedKeys="true" keyProperty="id"> <insert id="insertBySchool" parameterType="BySchool" useGeneratedKeys="true" keyProperty="id">
insert into by_school insert into by_school
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="xxdm != null and xxdm != ''">xxdm,</if>
<if test="schoolName != null and schoolName != ''">school_name,</if> <if test="schoolName != null and schoolName != ''">school_name,</if>
<if test="nameShort != null and nameShort != ''">name_short,</if> <if test="nameShort != null and nameShort != ''">name_short,</if>
<if test="type != null ">type,</if> <if test="type != null ">type,</if>
@ -116,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dqxq != null and dqxq != ''">dqxq,</if> <if test="dqxq != null and dqxq != ''">dqxq,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="xxdm != null and xxdm != ''">#{xxdm},</if>
<if test="schoolName != null and schoolName != ''">#{schoolName},</if> <if test="schoolName != null and schoolName != ''">#{schoolName},</if>
<if test="nameShort != null and nameShort != ''">#{nameShort},</if> <if test="nameShort != null and nameShort != ''">#{nameShort},</if>
<if test="type != null ">#{type},</if> <if test="type != null ">#{type},</if>
@ -152,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateBySchool" parameterType="BySchool"> <update id="updateBySchool" parameterType="BySchool">
update by_school update by_school
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="xxdm != null and schoolName != ''">xxdm = #{xxdm},</if>
<if test="schoolName != null and schoolName != ''">school_name = #{schoolName},</if> <if test="schoolName != null and schoolName != ''">school_name = #{schoolName},</if>
<if test="nameShort != null and nameShort != ''">name_short = #{nameShort},</if> <if test="nameShort != null and nameShort != ''">name_short = #{nameShort},</if>
<if test="type != null ">type = #{type},</if> <if test="type != null ">type = #{type},</if>

View File

@ -20,10 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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" />
<result property="schoolId" column="school_id" />
</resultMap> </resultMap>
<sql id="selectDeptVo"> <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 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, d.school_id
from sys_dept d from sys_dept d
</sql> </sql>
@ -88,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>
<if test="schoolId != null and schoolId != ''">school_id,</if>
create_time create_time
)values( )values(
<if test="deptId != null and deptId != 0">#{deptId},</if> <if test="deptId != null and deptId != 0">#{deptId},</if>
@ -100,6 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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 != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="schoolId != null and schoolId != ''">#{schoolId},</if>
sysdate() sysdate()
) )
</insert> </insert>
@ -116,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">email = #{email},</if> <if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if> <if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="schoolId != null and schoolId != ''">school_id = #{schoolId},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where dept_id = #{deptId} where dept_id = #{deptId}