131 lines
4.5 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="SchoolUser">
<sql id="baseSql">
SchoolUserId , name , schoolId , areaId , code , status , deviceCode ,
ifActivity , activityTime , cpuNo,type,padCode,padActivity,padActivtime
</sql>
<insert id="insertSchoolUser" parameterType="SchoolUser">
INSERT INTO SchoolUser ( SchoolUserId, name, schoolId, areaId, code, status,
deviceCode, ifActivity, activityTime , cpuNo,type,padCode,padActivity,padActivtime )
Values ( #{SchoolUserId}, #{name}, #{schoolId}, #{areaId}, #{code}, #{status},
#{deviceCode}, #{ifActivity}, #{activityTime} , #{cpuNo},#{type}, #{padCode},#{padActivity},#{padActivtime})
</insert>
<update id="updateSchoolUser" parameterType="SchoolUser">
UPDATE SchoolUser SET
SchoolUserId = #{SchoolUserId}, name = #{name}, schoolId = #{schoolId}, areaId = #{areaId},
code = #{code}, status = #{status}, deviceCode = #{deviceCode}, ifActivity = #{ifActivity},
activityTime = #{activityTime} , cpuNo = #{cpuNo},type=#{type},padCode = #{padCode},padActivity=#{padActivity},
padActivtime=#{padActivtime}
where SchoolUserId=#{SchoolUserId}
</update>
<select id="getSchoolUserByKey" parameterType="java.lang.Long" resultType="SchoolUser">
SELECT <include refid="baseSql"/>
FROM SchoolUser WHERE SchoolUserId=#{SchoolUserId}
</select>
<select id="getSchoolUserByCode" parameterType="String" resultType="SchoolUser">
SELECT <include refid="baseSql"/>
FROM SchoolUser WHERE code=#{_parameter} limit 1
</select>
<select id="getSeqSchoolUser" resultType="Integer" useCache="false" flushCache="true">
SELECT nextval('seq_schoolUserId') ;
</select>
<select id="getAllSchoolUser" resultType="SchoolUser">
SELECT <include refid="baseSql"/>
FROM SchoolUser WHERE status = 1
</select>
<insert id="insertSchoolUserBatch" parameterType="java.util.List">
INSERT INTO SchoolUser ( SchoolUserId, name, schoolId, areaId, code,
status, deviceCode, ifActivity, activityTime , cpuNo ,type,padCode,padActivity,padActivtime ) Values
<foreach collection="list" index="index" item="item" separator=",">
( #{item.SchoolUserId}, #{item.name}, #{item.schoolId},
#{item.areaId}, #{item.code}, #{item.status},
#{item.deviceCode}, #{item.ifActivity},
#{item.activityTime} , #{item.cpuNo} ,#{item.type}, #{item.padCode},#{item.padActivity},#{item.padActivtime} )
</foreach>
</insert>
<select id="getSchoolUsersBySchoolId" parameterType="java.util.Map" resultType="SchoolUser">
SELECT <include refid="baseSql"/>
FROM SchoolUser WHERE status = 1 and schoolId = #{schoolId}
<if test="isActivity==1" >
and ifActivity = 1
</if>
ORDER BY code,SchoolUserId
<if test="pageSize!=null">
limit #{pageSize}
</if>
<if test="offset!=null">
offset #{offset}
</if>
</select>
<select id="getSchoolUsersBySchoolIdCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(SchoolUserId)
FROM SchoolUser WHERE status = 1 and schoolId = #{schoolId}
<if test="isActivity==1" >
and ifActivity = 1
</if>
</select>
<select id="getSchoolUsersifActivityCountBySchoolId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT count(SchoolUserId) howmuch ,ifActivity
FROM SchoolUser WHERE status = 1 and schoolId = #{schoolId}
<if test="isActivity==1" >
and ifActivity = 1
</if>
group by ifActivity
</select>
<select id="getSchoolUsersActivityCountBySchoolId" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(SchoolUserId) howmuch from SchoolUser where status = 1 and schoolId = #{schoolId} and (ifActivity = 1 or padActivity = 1)
</select>
<select id="getSchoolUserByCPUNO" parameterType="java.util.Map" resultType="SchoolUser">
SELECT <include refid="baseSql"/>
FROM SchoolUser
WHERE status = 1 and cpuNo = #{cpuNo} and deviceCode = #{deviceCode}
</select>
<select id = "deleteSchoolUserBatch" parameterType="java.util.List" >
update schooluser set code=code||'_delete',status=0 where schooluserid in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</select>
</mapper>