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") @ApiModelProperty(notes = "学校ID")
private String schoolId; private String schoolId;
@ApiModelProperty(notes = "创建人教师用户ID")
private String createdBy;
@ApiModelProperty(notes = "创建人姓名 回显用")
private String createdByName;
public String getSchoolClassId() { public String getSchoolClassId() {
return schoolClassId; return schoolClassId;
} }
@ -86,4 +92,20 @@ public class SchoolClass {
public void setSchoolId(String schoolId) { public void setSchoolId(String schoolId) {
this.schoolId = schoolId == null ? null : schoolId.trim(); 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"); addCriterion("school_id not between", value1, value2, "schoolId");
return (Criteria) this; 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 { public static class Criteria extends GeneratedCriteria {
@ -667,4 +737,4 @@ public class SchoolClassExample {
this(condition, value, secondValue, null); this(condition, value, secondValue, null);
} }
} }
} }

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

@ -1165,6 +1165,46 @@ public class UserinfoExample {
return (Criteria) this; 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() { public Criteria andSchoolIdIsNull() {
addCriterion("school_id is null"); addCriterion("school_id is null");
return (Criteria) this; return (Criteria) this;
@ -1537,4 +1577,4 @@ public class UserinfoExample {
this(condition, value, secondValue, null); this(condition, value, secondValue, null);
} }
} }
} }

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

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

@ -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