This commit is contained in:
@jyuhsin
2025-09-29 08:59:18 +08:00
parent 67f1349024
commit 8f835e3fc7
19 changed files with 853 additions and 164 deletions
@@ -1,18 +1,32 @@
package com.budwk.app.zhgh.dayofficework.literacy.controller.manage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
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.base.service.BaseService;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.zhgh.dayofficework.literacy.models.LiteracySourceCourse;
import com.budwk.app.zhgh.dayofficework.literacy.models.LiteracyTeacher;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
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.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 java.util.List;
/**
* @ClassName LiteracyCourseController
* @Author JyuHsin
@@ -40,8 +54,76 @@ public class LiteracyCourseController {
@At
@SaCheckPermission("literacy.course")
public Result pageData(PageForm pageForm) {
public Result pageData(PageForm pageForm,
@Param("courseType") String courseType,
@Param("teacherId") String teacherId) {
Sql sql = Sqls.create("""
SELECT
sc.*,
t.typeName,
te.NAME AS teacherName
FROM
`literacy_source_course` sc
LEFT JOIN literacy_type t ON sc.courseType = t.id
LEFT JOIN literacy_teacher te ON sc.courseInstructor = te.id
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and(Cnd.likeEX("sc.courseName", pageForm.getSearchKeyword()));
cnd.andEX("sc.courseType", "=", courseType);
cnd.andEX("sc.courseInstructor", "=", teacherId);
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.desc("sc.createdAt");
} else {
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("literacy.course")
@SLog(type = "职工素养-课程管理", tag = "新增/编辑", msg = "新增/编辑教师")
public Result submit(LiteracySourceCourse sourceCourse) {
if(StrUtil.isNotBlank(sourceCourse.getId())) {
dao.updateIgnoreNull(sourceCourse);
} else {
sourceCourse.setOpenOtherUnion(false);
dao.insert(sourceCourse);
}
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("literacy.course")
@SLog(type = "职工素养-课程管理", tag = "删除", msg = "删除教师")
public Object delete(@Param(value = "id") String id) {
dao.clear(LiteracySourceCourse.class, Cnd.where("id", "=", id));
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("literacy")
public Object querySourceCourses() {
Sql sql = Sqls.create("""
SELECT
sc.*,
t.typeName,
te.NAME AS teacherName,
te.NAME AS courseInstructor
FROM
`literacy_source_course` sc
LEFT JOIN literacy_type t ON sc.courseType = t.id
LEFT JOIN literacy_teacher te ON sc.courseInstructor = te.id
""");
List<NutMap> list = baseService.listMap(sql);
return Result.success(list);
}
}
@@ -21,8 +21,10 @@ import java.util.List;
@EqualsAndHashCode(callSuper = false)
public class LiteracyActivity extends BaseModel implements Serializable, SysHomeConvert {
@Name
@PrevInsert(uu32 = true)
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@@ -15,8 +15,10 @@ import java.util.Date;
@EqualsAndHashCode(callSuper = false)
public class LiteracyActivityCourse {
@Name
@PrevInsert(uu32 = true)
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@@ -13,9 +13,10 @@ import org.nutz.dao.interceptor.annotation.PrevInsert;
@EqualsAndHashCode(callSuper = false)
public class LiteracyBlackList {
@Name
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@@ -16,10 +16,12 @@ import java.util.List;
@Comment("职工素养的子活动")
@Table
@EqualsAndHashCode(callSuper = false)
public class LiteracyCourse extends BaseModel implements Serializable {
public class LiteracyCourse extends LiteracySourceCourse implements Serializable {
@Name
@PrevInsert(uu32 = true)
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@@ -27,137 +29,23 @@ public class LiteracyCourse extends BaseModel implements Serializable {
@Comment("活动ID")
private String activityId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("课程名称")
private String courseName;
@Column
@ColDefine(type = ColType.INT)
@Comment("课程人数")
private int coursePeopleNumber;
@Column
@ColDefine(type = ColType.INT)
@Default(value = "0")
@Comment("预留名额")
private int courseReservedNumber;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("课程地点")
private String courseLocation;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("课程类型")
private String courseType;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@Comment("课程地点坐标")
private List<Double> courseLocationCoordinates;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("课程讲师")
private String courseInstructor;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("校区")
private String campus;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("报名人数是否限制")
private Boolean courseIsLimitApply;
@Column
@ColDefine(type = ColType.INT)
@Comment("序号")
private int orderNum;
@Column
@ColDefine(customType = "longtext")
@Comment("详细信息")
private String introduce;
@Many(field = "courseId")
private List<LiteracyActivityCourse> courseTimeList;
@Column
@Comment("分工会人数限制")
@ColDefine(type = ColType.MYSQL_JSON)
private List<NutMap> unionLimit;
//已报人数
private Integer hasRegisterNum;
private Boolean isBringFamily;
private Boolean isAddFamily;
//是否报过该课程
private Boolean isSign;
//还能报该类型的课程吗
private Boolean canSignThisCourseType;
@Column
@Comment("分工会人数限制")
@ColDefine(type = ColType.MYSQL_JSON)
private List<NutMap> unionLimit;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("移动端是否签到")
private boolean isMobileSign;
@Column
@ColDefine(type = ColType.INT)
@Comment("签到方式 1.扫描二维码签到 2.被扫 3.gps签到")
private Integer signType;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("移动端是否签收礼品")
private boolean isReceiveGift;
@Column
@ColDefine(type = ColType.INT)
@Comment("领取礼品方式 1.扫描二维码 2.线下")
private Integer giftType;
@Column
@ColDefine(type = ColType.INT)
@Comment("预留名额方式 1.报名人员减少模式 2.报名人数不变模式")
private Integer reserveMode;
@Column
@Comment("承办工会")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String hostUnionId;
@Column
@Comment("对内报名时间")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String interTime;
@Column
@Comment("是否开放给其他工会")
@ColDefine(type = ColType.BOOLEAN, width = 4)
private Boolean openOtherUnion;
@Column
@Comment("分类标识")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String assort;
@Column
@ColDefine(type = ColType.INT)
@Default(value = "0")
@Comment("候补名额数")
private Integer waitingNum;
//候补已报人数
private Integer hasWaitingNum;
private String courseTimeName;
}
@@ -17,10 +17,10 @@ public class LiteracyMobileSignColumn {
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@@ -0,0 +1,145 @@
package com.budwk.app.zhgh.dayofficework.literacy.models;
import cn.hutool.json.JSONObject;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.lang.util.NutMap;
import java.util.List;
/**
* @ClassName LiteracySourceCourse
* @Author JyuHsin
* @Date 2025/9/28 14:46
* @Version 1.0
* @Description TODO
*/
@Data
@Accessors(chain = true)
@Comment("职工素养-课程管理")
@Table
@EqualsAndHashCode(callSuper = false)
public class LiteracySourceCourse extends BaseModel {
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("课程名称")
private String courseName;
@Column
@ColDefine(type = ColType.INT)
@Comment("课程人数")
private int coursePeopleNumber;
@Column
@ColDefine(type = ColType.INT)
@Default(value = "0")
@Comment("预留名额")
private int courseReservedNumber;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("课程地点")
private String courseLocation;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("课程类型")
private String courseType;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@Comment("课程地点坐标")
private List<Double> courseLocationCoordinates;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("课程讲师")
private String courseInstructor;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("校区")
private String campus;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("报名人数是否限制")
private Boolean courseIsLimitApply;
@Column
@ColDefine(type = ColType.INT)
@Comment("序号")
private int orderNum;
@Column
@ColDefine(customType = "longtext")
@Comment("详细信息")
private String introduce;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("移动端是否签到")
private boolean isMobileSign;
@Column
@ColDefine(type = ColType.INT)
@Comment("签到方式 1.扫描二维码签到 2.被扫 3.gps签到")
private Integer signType;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("移动端是否签收礼品")
private boolean isReceiveGift;
@Column
@ColDefine(type = ColType.INT)
@Comment("领取礼品方式 1.扫描二维码 2.线下")
private Integer giftType;
@Column
@ColDefine(type = ColType.INT)
@Comment("预留名额方式 1.报名人员减少模式 2.报名人数不变模式")
private Integer reserveMode;
@Column
@Comment("承办工会")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String hostUnionId;
@Column
@Comment("对内报名时间")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String interTime;
@Column
@Comment("是否开放给其他工会")
@ColDefine(type = ColType.BOOLEAN, width = 4)
private Boolean openOtherUnion;
@Column
@Comment("分类标识")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String assort;
@Column
@ColDefine(type = ColType.INT)
@Default(value = "0")
@Comment("候补名额数")
private Integer waitingNum;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@Comment("时间段")
private List<JSONObject> timeList;
}
@@ -20,10 +20,10 @@ public class LiteracyTeacher extends BaseModel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@@ -21,10 +21,10 @@ public class LiteracyType extends BaseModel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@@ -17,10 +17,10 @@ public class LiteracyTypeLimit implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@@ -19,8 +19,10 @@ import java.util.List;
@TableIndexes({@Index(name = "INDEX_TRAIN_SIGN_UP_USER_COURSEID", fields = {"courseId"}, unique = false)})
public class LiteracyUser implements Serializable {
@Name
@PrevInsert(uu32 = true)
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@@ -20,8 +20,10 @@ import java.util.Date;
})
public class LiteracyUserCourse implements Serializable {
@Name
@PrevInsert(uu32 = true)
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column