20200407-lc-1
This commit is contained in:
		| @@ -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="请输入紧急联系人" /> | ||||||
| @@ -370,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" | ||||||
|  |           } | ||||||
|         ] |         ] | ||||||
|       } |       } | ||||||
|     }; |     }; | ||||||
|   | |||||||
| @@ -243,6 +243,11 @@ | |||||||
| 				</exclusion> | 				</exclusion> | ||||||
| 			</exclusions> | 			</exclusions> | ||||||
| 		</dependency> | 		</dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework</groupId> | ||||||
|  |             <artifactId>spring-jdbc</artifactId> | ||||||
|  |             <version>5.1.5.RELEASE</version> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|     </dependencies> |     </dependencies> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ import java.util.List; | |||||||
|  |  | ||||||
| import com.ruoyi.common.utils.SecurityUtils; | import com.ruoyi.common.utils.SecurityUtils; | ||||||
| import com.ruoyi.project.system.service.ISysDeptService; | 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; | ||||||
| @@ -25,12 +26,19 @@ 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 com.ruoyi.project.system.domain.SysDept; | ||||||
|  |  | ||||||
|  | import javax.annotation.Resource; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 幼儿园机构Controller |  * 幼儿园机构Controller | ||||||
|  *  |  *  | ||||||
|  * @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 | ||||||
| @@ -78,14 +86,24 @@ 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(); |         String uuid = getUUID32(); | ||||||
|  |  | ||||||
|         //将UUID赋值给xxdm |         //将UUID赋值给xxdm | ||||||
| @@ -93,18 +111,18 @@ public class BySchoolController extends BaseController | |||||||
|         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); |  | ||||||
|  |  | ||||||
|  |         //创建dept实例  并且向要添加的dept中设置各个参数 | ||||||
|         SysDept dept = new SysDept(); |         SysDept dept = new SysDept(); | ||||||
|         dept.setSchoolId(bySchool.getXxdm()); |         dept.setSchoolId(bySchool.getXxdm()); | ||||||
|         dept.setCreateBy(SecurityUtils.getUsername()); |         dept.setCreateBy(SecurityUtils.getUsername()); | ||||||
|         //dept.setDeptId(bySchool.getDept().getDeptId()); |  | ||||||
|         dept.setParentId(200L); |         dept.setParentId(200L); | ||||||
|         dept.setAncestors("0,100,200"); |         dept.setAncestors("0,100,200"); | ||||||
|         dept.setDeptName(bySchool.getSchoolName()); |         dept.setDeptName(bySchool.getSchoolName()); | ||||||
|         //dept.setPhone(bySchool.getTel()); |         dept.setOrderNum(maxId); | ||||||
|         //dept.setOrderNum(String.valueOf(bySchool.getId())); |         dept.setPhone(bySchool.getTel()); | ||||||
|         dept.setLeader(SecurityUtils.getUsername()); |         dept.setLeader(SecurityUtils.getUsername()); | ||||||
|  |         //插入数据 | ||||||
|         deptService.insertDept(dept); |         deptService.insertDept(dept); | ||||||
|  |  | ||||||
|         return toAjax(bySchoolService.insertBySchool(bySchool)); |         return toAjax(bySchoolService.insertBySchool(bySchool)); | ||||||
|   | |||||||
| @@ -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,10 +13,15 @@ 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; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user