20200407-lc-1
This commit is contained in:
@ -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));
|
||||
|
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user