Merge remote-tracking branch 'origin/master'

This commit is contained in:
paidaxing444
2020-04-16 11:02:16 +08:00
10 changed files with 1331 additions and 1180 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

@ -188,7 +188,7 @@
<el-input v-model="form.mastername" placeholder="请输入联系人" /> <el-input v-model="form.mastername" placeholder="请输入联系人" />
</el-form-item> </el-form-item>
<el-form-item label="电话" prop="tel"> <el-form-item label="电话" prop="tel">
<el-input v-model="form.tel" placeholder="请输入电话" /> <el-input v-model="form.tel" placeholder="请输入电话" maxlength="11" />
</el-form-item> </el-form-item>
<el-form-item label="紧急联系人" prop="emMan"> <el-form-item label="紧急联系人" prop="emMan">
<el-input v-model="form.emMan" placeholder="请输入紧急联系人" /> <el-input v-model="form.emMan" placeholder="请输入紧急联系人" />
@ -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,
@ -369,7 +370,19 @@ export default {
// 表单校验 // 表单校验
rules: { rules: {
schoolName: [ schoolName: [
{ required: true, message: "机构名称不能为空", trigger: "blur" } {
required: true,
message: "机构名称不能为空",
trigger: "blur"
}
],
tel: [
{
required: true,
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
] ]
} }
}; };
@ -428,6 +441,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

@ -243,8 +243,13 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.5.RELEASE</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>

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,8 @@ 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.jdbc.core.JdbcTemplate;
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 +24,9 @@ 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;
import javax.annotation.Resource;
/** /**
* 幼儿园机构Controller * 幼儿园机构Controller
@ -29,6 +34,11 @@ import com.ruoyi.framework.web.page.TableDataInfo;
* @author tsbz * @author tsbz
* @date 2020-04-08 * @date 2020-04-08
*/ */
@RestController @RestController
@RequestMapping("/system/school") @RequestMapping("/system/school")
public class BySchoolController extends BaseController public class BySchoolController extends BaseController
@ -36,6 +46,11 @@ public class BySchoolController extends BaseController
@Autowired @Autowired
private IBySchoolService bySchoolService; private IBySchoolService bySchoolService;
@Autowired
private ISysDeptService deptService;
/** /**
* 查询幼儿园机构列表 * 查询幼儿园机构列表
*/ */
@ -71,17 +86,45 @@ public class BySchoolController extends BaseController
return AjaxResult.success(bySchoolService.selectBySchoolById(id)); return AjaxResult.success(bySchoolService.selectBySchoolById(id));
} }
/** /**
* 新增幼儿园机构 * 新增幼儿园机构
*/ */
//调取jdbctemplate方法 读取数据库中的ID值
@Resource
private JdbcTemplate jdbcTemplate;
@PreAuthorize("@ss.hasPermi('system:school:add')") @PreAuthorize("@ss.hasPermi('system:school:add')")
@Log(title = "幼儿园机构", businessType = BusinessType.INSERT) @Log(title = "幼儿园机构", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody BySchool bySchool) public AjaxResult add(@RequestBody BySchool bySchool)
{ {
//从school表中取出当前最大的ID值 并且将其赋值给dept中的ordernumber
String maxId = jdbcTemplate.queryForObject(String.format("select MAX(id) from by_school"),String.class);
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());
//创建dept实例 并且向要添加的dept中设置各个参数
SysDept dept = new SysDept();
dept.setSchoolId(bySchool.getXxdm());
dept.setCreateBy(SecurityUtils.getUsername());
dept.setParentId(200L);
dept.setAncestors("0,100,200");
dept.setDeptName(bySchool.getSchoolName());
dept.setOrderNum(maxId);
dept.setPhone(bySchool.getTel());
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

@ -4,6 +4,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel; import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity; import com.ruoyi.framework.web.domain.BaseEntity;
import java.util.Date; import java.util.Date;
/** /**
@ -12,13 +13,21 @@ import java.util.Date;
* @author tsbz * @author tsbz
* @date 2020-04-08 * @date 2020-04-08
*/ */
public class BySchool extends BaseEntity public class BySchool extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 幼儿园ID */ /** 幼儿园ID */
private Long id; private Long id;
// 学校代码与dept相关联
private String xxdm;
/** 机构名称 */ /** 机构名称 */
@Excel(name = "机构名称") @Excel(name = "机构名称")
private String schoolName; private String schoolName;
@ -131,6 +140,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 +413,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 +458,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}