合并幼儿信息和紧急联系人信息

This commit is contained in:
paidaxing444
2020-10-10 15:50:00 +08:00
parent bee07af3f3
commit 34268b85ca
10 changed files with 574 additions and 276 deletions

View File

@ -75,6 +75,21 @@ public class ByChildContactpeopleController extends BaseController {
return AjaxResult.success(byChildContactpeopleService.selectByChildContactpeopleById(id));
}
/**
* 获取幼儿紧急情况联系人详细信息
*/
@PreAuthorize("@ss.hasPermi('benyi:contactpeople:query')")
@GetMapping(value = "/bychild/{id}")
public AjaxResult getInfoByChildId(@PathVariable("id") Long id) {
ByChildContactpeople byChildContactpeople = new ByChildContactpeople();
byChildContactpeople.setChildid(id);
List<ByChildContactpeople> list = byChildContactpeopleService.selectByChildContactpeopleList(byChildContactpeople);
if (list != null && list.size() > 0) {
byChildContactpeople = list.get(0);
}
return AjaxResult.success(byChildContactpeople);
}
/**
* 新增幼儿紧急情况联系人
*/

View File

@ -8,6 +8,8 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.security.service.TokenService;
import com.ruoyi.project.benyi.domain.ByChildContactpeople;
import com.ruoyi.project.benyi.service.IByChildContactpeopleService;
import com.ruoyi.project.common.SchoolCommon;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@ -44,6 +46,8 @@ public class ByChildController extends BaseController {
private SchoolCommon schoolCommon;
@Autowired
private TokenService tokenService;
@Autowired
private IByChildContactpeopleService byChildContactpeopleService;
/**
* 查询幼儿信息列表
@ -100,8 +104,8 @@ public class ByChildController extends BaseController {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String operName = loginUser.getUsername();
Long deptId = loginUser.getUser().getDeptId();
String bjbh=schoolCommon.getClassId();
String message = byChildService.importChild(childList, operName,deptId,bjbh);
String bjbh = schoolCommon.getClassId();
String message = byChildService.importChild(childList, operName, deptId, bjbh);
return AjaxResult.success(message);
}
@ -145,7 +149,7 @@ public class ByChildController extends BaseController {
@PreAuthorize("@ss.hasPermi('benyi:child:add')")
@Log(title = "幼儿信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ByChild byChild) {
public AjaxResult add(@RequestBody ByChild byChild, @RequestBody ByChildContactpeople byChildContactpeople) {
//首先判断当前账户是否为幼儿园账号
if (schoolCommon.isSchool()) {
//学校id
@ -156,7 +160,18 @@ public class ByChildController extends BaseController {
if (schoolCommon.isStringEmpty(byChild.getClassid())) {
byChild.setClassid(schoolCommon.getClassId());
}
return toAjax(byChildService.insertByChild(byChild));
int i = byChildService.insertByChild(byChild);
Long chilId = byChild.getId();
if (i > 0) {
chilId = byChild.getId();
// System.out.println("newId:" + chilId);
// System.out.println("byChildContactpeople:" + byChildContactpeople);
// byChildContactpeople.setChildid(chilId);
// byChildContactpeopleService.insertByChildContactpeople(byChildContactpeople);
return AjaxResult.success(chilId.intValue());
} else {
return AjaxResult.error("创建失败,请联系管理员");
}
} else {
return AjaxResult.error("当前用户非幼儿园,无法添加幼儿");
}
@ -196,6 +211,8 @@ public class ByChildController extends BaseController {
@Log(title = "幼儿信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
//删除幼儿信息 同时删除幼儿联系人信息
byChildContactpeopleService.deleteByChildContactpeopleByChildIds(ids);
return toAjax(byChildService.deleteByChildByIds(ids));
}

View File

@ -58,4 +58,12 @@ public interface ByChildContactpeopleMapper {
* @return 结果
*/
public int deleteByChildContactpeopleByIds(Long[] ids);
/**
* 批量删除幼儿紧急情况联系人
*
* @param childIds 需要删除的幼儿紧急情况联系人ID
* @return 结果
*/
public int deleteByChildContactpeopleByChildIds(Long[] childIds);
}

View File

@ -58,4 +58,12 @@ public interface IByChildContactpeopleService {
* @return 结果
*/
public int deleteByChildContactpeopleById(Long id);
/**
* 批量删除幼儿紧急情况联系人
*
* @param childIds 需要删除的幼儿紧急情况联系人ID
* @return 结果
*/
public int deleteByChildContactpeopleByChildIds(Long[] childIds);
}

View File

@ -86,4 +86,15 @@ public class ByChildContactpeopleServiceImpl implements IByChildContactpeopleSer
public int deleteByChildContactpeopleById(Long id) {
return byChildContactpeopleMapper.deleteByChildContactpeopleById(id);
}
/**
* 批量删除幼儿紧急情况联系人
*
* @param childIds 需要删除的幼儿紧急情况联系人ID
* @return 结果
*/
@Override
public int deleteByChildContactpeopleByChildIds(Long[] childIds) {
return byChildContactpeopleMapper.deleteByChildContactpeopleByChildIds(childIds);
}
}

View File

@ -149,4 +149,11 @@
</foreach>
</delete>
<delete id="deleteByChildContactpeopleByChildIds" parameterType="String">
delete from by_child_contactpeople where childid in
<foreach item="childid" collection="array" open="(" separator="," close=")">
#{childid}
</foreach>
</delete>
</mapper>