113 lines
4.2 KiB
XML
Raw Normal View History

2026-03-10 14:30:24 +08:00
<?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="School">
<insert id="insertSchool" parameterType="School">
INSERT INTO School ( schoolId, schoolName, address, areaId, telephone, url, contactor, cellphone, description, status ,serviceFee,orderId ) Values ( #{schoolId}, #{schoolName}, #{address}, #{areaId}, #{telephone}, #{url}, #{contactor}, #{cellphone}, #{description}, #{status} , #{serviceFee},#{orderId} )
</insert>
<update id="updateSchool" parameterType="School">
UPDATE School SET
schoolId = #{schoolId}, schoolName = #{schoolName}, address = #{address}, areaId = #{areaId}, telephone = #{telephone}, url = #{url}, contactor = #{contactor}, cellphone = #{cellphone}, description = #{description}, status = #{status} ,serviceFee = #{serviceFee},orderId=#{orderId}
where schoolId=#{schoolId}
</update>
<select id="getSchoolByKey" parameterType="java.lang.Long" resultType="School">
SELECT schoolId , schoolName , address , areaId , telephone , url , contactor , cellphone , description , status ,serviceFee ,orderId
FROM School WHERE schoolId=#{schoolId}
</select>
<select id="getSchoolByProxyId" parameterType="java.lang.Long" resultType="java.lang.Long">
with temp as (
select Distinct b.schoolid from area as a inner join school as b on a.areaid = b.areaid where a.parentid in (select areaId from adminownarea where adminid = #{adminId} and type =1)
union all
select Distinct b.schoolid from area as a inner join school as b on a.areaid = b.areaid where a.areaid in (select areaId from adminownarea where adminid =#{adminId} and type =2)
union all
select a.schoolid from school as a where a.schoolid in (select schoolid from adminownschool where adminid = #{adminId})
)
select DISTINCT schoolid from temp
</select>
<select id="getSeqSchool" resultType="Integer" useCache="false" flushCache="true">
SELECT nextval('seq_schoolId') ;
</select>
<select id="getSchoolsCountByAreaId" parameterType="java.lang.Integer" resultType="Integer">
SELECT count(*) as howmuch from School
WHERE areaId=#{areaId}and status = 1
</select>
<select id="getSchoolsByAreaId" parameterType="java.util.Map" resultType="School">
SELECT schoolId , schoolName , address , areaId , telephone , url , contactor , cellphone , description , status ,serviceFee ,orderId
FROM School
WHERE areaId=#{areaId} and status = 1
order by schoolId
LIMIT #{pageSize} OFFSET #{offset}
</select>
<select id="getSchoolsIncreaseCountByAreaId" parameterType="java.util.Map" resultType="Integer">
SELECT count(*) as howmuch from School
WHERE areaId=#{areaId}and status = 1
and created&gt;#{startTime} and created&lt;#{endTime}
</select>
<select id="getSchoolsIncreaseByAreaId" parameterType="java.util.Map" resultType="School">
SELECT schoolId , schoolName , address , areaId , telephone , url , contactor , cellphone , description , status ,serviceFee
FROM School
WHERE areaId=#{areaId} and status = 1
and created&gt;#{startTime} and created&lt;#{endTime}
order by created desc,schoolId
<if test="pageSize!=null">
LIMIT #{pageSize}
</if>
<if test="offset!=null">
OFFSET #{offset}
</if>
</select>
<select id="findSchoolidByStudentid" parameterType="java.lang.Long"
resultType="java.lang.Long">
select c.schoolid
from classes c join studentownclass s on s.classesid = c.classesid and
s.status = 1
where s.studentid = #{studentid} and c.classtype=1 and c.status = 1
</select>
<select id="findSchoolidByTeacherid" parameterType="java.lang.Long" resultType="java.lang.Long">
SELECT schoolid FROM teacher WHERE teacherid = #{teacherid}
</select>
<select id="getTeacherIdsBySchoolId" parameterType="java.lang.Long" resultType="java.lang.Long">
SELECT teacherId
FROM Teacher
WHERE schoolId=#{schoolId} and status=1
ORDER BY loginNo
</select>
</mapper>