<select id="seleDateByCase" resultMap="BaseResultMap" parameterType="java.lang.String"> select <include refid="Base_Column_List" /> from litemall_signin_record lsu <where> <choose> <when test="type == 1"> lsu.signin_num_get < 0 </when> <when test="type == 2"> lsu.signin_num_get > 0 </when> </choose> and user_id = #{userId} order by lsu.update_time desc </where> </select>
在xml中定义choose的sql语句定义。