tz_digital_bank/src/main/resources/mappers/StuUserMapper.xml

454 lines
18 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sztzjy.trade.mapper.StuUserMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.trade.entity.StuUser">
<id column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="student_id" jdbcType="VARCHAR" property="studentId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="role_id" jdbcType="INTEGER" property="roleId" />
<result column="class_id" jdbcType="VARCHAR" property="classId" />
<result column="class_name" jdbcType="VARCHAR" property="className" />
<result column="major" jdbcType="VARCHAR" property="major" />
<result column="school_id" jdbcType="VARCHAR" property="schoolId" />
<result column="school_name" jdbcType="VARCHAR" property="schoolName" />
<result column="total_rank" jdbcType="INTEGER" property="totalRank" />
<result column="total_score" jdbcType="DECIMAL" property="totalScore" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="del_state" jdbcType="INTEGER" property="delState" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="attendance_score" jdbcType="DECIMAL" property="attendanceScore" />
<result column="exam_results_for_homework_assignments" jdbcType="DECIMAL" property="examResultsForHomeworkAssignments" />
<result column="results_of_practical_case_studies" jdbcType="DECIMAL" property="resultsOfPracticalCaseStudies" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
user_id, student_id, name, password, role_id, class_id, class_name, major, school_id,
school_name, total_rank, total_score, create_time, del_state, update_time, attendance_score,
exam_results_for_homework_assignments, results_of_practical_case_studies
</sql>
<select id="selectByExample" parameterType="com.sztzjy.trade.entity.StuUserExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from stu_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from stu_user
where user_id = #{userId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from stu_user
where user_id = #{userId,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.trade.entity.StuUserExample">
delete from stu_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.trade.entity.StuUser">
insert into stu_user (user_id, student_id, name,
password, role_id, class_id,
class_name, major, school_id,
school_name, total_rank, total_score,
create_time, del_state, update_time,
attendance_score, exam_results_for_homework_assignments,
results_of_practical_case_studies)
values (#{userId,jdbcType=VARCHAR}, #{studentId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{roleId,jdbcType=INTEGER}, #{classId,jdbcType=VARCHAR},
#{className,jdbcType=VARCHAR}, #{major,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR},
#{schoolName,jdbcType=VARCHAR}, #{totalRank,jdbcType=INTEGER}, #{totalScore,jdbcType=DECIMAL},
#{createTime,jdbcType=TIMESTAMP}, #{delState,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP},
#{attendanceScore,jdbcType=DECIMAL}, #{examResultsForHomeworkAssignments,jdbcType=DECIMAL},
#{resultsOfPracticalCaseStudies,jdbcType=DECIMAL})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.trade.entity.StuUser">
insert IGNORE into stu_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="studentId != null">
student_id,
</if>
<if test="name != null">
name,
</if>
<if test="password != null">
password,
</if>
<if test="roleId != null">
role_id,
</if>
<if test="classId != null">
class_id,
</if>
<if test="className != null">
class_name,
</if>
<if test="major != null">
major,
</if>
<if test="schoolId != null">
school_id,
</if>
<if test="schoolName != null">
school_name,
</if>
<if test="totalRank != null">
total_rank,
</if>
<if test="totalScore != null">
total_score,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="delState != null">
del_state,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="attendanceScore != null">
attendance_score,
</if>
<if test="examResultsForHomeworkAssignments != null">
exam_results_for_homework_assignments,
</if>
<if test="resultsOfPracticalCaseStudies != null">
results_of_practical_case_studies,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="studentId != null">
#{studentId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="roleId != null">
#{roleId,jdbcType=INTEGER},
</if>
<if test="classId != null">
#{classId,jdbcType=VARCHAR},
</if>
<if test="className != null">
#{className,jdbcType=VARCHAR},
</if>
<if test="major != null">
#{major,jdbcType=VARCHAR},
</if>
<if test="schoolId != null">
#{schoolId,jdbcType=VARCHAR},
</if>
<if test="schoolName != null">
#{schoolName,jdbcType=VARCHAR},
</if>
<if test="totalRank != null">
#{totalRank,jdbcType=INTEGER},
</if>
<if test="totalScore != null">
#{totalScore,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delState != null">
#{delState,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="attendanceScore != null">
#{attendanceScore,jdbcType=DECIMAL},
</if>
<if test="examResultsForHomeworkAssignments != null">
#{examResultsForHomeworkAssignments,jdbcType=DECIMAL},
</if>
<if test="resultsOfPracticalCaseStudies != null">
#{resultsOfPracticalCaseStudies,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.trade.entity.StuUserExample" resultType="java.lang.Long">
select count(*) from stu_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update stu_user
<set>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.studentId != null">
student_id = #{record.studentId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.password != null">
password = #{record.password,jdbcType=VARCHAR},
</if>
<if test="record.roleId != null">
role_id = #{record.roleId,jdbcType=INTEGER},
</if>
<if test="record.classId != null">
class_id = #{record.classId,jdbcType=VARCHAR},
</if>
<if test="record.className != null">
class_name = #{record.className,jdbcType=VARCHAR},
</if>
<if test="record.major != null">
major = #{record.major,jdbcType=VARCHAR},
</if>
<if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR},
</if>
<if test="record.schoolName != null">
school_name = #{record.schoolName,jdbcType=VARCHAR},
</if>
<if test="record.totalRank != null">
total_rank = #{record.totalRank,jdbcType=INTEGER},
</if>
<if test="record.totalScore != null">
total_score = #{record.totalScore,jdbcType=DECIMAL},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.delState != null">
del_state = #{record.delState,jdbcType=INTEGER},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.attendanceScore != null">
attendance_score = #{record.attendanceScore,jdbcType=DECIMAL},
</if>
<if test="record.examResultsForHomeworkAssignments != null">
exam_results_for_homework_assignments = #{record.examResultsForHomeworkAssignments,jdbcType=DECIMAL},
</if>
<if test="record.resultsOfPracticalCaseStudies != null">
results_of_practical_case_studies = #{record.resultsOfPracticalCaseStudies,jdbcType=DECIMAL},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update stu_user
set user_id = #{record.userId,jdbcType=VARCHAR},
student_id = #{record.studentId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
role_id = #{record.roleId,jdbcType=INTEGER},
class_id = #{record.classId,jdbcType=VARCHAR},
class_name = #{record.className,jdbcType=VARCHAR},
major = #{record.major,jdbcType=VARCHAR},
school_id = #{record.schoolId,jdbcType=VARCHAR},
school_name = #{record.schoolName,jdbcType=VARCHAR},
total_rank = #{record.totalRank,jdbcType=INTEGER},
total_score = #{record.totalScore,jdbcType=DECIMAL},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
del_state = #{record.delState,jdbcType=INTEGER},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
attendance_score = #{record.attendanceScore,jdbcType=DECIMAL},
exam_results_for_homework_assignments = #{record.examResultsForHomeworkAssignments,jdbcType=DECIMAL},
results_of_practical_case_studies = #{record.resultsOfPracticalCaseStudies,jdbcType=DECIMAL}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.trade.entity.StuUser">
update stu_user
<set>
<if test="studentId != null">
student_id = #{studentId,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="roleId != null">
role_id = #{roleId,jdbcType=INTEGER},
</if>
<if test="classId != null">
class_id = #{classId,jdbcType=VARCHAR},
</if>
<if test="className != null">
class_name = #{className,jdbcType=VARCHAR},
</if>
<if test="major != null">
major = #{major,jdbcType=VARCHAR},
</if>
<if test="schoolId != null">
school_id = #{schoolId,jdbcType=VARCHAR},
</if>
<if test="schoolName != null">
school_name = #{schoolName,jdbcType=VARCHAR},
</if>
<if test="totalRank != null">
total_rank = #{totalRank,jdbcType=INTEGER},
</if>
<if test="totalScore != null">
total_score = #{totalScore,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delState != null">
del_state = #{delState,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="attendanceScore != null">
attendance_score = #{attendanceScore,jdbcType=DECIMAL},
</if>
<if test="examResultsForHomeworkAssignments != null">
exam_results_for_homework_assignments = #{examResultsForHomeworkAssignments,jdbcType=DECIMAL},
</if>
<if test="resultsOfPracticalCaseStudies != null">
results_of_practical_case_studies = #{resultsOfPracticalCaseStudies,jdbcType=DECIMAL},
</if>
</set>
where user_id = #{userId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.trade.entity.StuUser">
update stu_user
set student_id = #{studentId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
role_id = #{roleId,jdbcType=INTEGER},
class_id = #{classId,jdbcType=VARCHAR},
class_name = #{className,jdbcType=VARCHAR},
major = #{major,jdbcType=VARCHAR},
school_id = #{schoolId,jdbcType=VARCHAR},
school_name = #{schoolName,jdbcType=VARCHAR},
total_rank = #{totalRank,jdbcType=INTEGER},
total_score = #{totalScore,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
del_state = #{delState,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP},
attendance_score = #{attendanceScore,jdbcType=DECIMAL},
exam_results_for_homework_assignments = #{examResultsForHomeworkAssignments,jdbcType=DECIMAL},
results_of_practical_case_studies = #{resultsOfPracticalCaseStudies,jdbcType=DECIMAL}
where user_id = #{userId,jdbcType=VARCHAR}
</update>
<select id="getStartCourseNameList" resultMap="BaseResultMap" resultType="com.sztzjy.trade.entity.StuUser">
SELECT * FROM stu_user
<where>
<!-- 使用foreach标签遍历传入的className列表 -->
<foreach collection="classNames" item="className" separator="OR">
class_name = #{className}
</foreach>
</where>
</select>
<select id="selectByCourseName" resultMap="BaseResultMap" resultType="com.sztzjy.trade.entity.StuUser">
SELECT * FROM `stu_user` WHERE class_name=#{startCourseName}
</select>
<select id="selectByClassName" resultMap="BaseResultMap" resultType="java.lang.String">
select DISTINCT(class_name) from stu_user where school_id=#{schoolId} and class_name!=null
</select>
<select id="selectByNoClassName" resultType="java.lang.String">
select DISTINCT(class_name) from stu_user
<where>
school_id=#{schoolId} and
<foreach collection="strings" item="string" separator="and">
class_name!=#{string}
</foreach>
</where>
</select>
<select id="selectStuList" resultMap="BaseResultMap" resultType="com.sztzjy.trade.entity.StuUser">
select * from stu_user
<where>
school_id=#{schoolId} and
<foreach collection="lists" item="list" separator="and">
class_name!=#{list}
</foreach>
</where>
</select>
</mapper>