190 lines
7.0 KiB
XML
190 lines
7.0 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.univ3e.dao.UnivStudentDao">
|
|
<select id="findSeq" resultType="long">
|
|
select nextval('seq_univstudentid')
|
|
</select>
|
|
|
|
<insert id="doSave" parameterType="com.univ3e.entity.UnivStudent">
|
|
INSERT INTO univstudent(studentid,password,truename,nickname,gender,address,areaid,recognizecode,cellphone,
|
|
telephone,email,avatar,status,source,schoolid,lastsignin,department,qq)
|
|
VALUES (#{studentid},#{password},#{truename},#{nickname},#{gender},#{address},#{areaid},#{recognizecode},
|
|
#{cellphone},#{telephone},#{email},#{avatar},#{status},#{source},#{schoolid},#{lastsignin},#{department},#{qq})
|
|
</insert>
|
|
|
|
<update id="doSaveUpdate" parameterType="com.univ3e.entity.UnivStudent">
|
|
Update univstudent
|
|
<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="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="schoolid != null">schoolid = #{schoolid},</if>
|
|
<if test="lastsignin != null">lastsignin = #{lastsignin},</if>
|
|
<if test="department != null">department = #{department},</if>
|
|
<if test="qq != null">qq = #{qq},</if>
|
|
<if test="signature != null">signature = #{signature}</if>
|
|
</set>
|
|
WHERE studentid = #{studentid}
|
|
</update>
|
|
|
|
<select id="findByRecognizecode" parameterType="string" resultType="com.univ3e.entity.UnivStudent">
|
|
SELECT * FROM UnivStudent
|
|
WHERE upper(recognizecode) = upper(#{recognizecode})
|
|
</select>
|
|
|
|
<select id="findByStudentid" parameterType="long" resultType="com.univ3e.entity.UnivStudent">
|
|
SELECT * FROM UnivStudent
|
|
WHERE studentid = #{studentid}
|
|
</select>
|
|
|
|
<select id="findByStudentids" parameterType="list" resultType="com.univ3e.entity.UnivStudent">
|
|
SELECT * FROM UnivStudent
|
|
WHERE studentid in
|
|
<foreach item="item" index="index" collection="list"
|
|
open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="findClassByStudentid" parameterType="long" resultType="com.univ3e.entity.UnivClasses" >
|
|
SELECT * FROM UnivClasses
|
|
WHERE classesid in (
|
|
select classesid
|
|
from univstudentownclass where studentid = #{studentid}
|
|
)
|
|
and classtype = 1
|
|
</select>
|
|
|
|
<select id="findAllClassByStudentid" parameterType="long" resultType="com.univ3e.entity.UnivClasses" >
|
|
SELECT * FROM UnivClasses
|
|
WHERE classesid in (
|
|
select classesid from univstudentownclass where studentid = #{studentid} and status =1
|
|
)
|
|
and status = 1
|
|
</select>
|
|
|
|
<select id="findTeamsByStudentid" parameterType="long" resultType="com.univ3e.entity.UnivClasses" >
|
|
SELECT * FROM UnivClasses
|
|
WHERE classesid in (
|
|
select classesid from univstudentownclass 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 univstudent t,univfollowship s
|
|
where t.studentid = s.befollower and t.status = 1 and s.follower = #{follower}
|
|
</select>
|
|
|
|
<select id="findClassMessByStudentid" parameterType="long" resultType="com.univ3e.entity.UnivClassmessage" >
|
|
select t.*
|
|
from univclassmessage t,univstudentownclass a,univclassownmessage b
|
|
where t.classmessageid = b.classmessageid and b.classesid = a.classesid
|
|
and a.studentid = #{studentid} and t.status = 1
|
|
order by created desc
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="findClassMessByStudentids" parameterType="map" resultType="com.univ3e.entity.UnivClassmessage" >
|
|
select t.*
|
|
from univclassmessage t,univclassownmessage b
|
|
where t.classmessageid = b.classmessageid and b.classesid = #{classid} and t.status = 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 , e.schoolName
|
|
from UnivStudent b
|
|
inner join UnivErsity e
|
|
on b.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 UnivClasses a
|
|
left join univteacher b on a.teacherid = b.teacherid
|
|
where a.classesid in (
|
|
select c.classesid from univstudentownclass c where c.studentid = #{studentid}
|
|
)
|
|
and a.classtype = 1 and a.status = 1
|
|
</select>
|
|
|
|
<select id="findTeamsByStudentidV3" parameterType="long" resultType="com._3e.dto.ClassesDto" >
|
|
select a.*,b.truename as teachername
|
|
from UnivClasses a
|
|
left join univteacher b on a.teacherid = b.teacherid
|
|
where a.classesid in (
|
|
select c.classesid from univstudentownclass c where c.studentid = #{studentid} and status = 1
|
|
)
|
|
and a.classtype = 2 and a.status = 1
|
|
order by a.classesid desc
|
|
</select>
|
|
|
|
<select id="findIsJoinByStudentid" parameterType="long" resultType="com.univ3e.http.myhome.dto.OwnTeamDto" >
|
|
SELECT s.classesid , s.isdelegate ,s.status,c.classname
|
|
FROM univstudentownclass s
|
|
INNER JOIN univclasses c ON c.classesid = s.classesid
|
|
WHERE s.studentid = #{studentid} AND c.classType = 2 AND c.status = 1
|
|
</select>
|
|
|
|
<select id="findClassMessByClassesList" parameterType="map" resultType="com.univ3e.entity.UnivClassmessage" >
|
|
select t.* from univclassmessage t,univclassownmessage b
|
|
where t.classmessageid = b.classmessageid
|
|
and b.classesid in
|
|
<foreach item="item" index="index" collection="classesList"
|
|
open="(" separator="," close=")">
|
|
#{item.classesid}
|
|
</foreach>
|
|
and t.status = 1
|
|
<if test="status == '1'.toString()">
|
|
order by created desc
|
|
</if>
|
|
<if test="status == '2'.toString()">
|
|
order by created asc
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findUnivStudentBySchoolId" parameterType="long" resultType="com.univ3e.entity.UnivStudent">
|
|
SELECT * FROM univstudent where schoolId = #{schoolId} and status=1 order by studentid desc
|
|
<if test="page != null">
|
|
LIMIT #{page.limit} OFFSET #{page.offset}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findSchoolNameById" parameterType="map" resultType="string">
|
|
select e.schoolName
|
|
from univStudent b
|
|
inner join univStudentOwnClass c
|
|
on b.studentId = c.studentId and c.status = 1
|
|
inner join univClasses d
|
|
on c.classesId = d.classesId and d.classType = 1
|
|
inner join university e
|
|
on d.schoolId = e.schoolId where b.studentId = #{uid}
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="findCreatedById" parameterType="map" resultType="com.univ3e.entity.UnivStudent">
|
|
select created from univstudent where studentid = #{studentid} and areaid = #{areaid}
|
|
</select>
|
|
|
|
|
|
</mapper>
|