85 lines
2.9 KiB
XML
85 lines
2.9 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="Material">
|
||
|
|
|
||
|
|
<insert id="insertMaterial" parameterType="Material">
|
||
|
|
INSERT INTO Material ( materialId, teacherId, title, content, picture, origiVoice, created, status , areaid , isNetMate ) Values ( #{materialId}, #{teacherId}, #{title}, #{content}, #{picture}, #{origiVoice},current_timestamp, #{status} , #{areaid} , #{isNetMate} )
|
||
|
|
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateMaterial" parameterType="Material">
|
||
|
|
|
||
|
|
|
||
|
|
UPDATE Material SET
|
||
|
|
|
||
|
|
materialId = #{materialId}, teacherId = #{teacherId}, title = #{title}, content = #{content}, picture = #{picture}, origiVoice = #{origiVoice}, created = #{created}, status = #{status} , areaid = #{areaid} , isNetMate = #{isNetMate}
|
||
|
|
where materialId=#{materialId}
|
||
|
|
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="getMaterialByKey" parameterType="java.lang.Integer" resultType="Material">
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
SELECT materialId , teacherId , title , content , picture , origiVoice , created , status , areaid ,isNetMate
|
||
|
|
FROM Material WHERE materialId=#{materialId}
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getSeqMaterial" resultType="Integer" useCache="false" flushCache="true">
|
||
|
|
|
||
|
|
SELECT nextval('seq_materialId') ;
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getMaterialsCountByTeacherId" parameterType="java.util.Map" resultType="Integer">
|
||
|
|
|
||
|
|
SELECT count(*) as howmuch from Material
|
||
|
|
WHERE teacherId=#{teacherId} and status = 1 and areaid = #{areaid}
|
||
|
|
|
||
|
|
</select>
|
||
|
|
<select id="getMaterialsByTeacherId" parameterType="java.util.Map" resultType="Material">
|
||
|
|
|
||
|
|
|
||
|
|
SELECT materialId , teacherId , title , content , picture , origiVoice , created , status , areaid , isNetMate
|
||
|
|
FROM Material
|
||
|
|
WHERE teacherId=#{teacherId} and status = 1 and areaid = #{areaid}
|
||
|
|
ORDER BY materialId desc
|
||
|
|
LIMIT #{pageSize} OFFSET #{offset}
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<update id="materialBatchUpdateByMaterialId">
|
||
|
|
|
||
|
|
UPDATE Material SET status = 0
|
||
|
|
WHERE materialId in
|
||
|
|
|
||
|
|
<foreach collection="list" index="index" item="item" separator="," close=")" open="(">
|
||
|
|
|
||
|
|
#{item}
|
||
|
|
|
||
|
|
</foreach>
|
||
|
|
</update>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getMaterialsCountByNet" resultType="Integer">
|
||
|
|
|
||
|
|
SELECT count(*) as howmuch from Material
|
||
|
|
WHERE isNetMate =1 and status =1
|
||
|
|
|
||
|
|
</select>
|
||
|
|
<select id="getMaterialsByNet" parameterType="java.util.Map" resultType="Material">
|
||
|
|
|
||
|
|
|
||
|
|
SELECT materialId , teacherId , title , content , picture , origiVoice , created , status , areaid , isNetMate
|
||
|
|
FROM Material
|
||
|
|
WHERE isNetMate =1 and status = 1
|
||
|
|
ORDER BY materialId desc
|
||
|
|
LIMIT #{pageSize} OFFSET #{offset}
|
||
|
|
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|