<?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="com.goafanti.common.dao.MemberOrderMapper">
	<!-- 更改用户会员等级 -->
	<update id="updateUserLvl" parameterType="java.util.Map">
		UPDATE user SET
		lvl=#{lvl} WHERE id=#{userId}
	</update>
	
	<update id="updateBatchUserLvl" parameterType="java.util.Map">
	 	update user set lvl = #{lvl}
	 	where id in 
		<foreach item="item" collection="list" open="(" separator="," close=")">
			#{item}
		</foreach>
	 </update>
	
	<select id="selectExpired" resultType="java.lang.String">
		SELECT user_id FROM member_order 
		where (order_state=1 or order_state=3) 
		and valid_time &gt; CURDATE() and valid_time &lt; date_sub(CURDATE(),interval -1 day)  
    </select>
</mapper>