<?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="cn.cordys.crm.system.mapper.ExtModuleMapper">
    <update id="moveUpModule" parameterType="java.lang.Long">
        update sys_module
        set pos = pos - 1
        where pos &gt; #{start}
          and pos &lt;= #{end}
    </update>

    <update id="moveDownModule" parameterType="java.lang.Long">
        update sys_module
        set pos = pos + 1
        where pos &gt;= #{start}
          and pos &lt; #{end}
    </update>
    <select id="selectModuleListByKeyOrderPosDesc" resultType="cn.cordys.crm.system.domain.Module">
        select *
        from sys_module
        where module_key = #{moduleKey}
          and organization_id = #{orgId}
        order by pos desc
    </select>
</mapper>