You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.4 KiB

3 years ago
package com.zh.project0512.mapper;
3 years ago
import com.zh.project0512.model.Brand;
3 years ago
import com.zh.project0512.model.TeachingRefe;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3 years ago
import org.apache.ibatis.annotations.Update;
3 years ago
/**
* <p>
* Mapper
* </p>
*
* @author zh
* @since 2022-06-14
*/
public interface TeachingRefeMapper extends BaseMapper<TeachingRefe> {
3 years ago
@Update("update teachingRefe set sortWeight = sortWeight + 1 where sortWeight &lt;&gt; 0;;\n" +
"insert into teachingRefe ( fileUrl,type,title, creatAt,sortWeight) VALUES ( #{fileUrl},#{type},#{title}, #{creatAt},1 );")
void addTeachingRefe(TeachingRefe teachingRefe);
@Update("<script>" +
"update teachingRefe set sortWeight = -1 where sortWeight = #{origin};\n" +
"<if test='originHigherCurrent'> " +
"update teachingRefe set sortWeight = sortWeight + 1 where sortWeight &lt;&gt; 0 and sortWeight &gt;= #{current} and sortWeight &lt; #{origin};"+
"</if>" +
"<if test='!originHigherCurrent'> " +
"update teachingRefe set sortWeight = sortWeight - 1 where sortWeight &lt;&gt; 0 and sortWeight &gt; #{origin} and sortWeight &lt;= #{current};\n" +
"</if>" +
"update teachingRefe set sortWeight = #{current} where sortWeight = -1;" +
"</script>")
void updSort(int origin, int current, boolean originHigherCurrent);
3 years ago
}