feat: add teacher admin ownership fields

main
chenyuan 2 months ago
parent 81afc75cc3
commit c9484ae88d

@ -0,0 +1,5 @@
ALTER TABLE userinfo
ADD COLUMN teacher_admin TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否管理型老师0-否 1-是';
ALTER TABLE school_class
ADD COLUMN created_by VARCHAR(64) NULL COMMENT '班级创建人教师用户ID';

@ -31,6 +31,12 @@ public class SchoolClass {
@ApiModelProperty(notes = "学校ID")
private String schoolId;
@ApiModelProperty(notes = "创建人教师用户ID")
private String createdBy;
@ApiModelProperty(notes = "创建人姓名 回显用")
private String createdByName;
public String getSchoolClassId() {
return schoolClassId;
}
@ -86,4 +92,20 @@ public class SchoolClass {
public void setSchoolId(String schoolId) {
this.schoolId = schoolId == null ? null : schoolId.trim();
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy == null ? null : createdBy.trim();
}
public String getCreatedByName() {
return createdByName;
}
public void setCreatedByName(String createdByName) {
this.createdByName = createdByName == null ? null : createdByName.trim();
}
}

@ -574,6 +574,76 @@ public class SchoolClassExample {
addCriterion("school_id not between", value1, value2, "schoolId");
return (Criteria) this;
}
public Criteria andCreatedByIsNull() {
addCriterion("created_by is null");
return (Criteria) this;
}
public Criteria andCreatedByIsNotNull() {
addCriterion("created_by is not null");
return (Criteria) this;
}
public Criteria andCreatedByEqualTo(String value) {
addCriterion("created_by =", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotEqualTo(String value) {
addCriterion("created_by <>", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByGreaterThan(String value) {
addCriterion("created_by >", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByGreaterThanOrEqualTo(String value) {
addCriterion("created_by >=", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByLessThan(String value) {
addCriterion("created_by <", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByLessThanOrEqualTo(String value) {
addCriterion("created_by <=", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByLike(String value) {
addCriterion("created_by like", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotLike(String value) {
addCriterion("created_by not like", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByIn(List<String> values) {
addCriterion("created_by in", values, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotIn(List<String> values) {
addCriterion("created_by not in", values, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByBetween(String value1, String value2) {
addCriterion("created_by between", value1, value2, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotBetween(String value1, String value2) {
addCriterion("created_by not between", value1, value2, "createdBy");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

@ -57,6 +57,9 @@ public class Userinfo {
@ApiModelProperty(notes = "权限1-超管 2-学校管理员 3-老师 4-学生")
private Integer role;
@ApiModelProperty(notes = "是否管理型老师false-否 true-是")
private Boolean teacherAdmin;
@ApiModelProperty(notes = "学校ID关联学校表")
private String schoolId;
@ -218,6 +221,14 @@ public class Userinfo {
this.role = role;
}
public Boolean getTeacherAdmin() {
return teacherAdmin;
}
public void setTeacherAdmin(Boolean teacherAdmin) {
this.teacherAdmin = teacherAdmin;
}
public String getSchoolId() {
return schoolId;
}

@ -1165,6 +1165,46 @@ public class UserinfoExample {
return (Criteria) this;
}
public Criteria andTeacherAdminIsNull() {
addCriterion("teacher_admin is null");
return (Criteria) this;
}
public Criteria andTeacherAdminIsNotNull() {
addCriterion("teacher_admin is not null");
return (Criteria) this;
}
public Criteria andTeacherAdminEqualTo(Boolean value) {
addCriterion("teacher_admin =", value, "teacherAdmin");
return (Criteria) this;
}
public Criteria andTeacherAdminNotEqualTo(Boolean value) {
addCriterion("teacher_admin <>", value, "teacherAdmin");
return (Criteria) this;
}
public Criteria andTeacherAdminIn(List<Boolean> values) {
addCriterion("teacher_admin in", values, "teacherAdmin");
return (Criteria) this;
}
public Criteria andTeacherAdminNotIn(List<Boolean> values) {
addCriterion("teacher_admin not in", values, "teacherAdmin");
return (Criteria) this;
}
public Criteria andTeacherAdminBetween(Boolean value1, Boolean value2) {
addCriterion("teacher_admin between", value1, value2, "teacherAdmin");
return (Criteria) this;
}
public Criteria andTeacherAdminNotBetween(Boolean value1, Boolean value2) {
addCriterion("teacher_admin not between", value1, value2, "teacherAdmin");
return (Criteria) this;
}
public Criteria andSchoolIdIsNull() {
addCriterion("school_id is null");
return (Criteria) this;

@ -9,6 +9,7 @@
<result column="status" jdbcType="BIT" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="school_id" jdbcType="VARCHAR" property="schoolId" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -69,7 +70,7 @@
</where>
</sql>
<sql id="Base_Column_List">
school_class_id, school_major_id, class_name, class_sn, status, create_time, school_id
school_class_id, school_major_id, class_name, class_sn, status, create_time, school_id, created_by
</sql>
<select id="selectByExample" parameterType="com.sztzjy.linkCommerce.entity.SchoolClassExample" resultMap="BaseResultMap">
select
@ -104,10 +105,10 @@
<insert id="insert" parameterType="com.sztzjy.linkCommerce.entity.SchoolClass">
insert into school_class (school_class_id, school_major_id, class_name,
class_sn, status, create_time,
school_id)
school_id, created_by)
values (#{schoolClassId,jdbcType=VARCHAR}, #{schoolMajorId,jdbcType=VARCHAR}, #{className,jdbcType=VARCHAR},
#{classSn,jdbcType=VARCHAR}, #{status,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP},
#{schoolId,jdbcType=VARCHAR})
#{schoolId,jdbcType=VARCHAR}, #{createdBy,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.linkCommerce.entity.SchoolClass">
insert into school_class
@ -133,6 +134,9 @@
<if test="schoolId != null">
school_id,
</if>
<if test="createdBy != null">
created_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="schoolClassId != null">
@ -156,6 +160,9 @@
<if test="schoolId != null">
#{schoolId,jdbcType=VARCHAR},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.linkCommerce.entity.SchoolClassExample" resultType="java.lang.Long">
@ -188,6 +195,9 @@
<if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR},
</if>
<if test="record.createdBy != null">
created_by = #{record.createdBy,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -201,7 +211,8 @@
class_sn = #{record.classSn,jdbcType=VARCHAR},
status = #{record.status,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
school_id = #{record.schoolId,jdbcType=VARCHAR}
school_id = #{record.schoolId,jdbcType=VARCHAR},
created_by = #{record.createdBy,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -227,6 +238,9 @@
<if test="schoolId != null">
school_id = #{schoolId,jdbcType=VARCHAR},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=VARCHAR},
</if>
</set>
where school_class_id = #{schoolClassId,jdbcType=VARCHAR}
</update>
@ -237,7 +251,8 @@
class_sn = #{classSn,jdbcType=VARCHAR},
status = #{status,jdbcType=BIT},
create_time = #{createTime,jdbcType=TIMESTAMP},
school_id = #{schoolId,jdbcType=VARCHAR}
school_id = #{schoolId,jdbcType=VARCHAR},
created_by = #{createdBy,jdbcType=VARCHAR}
where school_class_id = #{schoolClassId,jdbcType=VARCHAR}
</update>
</mapper>

@ -18,6 +18,7 @@
<result column="study_time" jdbcType="INTEGER" property="studyTime" />
<result column="code_from" jdbcType="VARCHAR" property="codeFrom" />
<result column="role" jdbcType="INTEGER" property="role" />
<result column="teacher_admin" jdbcType="BIT" property="teacherAdmin" />
<result column="school_id" jdbcType="VARCHAR" property="schoolId" />
<result column="school_faculty_id" jdbcType="VARCHAR" property="schoolFacultyId" />
<result column="school_major_id" jdbcType="VARCHAR" property="schoolMajorId" />
@ -83,7 +84,7 @@
</sql>
<sql id="Base_Column_List">
user_id, name, username, password, sex, phone, email, headImg, disabledStatus, wxcode,
login_count, create_time, last_login_time, study_time, code_from, role, school_id,
login_count, create_time, last_login_time, study_time, code_from, role, teacher_admin, school_id,
school_faculty_id, school_major_id, school_class_id
</sql>
<select id="selectByExample" parameterType="com.sztzjy.linkCommerce.entity.UserinfoExample" resultMap="BaseResultMap">
@ -122,14 +123,14 @@
email, headImg, disabledStatus,
wxcode, login_count, create_time,
last_login_time, study_time, code_from,
role, school_id, school_faculty_id,
role, teacher_admin, school_id, school_faculty_id,
school_major_id, school_class_id)
values (#{userId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{sex,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{email,jdbcType=VARCHAR}, #{headimg,jdbcType=VARCHAR}, #{disabledstatus,jdbcType=BIT},
#{wxcode,jdbcType=VARCHAR}, #{loginCount,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{lastLoginTime,jdbcType=TIMESTAMP}, #{studyTime,jdbcType=INTEGER}, #{codeFrom,jdbcType=VARCHAR},
#{role,jdbcType=INTEGER}, #{schoolId,jdbcType=VARCHAR}, #{schoolFacultyId,jdbcType=VARCHAR},
#{role,jdbcType=INTEGER}, #{teacherAdmin,jdbcType=BIT}, #{schoolId,jdbcType=VARCHAR}, #{schoolFacultyId,jdbcType=VARCHAR},
#{schoolMajorId,jdbcType=VARCHAR}, #{schoolClassId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.linkCommerce.entity.Userinfo">
@ -183,6 +184,9 @@
<if test="role != null">
role,
</if>
<if test="teacherAdmin != null">
teacher_admin,
</if>
<if test="schoolId != null">
school_id,
</if>
@ -245,6 +249,9 @@
<if test="role != null">
#{role,jdbcType=INTEGER},
</if>
<if test="teacherAdmin != null">
#{teacherAdmin,jdbcType=BIT},
</if>
<if test="schoolId != null">
#{schoolId,jdbcType=VARCHAR},
</if>
@ -316,6 +323,9 @@
<if test="record.role != null">
role = #{record.role,jdbcType=INTEGER},
</if>
<if test="record.teacherAdmin != null">
teacher_admin = #{record.teacherAdmin,jdbcType=BIT},
</if>
<if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR},
</if>
@ -351,6 +361,7 @@
study_time = #{record.studyTime,jdbcType=INTEGER},
code_from = #{record.codeFrom,jdbcType=VARCHAR},
role = #{record.role,jdbcType=INTEGER},
teacher_admin = #{record.teacherAdmin,jdbcType=BIT},
school_id = #{record.schoolId,jdbcType=VARCHAR},
school_faculty_id = #{record.schoolFacultyId,jdbcType=VARCHAR},
school_major_id = #{record.schoolMajorId,jdbcType=VARCHAR},
@ -407,6 +418,9 @@
<if test="role != null">
role = #{role,jdbcType=INTEGER},
</if>
<if test="teacherAdmin != null">
teacher_admin = #{teacherAdmin,jdbcType=BIT},
</if>
<if test="schoolId != null">
school_id = #{schoolId,jdbcType=VARCHAR},
</if>
@ -439,6 +453,7 @@
study_time = #{studyTime,jdbcType=INTEGER},
code_from = #{codeFrom,jdbcType=VARCHAR},
role = #{role,jdbcType=INTEGER},
teacher_admin = #{teacherAdmin,jdbcType=BIT},
school_id = #{schoolId,jdbcType=VARCHAR},
school_faculty_id = #{schoolFacultyId,jdbcType=VARCHAR},
school_major_id = #{schoolMajorId,jdbcType=VARCHAR},

@ -0,0 +1,27 @@
package com.sztzjy.linkCommerce.entity;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
class TeacherAdminModelTest {
@Test
void userinfoStoresTeacherAdminFlag() {
Userinfo teacher = new Userinfo();
teacher.setTeacherAdmin(false);
assertFalse(teacher.getTeacherAdmin());
}
@Test
void schoolClassStoresCreatorFields() {
SchoolClass schoolClass = new SchoolClass();
schoolClass.setCreatedBy("teacher-1");
schoolClass.setCreatedByName("张老师");
assertEquals("teacher-1", schoolClass.getCreatedBy());
assertEquals("张老师", schoolClass.getCreatedByName());
}
}
Loading…
Cancel
Save