Merge remote-tracking branch 'origin/master'

This commit is contained in:
paidaxing444 2020-04-16 11:02:16 +08:00
commit b327803c09
10 changed files with 1331 additions and 1180 deletions

View File

@ -88,7 +88,12 @@
<el-row>
<el-col :span="24" v-if="form.parentId !== 0">
<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-col>
<el-col :span="12">
@ -138,7 +143,13 @@
</template>
<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 "@riophae/vue-treeselect/dist/vue-treeselect.css";
@ -162,7 +173,8 @@ export default {
//
queryParams: {
deptName: undefined,
status: undefined
status: undefined,
schoolId: undefined
},
//
form: {},
@ -245,7 +257,8 @@ export default {
leader: undefined,
phone: undefined,
email: undefined,
status: "0"
status: "0",
schoolId: undefined
};
this.resetForm("form");
},
@ -303,16 +316,23 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?', "警告", {
this.$confirm(
'是否确认删除名称为"' + row.deptName + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
}
)
.then(function() {
return delDept(row.deptId);
}).then(() => {
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
})
.catch(function() {});
}
}
};

View File

@ -188,7 +188,7 @@
<el-input v-model="form.mastername" placeholder="请输入联系人" />
</el-form-item>
<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 label="紧急联系人" prop="emMan">
<el-input v-model="form.emMan" placeholder="请输入紧急联系人" />
@ -206,7 +206,7 @@
</el-radio-group>
</el-form-item>
<el-form-item label="幼儿园规模" prop="scale">
<el-select v-model="form.scale" placeholder="请选择">
<el-select v-model="form.scale">
<el-option
v-for="dict in scaleOptions"
:key="dict.dictValue"
@ -334,6 +334,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
xxdm: undefined,
schoolName: undefined,
nameShort: undefined,
type: undefined,
@ -369,7 +370,19 @@ export default {
//
rules: {
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() {
this.form = {
id: undefined,
xxdm: undefined,
schoolName: undefined,
nameShort: undefined,
type: "1",

View File

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

View File

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

View File

@ -4,6 +4,8 @@ import java.util.Date;
import java.util.List;
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.beans.factory.annotation.Autowired;
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.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysDept;
import javax.annotation.Resource;
/**
* 幼儿园机构Controller
@ -29,6 +34,11 @@ import com.ruoyi.framework.web.page.TableDataInfo;
* @author tsbz
* @date 2020-04-08
*/
@RestController
@RequestMapping("/system/school")
public class BySchoolController extends BaseController
@ -36,6 +46,11 @@ public class BySchoolController extends BaseController
@Autowired
private IBySchoolService bySchoolService;
@Autowired
private ISysDeptService deptService;
/**
* 查询幼儿园机构列表
*/
@ -71,17 +86,45 @@ public class BySchoolController extends BaseController
return AjaxResult.success(bySchoolService.selectBySchoolById(id));
}
/**
* 新增幼儿园机构
*/
//调取jdbctemplate方法 读取数据库中的ID值
@Resource
private JdbcTemplate jdbcTemplate;
@PreAuthorize("@ss.hasPermi('system:school:add')")
@Log(title = "幼儿园机构", businessType = BusinessType.INSERT)
@PostMapping
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.setApprovalUser(SecurityUtils.getLoginUser().getUser().getUserId());
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));
}

View File

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

View File

@ -4,6 +4,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import java.util.Date;
/**
@ -12,13 +13,21 @@ import java.util.Date;
* @author tsbz
* @date 2020-04-08
*/
public class BySchool extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 幼儿园ID */
private Long id;
// 学校代码与dept相关联
private String xxdm;
/** 机构名称 */
@Excel(name = "机构名称")
private String schoolName;
@ -131,6 +140,17 @@ public class BySchool extends BaseEntity
@Excel(name = "当前学期")
private String dqxq;
//部门
private SysDept dept;
public SysDept getDept() {
return dept;
}
public void setDept(SysDept dept) {
this.dept = dept;
}
public void setId(Long id)
{
this.id = id;
@ -393,10 +413,21 @@ public class BySchool extends BaseEntity
return dqxq;
}
public String getXxdm() {
return xxdm;
}
public void setXxdm(String xxdm) {
this.xxdm = xxdm;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("xxdm",getXxdm())
.append("schoolName", getSchoolName())
.append("nameShort", getNameShort())
.append("type", getType())
@ -427,6 +458,9 @@ public class BySchool extends BaseEntity
.append("openDeadline", getOpenDeadline())
.append("dqxn", getDqxn())
.append("dqxq", getDqxq())
.append("dept", getDept())
.toString();
}
}

View File

@ -54,6 +54,17 @@ public class SysDept extends BaseEntity
/** 子部门 */
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()
{
return deptId;
@ -197,6 +208,9 @@ public class SysDept extends BaseEntity
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("school_id", getSchoolId())
.toString();
}
}

View File

@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="BySchool" id="BySchoolResult">
<result property="id" column="id" />
<result property="xxdm" column="xxdm" />
<result property="schoolName" column="school_name" />
<result property="nameShort" column="name_short" />
<result property="type" column="type" />
@ -39,12 +40,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<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>
<select id="selectBySchoolList" parameterType="BySchool" resultMap="BySchoolResult">
<include refid="selectBySchoolVo"/>
<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="nameShort != null and nameShort != ''"> and name_short = #{nameShort}</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 into by_school
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="xxdm != null and xxdm != ''">xxdm,</if>
<if test="schoolName != null and schoolName != ''">school_name,</if>
<if test="nameShort != null and nameShort != ''">name_short,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="xxdm != null and xxdm != ''">#{xxdm},</if>
<if test="schoolName != null and schoolName != ''">#{schoolName},</if>
<if test="nameShort != null and nameShort != ''">#{nameShort},</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 by_school
<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="nameShort != null and nameShort != ''">name_short = #{nameShort},</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="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="schoolId" column="school_id" />
</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
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
</sql>
@ -88,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="schoolId != null and schoolId != ''">school_id,</if>
create_time
)values(
<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="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="schoolId != null and schoolId != ''">#{schoolId},</if>
sysdate()
)
</insert>
@ -116,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="schoolId != null and schoolId != ''">school_id = #{schoolId},</if>
update_time = sysdate()
</set>
where dept_id = #{deptId}