子女信息管理
This commit is contained in:
+1
@@ -99,6 +99,7 @@ public class UnionReimburseMineController {
|
||||
cnd.and("info.userName", "like", "%" + userName + "%");
|
||||
}
|
||||
cnd.desc("info.createTime");
|
||||
cnd.and("info.userId", "=", SecurityUtil.getUserId());
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = unionReimburseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
package com.budwk.app.zhgh.user.childManage.controller;
|
||||
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.enrollmentRegistration.vo.EnrollmentRegistrationPageForm;
|
||||
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
|
||||
import com.budwk.app.zhgh.user.childManage.service.ChildManageService;
|
||||
import com.budwk.app.zhgh.user.childManage.vo.ChildManagePageForm;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/childManage/manage")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api("子女信息管理")
|
||||
public class ChildManageManageController {
|
||||
|
||||
@Inject
|
||||
private ChildManageService childManageService;
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/user/childManage/manage/index.html")
|
||||
@SaCheckPermission
|
||||
public void index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("childManage.manage")
|
||||
public Result pageData(PageForm pageForm,
|
||||
Integer year,
|
||||
String searchName,
|
||||
String searchKeyword,
|
||||
String childrenSex,
|
||||
String unionId,
|
||||
String unitId,
|
||||
String childrenGrade) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*
|
||||
FROM
|
||||
child_manage info
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// 模糊查询
|
||||
if (searchName != null && !searchName.isEmpty() && searchKeyword != null && !searchKeyword.isEmpty()) {
|
||||
switch (searchName) {
|
||||
case "info.childrenName":
|
||||
cnd.and("info.childrenName", "like", "%" + searchKeyword + "%");
|
||||
break;
|
||||
case "info.guardianUserName": // 合并后的监护人查询
|
||||
cnd.and(Cnd.exps("info.guardianUserName1", "like", "%" + searchKeyword + "%")
|
||||
.or("info.guardianUserName2", "like", "%" + searchKeyword + "%"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 工会筛选 (查询两个监护人的工会)
|
||||
if (unionId != null && !unionId.isEmpty()) {
|
||||
cnd.and(Cnd.exps("info.guardianUnionId1", "=", unionId)
|
||||
.or("info.guardianUnionId2", "=", unionId));
|
||||
}
|
||||
// 所属单位筛选 (查询两个监护人的单位)
|
||||
if (unitId != null && !unitId.isEmpty()) {
|
||||
cnd.and(Cnd.exps("info.guardianUnitId1", "=", unitId)
|
||||
.or("info.guardianUnitId2", "=", unitId));
|
||||
}
|
||||
|
||||
cnd.andEX("YEAR(info.applyTime)", "=", year);
|
||||
cnd.andEX("info.childrenSex", "=", childrenSex);
|
||||
cnd.andEX("info.childrenGrade", "=", childrenGrade);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = childManageService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除子女信息")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("childManage.manage")
|
||||
@SLog(tag = "子女信息-我的填报", msg = "删除id: ${args[0]}")
|
||||
public Result doDelete(String id) {
|
||||
childManageService.dao().delete(ChildManage.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("childManage.manage")
|
||||
public void doExportExcel(@Param("data") ChildManagePageForm pageForm, HttpServletResponse response) {
|
||||
try {
|
||||
Sql sql = childManageService.getSql(pageForm);
|
||||
List<NutMap> map = childManageService.listMap(sql);
|
||||
|
||||
List<Sys_dict> dictList = sysDictService.getSubListByCode("CHILD_MANAGE_GRADE");
|
||||
|
||||
map.forEach(item -> {
|
||||
// 年龄计算
|
||||
String birthday = item.getString("childrenBirthday");
|
||||
if (birthday != null && !birthday.isEmpty()) {
|
||||
item.put("age", calculateAge(birthday));
|
||||
}
|
||||
Sys_dict dict = dictList.stream().filter(sys_dict -> sys_dict.getCode().equals(item.getString("childrenGrade"))).findFirst().orElse(null);
|
||||
item.put("childrenGrade", dict.getName());
|
||||
});
|
||||
|
||||
List<ExcelExportEntity> entityList = new ArrayList<>();
|
||||
ExcelExportEntity no = new ExcelExportEntity("序号", "no", 10);
|
||||
no.setFormat("isAddIndex");
|
||||
entityList.add(no);
|
||||
|
||||
entityList.add(new ExcelExportEntity("年级", "childrenGrade", 20));
|
||||
entityList.add(new ExcelExportEntity("子女姓名", "childrenName", 20));
|
||||
entityList.add(new ExcelExportEntity("性别", "childrenSex", 20));
|
||||
entityList.add(new ExcelExportEntity("出生日期", "childrenBirthday", 20));
|
||||
entityList.add(new ExcelExportEntity("年龄", "age", 20));
|
||||
entityList.add(new ExcelExportEntity("就读学校", "childrenCurrentSchool", 20));
|
||||
entityList.add(new ExcelExportEntity("监护人1", "guardianUserName1", 20));
|
||||
entityList.add(new ExcelExportEntity("手机号码", "guardianMobile1", 20));
|
||||
entityList.add(new ExcelExportEntity("所在单位", "guardianUnitName1", 20));
|
||||
entityList.add(new ExcelExportEntity("监护人2", "guardianUserName2", 20));
|
||||
entityList.add(new ExcelExportEntity("手机号码", "guardianMobile2", 20));
|
||||
entityList.add(new ExcelExportEntity("所在单位", "guardianUnitName2", 20));
|
||||
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("子女信息管理汇总.xlsx", "UTF-8"));
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, map);
|
||||
workbook.write(response.getOutputStream());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 计算年龄
|
||||
* @param birthday 出生日期
|
||||
* @return 年龄
|
||||
*/
|
||||
private String calculateAge(String birthday) {
|
||||
if (birthday == null || birthday.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date birthDate = sdf.parse(birthday);
|
||||
Calendar birthCal = Calendar.getInstance();
|
||||
birthCal.setTime(birthDate);
|
||||
|
||||
Calendar today = Calendar.getInstance();
|
||||
int age = today.get(Calendar.YEAR) - birthCal.get(Calendar.YEAR);
|
||||
|
||||
// 检查是否还没过生日
|
||||
if (today.get(Calendar.DAY_OF_YEAR) < birthCal.get(Calendar.DAY_OF_YEAR)) {
|
||||
age--;
|
||||
}
|
||||
|
||||
return String.valueOf(age >= 0 ? age : 0);
|
||||
} catch (Exception e) {
|
||||
log.error("计算年龄失败", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.budwk.app.zhgh.user.childManage.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.enrollmentRegistration.model.EnrollmentRegistration;
|
||||
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
|
||||
import com.budwk.app.zhgh.user.childManage.service.ChildManageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/childManage/mine")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api("子女信息管理我的")
|
||||
public class ChildManageMineController {
|
||||
|
||||
@Inject
|
||||
private ChildManageService childManageService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/user/childManage/mine/index.html")
|
||||
@SaCheckPermission
|
||||
public void index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("分页查询")
|
||||
@SaCheckPermission("childManage.mine")
|
||||
public Result pageData(PageForm pageForm, Integer year) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*
|
||||
FROM
|
||||
child_manage info
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(info.applyTime)", "=", year);
|
||||
// 使用 or 条件查询两个监护人字段
|
||||
cnd.and(Cnd.exps("info.guardianUserId1", "=", SecurityUtil.getUserId())
|
||||
.or("info.guardianUserId2", "=", SecurityUtil.getUserId()));
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = childManageService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("删除子女信息")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("childManage.mine")
|
||||
@SLog(tag = "子女信息-我的填报", msg = "删除id: ${args[0]}")
|
||||
public Result doDelete(String id) {
|
||||
childManageService.dao().delete(ChildManage.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package com.budwk.app.zhgh.user.childManage.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.enrollmentRegistration.model.EnrollmentRegistration;
|
||||
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
|
||||
import com.budwk.app.zhgh.user.childManage.service.ChildManageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/childManage/write")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
@Api("子女信息管理信息填写")
|
||||
public class ChildManageWriteController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ChildManageService childManageService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/user/childManage/write/index.html")
|
||||
@SaCheckPermission
|
||||
public void index() {}
|
||||
|
||||
@At
|
||||
@ApiOperation("保存子女信息")
|
||||
@SaCheckPermission("childManage.write")
|
||||
@SLog(tag = "子女信息管理-信息填写", msg = "保存子女信息")
|
||||
public Result save(@Param("data") ChildManage childManage) {
|
||||
if(StrUtil.isBlank(childManage.getId())) childManage.setApplyTime(DateUtil.now());
|
||||
dao.insertOrUpdate(childManage);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("查询用户")
|
||||
@SaCheckPermission("childManage.write")
|
||||
@SLog(tag = "查询用户", msg = "查询用户")
|
||||
public Object listUser(String keyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
id,
|
||||
username as userName,
|
||||
loginname as loginName,
|
||||
sex,
|
||||
mobile,
|
||||
technicalTitle,
|
||||
IFNULL(unitname, '暂无') as unitName,
|
||||
unitid as unitId,
|
||||
unionid as unionId,
|
||||
unionname as unionName
|
||||
from
|
||||
vw_user
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.or(View_user::getLoginname, "like", "%" + keyword + "%");
|
||||
seg.or(View_user::getUsername, "like", "%" + keyword + "%");
|
||||
cnd.and(seg);
|
||||
}
|
||||
if(!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
if(AuthUtil.hasRoleOr(RoleConstant.BRANCH_UNION_ADMIN.name(), RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and(View_user::getUnionId, "=", SecurityUtil.getUnionId());
|
||||
} else {
|
||||
cnd.and(View_user::getId, "=", SecurityUtil.getUserId());
|
||||
}
|
||||
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = childManageService.listPageMap(1, 50, sql);
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("查询身份证是否重复")
|
||||
public Result getIsRepeatByIdCard(String idCard, String id) {
|
||||
int count = childManageService.dao().count(ChildManage.class,
|
||||
Cnd.where(ChildManage::getChildrenIdCard, "=", idCard)
|
||||
.and("YEAR(applyTime)", "=", DateUtil.thisYear())
|
||||
.andEX(ChildManage::getId, "!=", id));
|
||||
|
||||
|
||||
return Result.success(count);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result findOne(String id) {
|
||||
return Result.success(childManageService.dao().fetch(ChildManage.class, id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package com.budwk.app.zhgh.user.childManage.models;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ChildManage
|
||||
* @Author hongqiwei
|
||||
* @Date 2025/8/30 10:23
|
||||
* @Version 1.0
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("child_manage")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("子女信息管理")
|
||||
public class ChildManage extends BaseModel implements Serializable {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("guardianUserId1")
|
||||
private String guardianUserId1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("监护人1(教工)姓名")
|
||||
private String guardianUserName1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("工号")
|
||||
private String guardianLoginName1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在工会Id")
|
||||
private String guardianUnionId1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在工会")
|
||||
private String guardianUnionName1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("手机号码")
|
||||
private String guardianMobile1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在单位Id")
|
||||
private String guardianUnitId1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在单位")
|
||||
private String guardianUnitName1;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("guardianUserId2")
|
||||
private String guardianUserId2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("监护人2(教工)姓名")
|
||||
private String guardianUserName2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("工号")
|
||||
private String guardianLoginName2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在工会Id")
|
||||
private String guardianUnionId2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在工会")
|
||||
private String guardianUnionName2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("手机号码")
|
||||
private String guardianMobile2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("所在单位Id")
|
||||
private String guardianUnitId2;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("所在单位")
|
||||
private String guardianUnitName2;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("子女姓名")
|
||||
private String childrenName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("就读年级")
|
||||
private String childrenGrade;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("入学年份")
|
||||
private String childrenYear;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("身份证号")
|
||||
private String childrenIdCard;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("出身年月")
|
||||
private String childrenBirthday;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("性别")
|
||||
private String childrenSex;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 30)
|
||||
@Comment("国籍")
|
||||
private String childrenCountry;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("现就读学校")
|
||||
private String childrenCurrentSchool;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("中考总成绩")
|
||||
private String childrenMiddleScore;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("学科组合")
|
||||
private String childrenSubjectCombination;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 100)
|
||||
@Comment("子女户籍所在地")
|
||||
private String childrenHuKouAddress;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 200)
|
||||
@Comment("备注")
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 50)
|
||||
@Comment("填写时间")
|
||||
private String applyTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.budwk.app.zhgh.user.childManage.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
|
||||
import com.budwk.app.zhgh.user.childManage.vo.ChildManagePageForm;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
|
||||
public interface ChildManageService extends BaseService<ChildManage> {
|
||||
Sql getSql(ChildManagePageForm pageForm);
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.budwk.app.zhgh.user.childManage.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
|
||||
import com.budwk.app.zhgh.user.childManage.service.ChildManageService;
|
||||
import com.budwk.app.zhgh.user.childManage.vo.ChildManagePageForm;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class ChildManageServiceImpl extends BaseServiceImpl<ChildManage> implements ChildManageService {
|
||||
|
||||
public ChildManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sql getSql(ChildManagePageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*
|
||||
FROM
|
||||
child_manage info
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// 模糊查询
|
||||
if (pageForm.getSearchName() != null && !pageForm.getSearchName().isEmpty() && pageForm.getSearchKeyword() != null && !pageForm.getSearchKeyword().isEmpty()) {
|
||||
switch (pageForm.getSearchName()) {
|
||||
case "info.childrenName":
|
||||
cnd.and("info.childrenName", "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
break;
|
||||
case "info.guardianUserName": // 合并后的监护人查询
|
||||
cnd.and(Cnd.exps("info.guardianUserName1", "like", "%" + pageForm.getSearchKeyword() + "%")
|
||||
.or("info.guardianUserName2", "like", "%" + pageForm.getSearchKeyword() + "%"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 工会筛选 (查询两个监护人的工会)
|
||||
if (pageForm.getUnionId() != null && !pageForm.getUnionId().isEmpty()) {
|
||||
cnd.and(Cnd.exps("info.guardianUnionId1", "=", pageForm.getUnionId())
|
||||
.or("info.guardianUnionId2", "=", pageForm.getUnionId()));
|
||||
}
|
||||
// 所属单位筛选 (查询两个监护人的单位)
|
||||
if (pageForm.getUnitId() != null && !pageForm.getUnitId().isEmpty()) {
|
||||
cnd.and(Cnd.exps("info.guardianUnitId1", "=", pageForm.getUnitId())
|
||||
.or("info.guardianUnitId2", "=", pageForm.getUnitId()));
|
||||
}
|
||||
|
||||
cnd.andEX("YEAR(info.applyTime)", "=", pageForm.getYear());
|
||||
cnd.andEX("info.childrenGrade", "=", pageForm.getChildrenGrade());
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.user.childManage.vo;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ChildManagePageForm extends PageForm {
|
||||
|
||||
private Integer year;
|
||||
private String unionId;
|
||||
private String unitId;
|
||||
private String childrenGrade;
|
||||
private String searchName;
|
||||
private String searchKeyword;
|
||||
}
|
||||
Reference in New Issue
Block a user