2026-03-10 16:40:19 +08:00

453 lines
17 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._3e.dao.StudentDao">
<update id= "doSaveUpdate" parameterType="com._3e.entity.Student" >
Update student
<set>
<if test="password != null">password = #{password},</if>
<if test="truename != null">truename = #{truename},</if>
<if test="nickname != null">nickname = #{nickname},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="address != null">address = #{address},</if>
<if test="areaid != null">areaid = #{areaid},</if>
<if test="code != null">code = #{code},</if>
<if test="recognizecode != null">recognizecode = #{recognizecode},</if>
<if test="cellphone != null">cellphone = #{cellphone},</if>
<if test="telephone != null">telephone = #{telephone},</if>
<if test="email != null">email = #{email},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="status != null">status = #{status},</if>
<if test="source != null">source = #{source},</if>
<if test="lastsignin != null">lastsignin = #{lastsignin},</if>
<if test="jdtoken != null">jdtoken = #{jdtoken},</if>
<if test="signature != null">signature = #{signature}</if>
</set>
WHERE studentid = #{studentid}
</update>
<update id= "doSaveUpdateReco" parameterType="map" >
Update student set cellphone = #{newCellphone},recognizecode=#{newRecognizecode}
WHERE studentid = #{studentId}
</update>
<update id= "doSaveUpdateRegister" parameterType="map" >
Update register set cellphone = #{newCellphone},recognizecode=#{newRecognizecode}
WHERE recognizecode = #{oldRecognizecode} and usertype = 1
</update>
<update id="doSaveUpdateStatus" parameterType="com._3e.entity.Student">
update student set status=#{status},recognizecode=#{recognizecode},cellphone=#{cellphone} where studentid = #{studentid} and areaid=#{areaid}
</update>
<update id="doSaveUpdateStudentOwnClassStatus" parameterType="com._3e.entity.Student">
update studentownclass set status=#{status} where studentid = #{studentid} and areaid = #{areaid}
</update>
<!-- <update id= "doUpdatePwd" parameterType="com._3e.entity.Student"> -->
<!-- Update student set password = #{password} WHERE studentid = #{studentid} -->
<!-- </update> -->
<select id= "findByRecognizecode" parameterType="string" resultType="com._3e.entity.Student" >
SELECT * FROM Student
WHERE upper(recognizecode) = #{recognizecode}
</select>
<select id= "findByCellPhone" parameterType="string" resultType="com._3e.entity.Student" >
SELECT * FROM Student
WHERE cellPhone = #{phone}
</select>
<select id= "findByStudentid" parameterType="long" resultType="com._3e.entity.Student" >
SELECT * FROM Student
WHERE studentid = #{studentid}
</select>
<select id= "findByStudentids" parameterType="list" resultType="com._3e.entity.Student" >
SELECT * FROM Student
WHERE studentid in
<foreach item="studentid" index="index" collection="list"
open="(" separator="," close=")">
#{studentid}
</foreach>
</select>
<select id= "findClassByStudentid" parameterType="long" resultType="com._3e.entity.Classes" >
SELECT * FROM Classes
WHERE classesid in (
select classesid from studentownclass where studentid = #{studentid} and status = 1
)
and classtype = 1 and status = 1
</select>
<select id= "findAllClassByStudentid" parameterType="map" resultType="com._3e.entity.Classes" >
SELECT * FROM Classes
WHERE classesid in (
select classesid from studentownclass where studentid = #{studentId} and status =1 and areaid=#{areaId}
)
and status = 1
</select>
<select id= "findTeamsByStudentid" parameterType="long" resultType="com._3e.entity.Classes" >
SELECT * FROM Classes
WHERE classesid in (
select classesid from studentownclass where studentid = #{studentid} and status = 1
)
and classtype = 2 and status = 1
ORDER BY classesid desc
</select>
<select id= "findFollowMates" parameterType="long" resultType="com._3e.http.myspace.dto._3EResClassMates" >
SELECT * from student t,followship s
where t.studentid = s.befollower and t.status = 1 and s.follower = #{follower}
</select>
<select id= "findClassMessByStudentid" parameterType="long" resultType="com._3e.entity.Classmessage" >
select t.* from classmessage t,studentownclass a,classownmessage b
where t.classmessageid = b.classmessageid and b.classesid = a.classesid
and a.studentid = #{studentid} and t.status = 1 and t.source = 1
order by created desc limit 1
</select>
<select id= "findClassMessByStudentids" parameterType="map" resultType="com._3e.entity.Classmessage" >
select t.* from classmessage t,classownmessage b
where t.classmessageid = b.classmessageid and b.classesid = #{classid} and t.status = 1 and t.source = 1
<if test="status == '1'.toString()">
order by created desc
</if>
<if test="status == '2'.toString()">
order by created asc
</if>
</select>
<select id= "findPhbUserInfo" parameterType="long" resultType="com._3e.dto.PhbUserInfo" >
select b.studentId as uid , b.truename , d.className , e.schoolName
from Student b
inner join StudentOwnClass c
on b.studentId = c.studentId and c.status = 1
inner join Classes d
on c.classesId = d.classesId and d.classType = 1
inner join school e
on d.schoolId = e.schoolId where b.studentId = #{studentid}
</select>
<select id="findClassByStudentidV3" parameterType="long" resultType="com._3e.dto.ClassesDto" >
select a.*,b.truename as teachername
from Classes a
left join teacher b on a.teacherid = b.teacherid
where a.classesid in (
select c.classesid from studentownclass c where c.studentid = #{studentid} and c.status=1
)
and a.classtype = 1 and a.status = 1
</select>
<select id="findClassByStudentidV4" parameterType="long" resultType="com._3e.dto.ClassesDto" >
select a.*,b.truename as teachername
from Classes a
left join teacher b on a.teacherid = b.teacherid
where a.classesid in (
select c.classesid from studentownclass c where c.studentid = #{studentid} and c.status=1
)
and a.classtype = 1 and (a.status=1 or a.status = 2)
</select>
<select id= "findTeamsByStudentidV3" parameterType="long" resultType="com._3e.dto.ClassesDto" >
select a.*,b.truename as teachername
from Classes a
left join teacher b on a.teacherid = b.teacherid
where a.classesid in (
select c.classesid from studentownclass c where c.studentid = #{studentid}
)
and a.classtype = 2 and a.status = 1
order by a.classesid desc
</select>
<select id= "findClassMessByClassesList" parameterType="map" resultType="com._3e.entity.Classmessage" >
select t.* from classmessage t,classownmessage b
where t.classmessageid = b.classmessageid
and b.classesid in
<foreach item="classes" index="index" collection="classesList"
open="(" separator="," close=")">
#{classes.classesid}
</foreach>
and t.status = 1 and t.source = 1 and t.isexam=0
<if test="status == '1'.toString()">
order by created desc
</if>
<if test="status == '2'.toString()">
order by created asc
</if>
</select>
<select id= "findClassMessByClassesList_1" parameterType="map" resultType="com._3e.entity.Classmessage" >
with temp as (
select DISTINCT on (content,teacherid,cs.classesid) t.classmessageid,cs.classesid,cs.classname,content,t.teacherid,t.created,t.starttime,t.endtime,t.status,isexam from classmessage t inner join classownmessage b
on t.classmessageid = b.classmessageid
inner join classes cs on b.classesid = cs.classesid
where cs.classesid in
<foreach item="classes" index="index" collection="classesList"
open="(" separator="," close=")">
#{classes.classesid}
</foreach>
and t.status = 1 and t.source = 1 and t.isexam=0)
SELECT * from temp t
order by created desc,content desc ,teacherid desc
<if test="page != null">
LIMIT #{page.limit} OFFSET #{page.offset}
</if>
<!--<if test="status == '1'.toString()">-->
<!--order by created desc-->
<!--</if>-->
<!--<if test="status == '2'.toString()">-->
<!--order by created asc-->
<!--</if>-->
</select>
<select id= "findIsJoinByStudentid" parameterType="long" resultType="com.univ3e.http.myhome.dto.OwnTeamDto" >
SELECT s.classesid , s.isdelegate ,s.status,c.classname
FROM studentownclass s
INNER JOIN classes c ON c.classesid = s.classesid
WHERE s.studentid = #{studentid} AND c.classType = 2 AND c.status = 1
</select>
<select id= "findTeacherByStudentid" parameterType="long" resultType="long" >
SELECT st.teacherid from v_studentclass st where st.studentid=#{studentid}
</select>
<select id="findUsersByPhoneNum" parameterType="map" resultType="com._3e.entity.VBaseUser">
<if test="userType==1">
select teacherid as studentid,truename,password,loginno as recognizecode from teacher where cellphone=#{cellphone}
</if>
<if test="userType==0">
select studentid,truename,password,recognizecode from student where cellphone=#{cellphone}
</if>
<!-- select studentid,truename from v_baseuser where cellphone=#{cellphone} -->
</select>
<select id="getSeqStudent" resultType="int" >
SELECT nextval('seq_studentId') ;
</select>
<insert id="insertStudent" parameterType="com._3e.entity.Student">
INSERT INTO Student ( studentId, password, truename, nickname, gender,
address, areaId, recognizeCode, cellphone, telephone, email,
avatar, status, source , code )
Values ( #{studentid}, #{password}, #{truename}, #{nickname}, #{gender},
#{address}, #{areaid}, upper(#{recognizecode}), #{cellphone}, #{telephone}, #{email},
#{avatar}, #{status}, #{source} , #{code} )
</insert>
<select id="getAllStudentbyClassesId" parameterType="java.lang.Long" resultType="com._3e.http.teachercenter.dto.management._3EResReplyStudent">
select a.studentid , a.truename, a.nickname,
a.recognizeCode, b.status,
a.source,p.starttime as created,a.avatar
from student a inner join studentownclass b on
a.status=1 and b.classesid=#{classesid} and a.studentid=b.studentid
inner join parameter p on p.paralong = a.studentId and p.valuelong=b.classesid and p.paratype=8
order by b.status,p.starttime desc ,a.studentid
</select>
<select id="getAllStudentbyClassesId_1" parameterType="java.lang.Long" resultType="com._3e.http.teachercenter.dto.management._3EResReplyStudent">
select a.studentid
from student a inner join studentownclass b on
a.status=1 and b.classesid=#{classesid} and a.studentid=b.studentid
</select>
<select id="getStudentNumbyClassesId" parameterType="long" resultType="int">
select count(1)
from student a inner join studentownclass b on
a.status=1 and b.classesid=#{classesid} and a.studentid=b.studentid
</select>
<select id="findClassByStudentidV5" parameterType="long" resultType="com._3e.dto.ClassesDto" >
select a.*,b.truename as teachername
from Classes a
inner join teacher b on a.teacherid = b.teacherid
where a.classesid in (
select c.classesid from studentownclass c where c.studentid = #{studentid} and c.status=0
)
and a.classtype = 1 and a.status=1
</select>
<!--没有使用-->
<select id="findStudentsByUids" parameterType="map" resultType="string">
select truename from student where studentid in
<foreach collection="uids" item="uid" open="(" close=")" separator=",">
#{uid}
</foreach>
</select>
<select id="findStudentTruenameByclassesid" parameterType="map" resultType="com._3e.entity.Student">
select a.studentid ,a.truename from student a,studentownclass b,classes c
where a.studentid = b.studentid and b.classesid = c.classesid and c.classesid=#{classesid}
and a.areaid=#{areaid} and b.areaid = #{areaid}
and a.status=1
</select>
<select id="findSchoolNameById" parameterType="map" resultType="string">
select e.schoolName
from Student b
inner join StudentOwnClass c
on b.studentId = c.studentId and c.status = 1
inner join Classes d
on c.classesId = d.classesId and d.classType = 1
inner join school e
on d.schoolId = e.schoolId where b.studentId = #{uid}
limit 1
</select>
<select id="findSchoolId" parameterType="map" resultType="long">
select sl.schoolid from student s
INNER JOIN studentownclass st on s.studentid = st.studentid
and st.status=1 and s.status = 1 and s.areaid = #{areaid} and st.areaid = #{areaid}
INNER JOIN classes c on st.classesid = c.classesid
INNER JOIN school sl on c.schoolid = sl.schoolid
and s.studentid = #{uid}
</select>
<select id="findCreatedById" parameterType="map" resultType="com._3e.entity.Student">
select created from student where studentid = #{studentid} and areaid = #{areaid}
</select>
<update id="doSaveUpdateCellPhoneNull" parameterType="string">
update student set cellphone = null where cellphone = #{phone}
</update>
<update id="updateFinishLessonStat" parameterType="com._3e.entity.FinishLessonStat">
update FinishLessonStat set
content=#{content} , lessoncount=#{lessoncount} , completecount =#{completecount} ,
created=#{created}, howmuch=#{howmuch} , maxscore= #{maxscore}, avgscore=#{avgscore},finishs=#{finishs,typeHandler=com._3e.http.wrongbook.typehandler.ArrayTypeHandler}
where uid =#{uid} and unitid= #{unitid} and areaId=#{areaid}
</update>
<select id="getFinishlesson" parameterType="com._3e.entity.FinishLessonStat" resultType="com._3e.entity.FinishLessonStat">
select * from FinishLessonStat where uid = #{uid} and unitid = #{unitid}
</select>
<select id="findSchoolNameFromSignupadditionalinfo" parameterType="long" resultType="String">
select schoolName from signupadditionalinfo where studentid = #{studentid};
</select>
<update id="doSaveUpdateSchoolName" parameterType="map">
update signupadditionalinfo set schoolName = #{schoolName} where studentid = #{studentId}
</update>
<update id="doSaveUpdateClass" parameterType="map">
update studentownclass set classesid = #{classesId} where studentid = #{studentId} and classesid = #{oldClassesId}
</update>
<update id="doSaveAllUpdateClass" parameterType="map">
update studentownclass set classesid = #{classesId} where classesid = #{oldClassesId} and studentid in
<foreach item="studentid" index="index" collection="studentIds"
open="(" separator="," close=")">
#{studentid}
</foreach>
</update>
<!--从虚拟表查学生-->
<select id="findRegister" parameterType="string" resultType="com._3e.entity.Register">
select * from register where recognizecode = #{userid} and usertype =1
</select>
<select id="findRegisterByUserType" parameterType="map" resultType="com._3e.entity.Register">
select * from register where recognizecode = #{userid} and usertype = #{usertype}
</select>
<update id="updateRegister" parameterType="map">
update register set status = #{status},isfirstlogin= #{isfirstlogin} where recognizecode = #{recognizecode} and usertype = #{usertype}
</update>
<update id="doSaveUpdateStudentsPassword" parameterType="map">
update student set password = #{password} where studentid in
<foreach collection="studentIds" item="studentId" index="index" open="(" separator="," close=")">
#{studentId}
</foreach>
</update>
<update id="updateRegisterStatus" parameterType="map">
update register set status = #{registerStatus} where usertype = #{usertype} and recognizecode in
<foreach item="recognizecode" index="index" collection="recognizecodes"
open="(" separator="," close=")">
#{recognizecode}
</foreach>
</update>
<delete id="deleteStudentById" parameterType="long">
delete from student where studentid = #{studentId}
</delete>
<delete id="deleteStudentOwnClassByStudentId" parameterType="long">
delete from studentownclass where studentid = #{studentId}
</delete>
<update id="updateCellPhone" parameterType="map">
update student set status = #{status},recognizecode= #{recognizecode},cellphone=#{cellphone}
where studentid = #{studentId}
</update>
<insert id="insertRegister" parameterType="com._3e.entity.Register">
INSERT INTO register ( recognizecode,password,truename,cellphone )
Values ( #{recognizecode},#{password},#{truename},#{cellphone} )
</insert>
<insert id="insertRegisterGDXH" parameterType="com._3e.entity.Register">
INSERT INTO register ( recognizecode,password,truename,cellphone,source,usertype,passcode )
Values ( #{recognizecode},#{password},#{truename},#{cellphone},#{source},#{usertype},#{passcode} )
</insert>
<insert id="insertXinHuaRegister" parameterType="com._3e.entity.Register">
INSERT INTO register ( recognizecode,password,truename,cellphone,usertype,passcode,source )
Values ( #{recognizecode},#{password},#{truename},#{recognizecode},#{usertype},#{passcode},#{source} )
</insert>
<insert id="doSaveWcjTest">
insert into wcjtest (name,age) values ('aaa',25)
</insert>
<update id="doSaveUpdatePassword" parameterType="com._3e.entity.Register">
update register set password = #{password}
where recognizecode = #{recognizecode} and usertype = 1
</update>
<select id="getPassCodeByCellphone" parameterType="map" resultType="string">
select passCode from register where cellphone = #{cellphone} and usertype = #{userType}
</select>
<select id="findLoginOutStudent" resultType="com._3e.entity.Student">
select * from student where recognizeCode like #{recognizeCode}
</select>
</mapper>