diff --git a/ruoyi-ui/src/views/system/school/index.vue b/ruoyi-ui/src/views/system/school/index.vue index b8d65c147..33f40f9ee 100644 --- a/ruoyi-ui/src/views/system/school/index.vue +++ b/ruoyi-ui/src/views/system/school/index.vue @@ -188,7 +188,7 @@ - + @@ -370,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" + } ] } }; diff --git a/ruoyi/pom.xml b/ruoyi/pom.xml index 15470d888..52eaa7e40 100644 --- a/ruoyi/pom.xml +++ b/ruoyi/pom.xml @@ -1,287 +1,292 @@ - - - 4.0.0 - - com.ruoyi - ruoyi - 2.2.0 - jar - - ruoyi - http://www.benyiedu.com - 本一智慧平台管理系统 - - - org.springframework.boot - spring-boot-starter-parent - 2.1.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - 1.3.2 - 1.2.5 - 1.2.47 - 1.1.14 - 2.5 - 1.3.3 - 1.19 - 0.9.0 - 2.9.2 - 3.17 - 3.9.1 - 1.7 - - - - - - - org.springframework.boot - spring-boot-starter - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - org.springframework.boot - spring-boot-starter-aop - - - - - org.springframework.boot - spring-boot-starter-web - - - - - org.springframework.boot - spring-boot-devtools - true - - - - - org.springframework.boot - spring-boot-starter-security - - - - - org.springframework.boot - spring-boot-starter-data-redis - - - - - org.apache.commons - commons-pool2 - - - - - mysql - mysql-connector-java - runtime - - - - - org.mybatis.spring.boot - mybatis-spring-boot-starter - ${mybatis.spring.boot.starter.version} - - - - - com.github.pagehelper - pagehelper-spring-boot-starter - ${pagehelper.spring.boot.starter.version} - - - - - com.alibaba - druid-spring-boot-starter - ${druid.version} - - - - - org.apache.commons - commons-lang3 - - - - - commons-io - commons-io - ${commons.io.version} - - - - - commons-fileupload - commons-fileupload - ${commons.fileupload.version} - - - - - eu.bitwalker - UserAgentUtils - ${bitwalker.version} - - - - - com.alibaba - fastjson - ${fastjson.version} - - - - - org.springframework - spring-context-support - - - - - io.jsonwebtoken - jjwt - ${jwt.version} - - - - - io.springfox - springfox-swagger2 - ${swagger.version} - - - io.swagger - swagger-annotations - - - io.swagger - swagger-models - - - - - - - io.swagger - swagger-annotations - 1.5.21 - - - - io.swagger - swagger-models - 1.5.21 - - - - - io.springfox - springfox-swagger-ui - ${swagger.version} - - - - - com.github.oshi - oshi-core - ${oshi.version} - - - - net.java.dev.jna - jna - - - - net.java.dev.jna - jna-platform - - - - - org.apache.poi - poi-ooxml - ${poi.version} - - - - - org.apache.velocity - velocity - ${velocity.version} - - - - - org.quartz-scheduler - quartz - - - com.mchange - c3p0 - - - - - - - - ${project.artifactId} - - - org.springframework.boot - spring-boot-maven-plugin - - true - - - - - - - - public - aliyun nexus - http://maven.aliyun.com/nexus/content/groups/public/ - - true - - - - - - - public - aliyun nexus - http://maven.aliyun.com/nexus/content/groups/public/ - - true - - - false - - - - + + + 4.0.0 + + com.ruoyi + ruoyi + 2.2.0 + jar + + ruoyi + http://www.benyiedu.com + 本一智慧平台管理系统 + + + org.springframework.boot + spring-boot-starter-parent + 2.1.1.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + 1.3.2 + 1.2.5 + 1.2.47 + 1.1.14 + 2.5 + 1.3.3 + 1.19 + 0.9.0 + 2.9.2 + 3.17 + 3.9.1 + 1.7 + + + + + + + org.springframework.boot + spring-boot-starter + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.springframework.boot + spring-boot-starter-aop + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-devtools + true + + + + + org.springframework.boot + spring-boot-starter-security + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.apache.commons + commons-pool2 + + + + + mysql + mysql-connector-java + runtime + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + ${mybatis.spring.boot.starter.version} + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + ${pagehelper.spring.boot.starter.version} + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + org.apache.commons + commons-lang3 + + + + + commons-io + commons-io + ${commons.io.version} + + + + + commons-fileupload + commons-fileupload + ${commons.fileupload.version} + + + + + eu.bitwalker + UserAgentUtils + ${bitwalker.version} + + + + + com.alibaba + fastjson + ${fastjson.version} + + + + + org.springframework + spring-context-support + + + + + io.jsonwebtoken + jjwt + ${jwt.version} + + + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + + + + + io.swagger + swagger-annotations + 1.5.21 + + + + io.swagger + swagger-models + 1.5.21 + + + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + + + com.github.oshi + oshi-core + ${oshi.version} + + + + net.java.dev.jna + jna + + + + net.java.dev.jna + jna-platform + + + + + org.apache.poi + poi-ooxml + ${poi.version} + + + + + org.apache.velocity + velocity + ${velocity.version} + + + + + org.quartz-scheduler + quartz + + + com.mchange + c3p0 + + + + + org.springframework + spring-jdbc + 5.1.5.RELEASE + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + + + + public + aliyun nexus + http://maven.aliyun.com/nexus/content/groups/public/ + + true + + + + + + + public + aliyun nexus + http://maven.aliyun.com/nexus/content/groups/public/ + + true + + + false + + + + \ No newline at end of file diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/controller/BySchoolController.java b/ruoyi/src/main/java/com/ruoyi/project/system/controller/BySchoolController.java index 6551b3c2b..3f4dd0a5b 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/system/controller/BySchoolController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/system/controller/BySchoolController.java @@ -5,6 +5,7 @@ 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; @@ -25,12 +26,19 @@ 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 * * @author tsbz * @date 2020-04-08 */ + + + + + @RestController @RequestMapping("/system/school") public class BySchoolController extends BaseController @@ -78,14 +86,24 @@ 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 @@ -93,18 +111,18 @@ public class BySchoolController extends BaseController bySchool.setCreateUser(SecurityUtils.getLoginUser().getUser().getUserId()); bySchool.setApprovalUser(SecurityUtils.getLoginUser().getUser().getUserId()); bySchool.setCreateTime(new Date()); - //bySchoolService.insertBySchool(bySchool); + //创建dept实例 并且向要添加的dept中设置各个参数 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.setOrderNum(maxId); + dept.setPhone(bySchool.getTel()); dept.setLeader(SecurityUtils.getUsername()); + //插入数据 deptService.insertDept(dept); return toAjax(bySchoolService.insertBySchool(bySchool)); diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/domain/BySchool.java b/ruoyi/src/main/java/com/ruoyi/project/system/domain/BySchool.java index 1691c72b9..00f5c33fc 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/system/domain/BySchool.java +++ b/ruoyi/src/main/java/com/ruoyi/project/system/domain/BySchool.java @@ -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,10 +13,15 @@ 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;