<?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.ExtDictMapper">
    <update id="updateModuleConfig" parameterType="cn.cordys.crm.system.domain.DictConfig">
        update sys_dict_config set enabled = #{config.enabled} where module = #{config.module} and organization_id = #{config.organizationId}
    </update>

    <update id="moveUpDict">
        update sys_dict set pos = pos - 1 where pos &gt; #{start} and pos &lt;= #{end} and module = #{module} and organization_id = #{orgId}
    </update>

    <update id="moveDownDict">
        update sys_dict set pos = pos + 1 where pos &gt;= #{start} and pos &lt; #{end} and module = #{module} and organization_id = #{orgId}
    </update>

    <select id="getNextPos" resultType="java.lang.Long">
        select max(pos) + 1 from sys_dict where module = #{module} and organization_id = #{orgId}
    </select>

    <update id="updateDictPos">
        update sys_dict set pos = #{pos}, update_user = #{currentUser}, update_time = unix_timestamp() * 1000 where id = #{id}
    </update>
</mapper>