<?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.clue.mapper.ExtClueCapacityMapper">
    <select id="getCapacityByScopeIds" resultType="java.lang.Integer">
        select capacity from clue_capacity where
        <foreach collection="ids" item="id" separator="or">
            scope_id like concat('%', #{id}, '%')
        </foreach>
        order by create_time desc limit 1
    </select>

    <update id="updateCapacity" parameterType="cn.cordys.crm.clue.domain.ClueCapacity">
        update clue_capacity set scope_id = #{capacity.scopeId}, capacity = #{capacity.capacity},
                                     update_user = #{capacity.updateUser}, update_time = #{capacity.updateTime}
        where id = #{capacity.id}
    </update>
</mapper>